@payloadcms/ui 3.0.0-beta.70 → 3.0.0-beta.71

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 (251) hide show
  1. package/dist/elements/ArrayAction/index.d.ts +1 -1
  2. package/dist/elements/ArrayAction/index.d.ts.map +1 -1
  3. package/dist/elements/ArrayAction/index.js +1 -1
  4. package/dist/elements/ArrayAction/index.js.map +1 -1
  5. package/dist/elements/Autosave/index.d.ts.map +1 -1
  6. package/dist/elements/Autosave/index.js +7 -1
  7. package/dist/elements/Autosave/index.js.map +1 -1
  8. package/dist/elements/Collapsible/index.d.ts +1 -1
  9. package/dist/elements/Collapsible/index.d.ts.map +1 -1
  10. package/dist/elements/Collapsible/index.js +1 -1
  11. package/dist/elements/Collapsible/index.js.map +1 -1
  12. package/dist/elements/DocumentFields/index.d.ts +1 -2
  13. package/dist/elements/DocumentFields/index.d.ts.map +1 -1
  14. package/dist/elements/DocumentFields/index.js.map +1 -1
  15. package/dist/elements/Drawer/index.d.ts.map +1 -1
  16. package/dist/elements/Drawer/index.js +3 -0
  17. package/dist/elements/Drawer/index.js.map +1 -1
  18. package/dist/elements/Drawer/index.scss +2 -1
  19. package/dist/elements/EditMany/index.d.ts +1 -2
  20. package/dist/elements/EditMany/index.d.ts.map +1 -1
  21. package/dist/elements/EditMany/index.js.map +1 -1
  22. package/dist/elements/FieldSelect/index.d.ts +1 -2
  23. package/dist/elements/FieldSelect/index.d.ts.map +1 -1
  24. package/dist/elements/FieldSelect/index.js.map +1 -1
  25. package/dist/elements/ListControls/getTextFieldsToBeSearched.d.ts +1 -1
  26. package/dist/elements/ListControls/getTextFieldsToBeSearched.d.ts.map +1 -1
  27. package/dist/elements/ListControls/getTextFieldsToBeSearched.js.map +1 -1
  28. package/dist/elements/ListControls/index.d.ts +1 -2
  29. package/dist/elements/ListControls/index.d.ts.map +1 -1
  30. package/dist/elements/ListControls/index.js.map +1 -1
  31. package/dist/elements/SortColumn/index.d.ts +2 -2
  32. package/dist/elements/SortColumn/index.d.ts.map +1 -1
  33. package/dist/elements/SortColumn/index.js.map +1 -1
  34. package/dist/elements/StepNav/types.d.ts +2 -2
  35. package/dist/elements/StepNav/types.d.ts.map +1 -1
  36. package/dist/elements/StepNav/types.js.map +1 -1
  37. package/dist/elements/Table/index.d.ts +1 -2
  38. package/dist/elements/Table/index.d.ts.map +1 -1
  39. package/dist/elements/Table/index.js.map +1 -1
  40. package/dist/elements/TableColumns/buildColumnState.d.ts +1 -2
  41. package/dist/elements/TableColumns/buildColumnState.d.ts.map +1 -1
  42. package/dist/elements/TableColumns/buildColumnState.js.map +1 -1
  43. package/dist/elements/TableColumns/filterFields.d.ts +1 -1
  44. package/dist/elements/TableColumns/filterFields.d.ts.map +1 -1
  45. package/dist/elements/TableColumns/filterFields.js.map +1 -1
  46. package/dist/elements/TableColumns/getInitialColumns.d.ts +1 -1
  47. package/dist/elements/TableColumns/getInitialColumns.d.ts.map +1 -1
  48. package/dist/elements/TableColumns/getInitialColumns.js.map +1 -1
  49. package/dist/elements/WhereBuilder/Condition/Relationship/index.d.ts.map +1 -1
  50. package/dist/elements/WhereBuilder/Condition/Relationship/index.js +7 -1
  51. package/dist/elements/WhereBuilder/Condition/Relationship/index.js.map +1 -1
  52. package/dist/elements/WhereBuilder/reduceFieldMap.d.ts +1 -1
  53. package/dist/elements/WhereBuilder/reduceFieldMap.d.ts.map +1 -1
  54. package/dist/elements/WhereBuilder/reduceFieldMap.js +3 -3
  55. package/dist/elements/WhereBuilder/reduceFieldMap.js.map +1 -1
  56. package/dist/elements/WhereBuilder/types.d.ts +1 -2
  57. package/dist/elements/WhereBuilder/types.d.ts.map +1 -1
  58. package/dist/elements/WhereBuilder/types.js.map +1 -1
  59. package/dist/exports/client/index.d.ts +5 -6
  60. package/dist/exports/client/index.d.ts.map +1 -1
  61. package/dist/exports/client/index.js +18 -18
  62. package/dist/exports/client/index.js.map +3 -3
  63. package/dist/fields/Array/ArrayRow.d.ts +2 -3
  64. package/dist/fields/Array/ArrayRow.d.ts.map +1 -1
  65. package/dist/fields/Array/ArrayRow.js.map +1 -1
  66. package/dist/fields/Array/index.d.ts +1 -14
  67. package/dist/fields/Array/index.d.ts.map +1 -1
  68. package/dist/fields/Array/index.js +3 -1
  69. package/dist/fields/Array/index.js.map +1 -1
  70. package/dist/fields/Blocks/BlockRow.d.ts +2 -3
  71. package/dist/fields/Blocks/BlockRow.d.ts.map +1 -1
  72. package/dist/fields/Blocks/BlockRow.js.map +1 -1
  73. package/dist/fields/Blocks/BlocksDrawer/index.d.ts +2 -3
  74. package/dist/fields/Blocks/BlocksDrawer/index.d.ts.map +1 -1
  75. package/dist/fields/Blocks/BlocksDrawer/index.js +1 -1
  76. package/dist/fields/Blocks/BlocksDrawer/index.js.map +1 -1
  77. package/dist/fields/Blocks/RowActions.d.ts +2 -3
  78. package/dist/fields/Blocks/RowActions.d.ts.map +1 -1
  79. package/dist/fields/Blocks/RowActions.js +1 -1
  80. package/dist/fields/Blocks/RowActions.js.map +1 -1
  81. package/dist/fields/Blocks/index.d.ts +1 -14
  82. package/dist/fields/Blocks/index.d.ts.map +1 -1
  83. package/dist/fields/Blocks/index.js +2 -2
  84. package/dist/fields/Blocks/index.js.map +1 -1
  85. package/dist/fields/Checkbox/Input.d.ts +1 -1
  86. package/dist/fields/Checkbox/Input.d.ts.map +1 -1
  87. package/dist/fields/Checkbox/Input.js.map +1 -1
  88. package/dist/fields/Checkbox/index.d.ts +1 -1
  89. package/dist/fields/Checkbox/index.d.ts.map +1 -1
  90. package/dist/fields/Checkbox/index.js +2 -2
  91. package/dist/fields/Checkbox/index.js.map +1 -1
  92. package/dist/fields/Code/index.d.ts +1 -9
  93. package/dist/fields/Code/index.d.ts.map +1 -1
  94. package/dist/fields/Code/index.js +2 -2
  95. package/dist/fields/Code/index.js.map +1 -1
  96. package/dist/fields/Collapsible/index.d.ts +1 -7
  97. package/dist/fields/Collapsible/index.d.ts.map +1 -1
  98. package/dist/fields/Collapsible/index.js +2 -2
  99. package/dist/fields/Collapsible/index.js.map +1 -1
  100. package/dist/fields/DateTime/index.d.ts +1 -9
  101. package/dist/fields/DateTime/index.d.ts.map +1 -1
  102. package/dist/fields/DateTime/index.js +2 -2
  103. package/dist/fields/DateTime/index.js.map +1 -1
  104. package/dist/fields/Email/index.d.ts +1 -9
  105. package/dist/fields/Email/index.d.ts.map +1 -1
  106. package/dist/fields/Email/index.js +2 -2
  107. package/dist/fields/Email/index.js.map +1 -1
  108. package/dist/fields/FieldDescription/index.d.ts +2 -2
  109. package/dist/fields/FieldDescription/index.d.ts.map +1 -1
  110. package/dist/fields/FieldDescription/index.js.map +1 -1
  111. package/dist/fields/FieldError/index.d.ts +2 -2
  112. package/dist/fields/FieldError/index.d.ts.map +1 -1
  113. package/dist/fields/FieldError/index.js.map +1 -1
  114. package/dist/fields/FieldLabel/index.d.ts +2 -2
  115. package/dist/fields/FieldLabel/index.d.ts.map +1 -1
  116. package/dist/fields/FieldLabel/index.js.map +1 -1
  117. package/dist/fields/Group/index.d.ts +2 -10
  118. package/dist/fields/Group/index.d.ts.map +1 -1
  119. package/dist/fields/Group/index.js +2 -2
  120. package/dist/fields/Group/index.js.map +1 -1
  121. package/dist/fields/Hidden/index.d.ts +2 -9
  122. package/dist/fields/Hidden/index.d.ts.map +1 -1
  123. package/dist/fields/Hidden/index.js +2 -2
  124. package/dist/fields/Hidden/index.js.map +1 -1
  125. package/dist/fields/JSON/index.d.ts +1 -9
  126. package/dist/fields/JSON/index.d.ts.map +1 -1
  127. package/dist/fields/JSON/index.js +2 -2
  128. package/dist/fields/JSON/index.js.map +1 -1
  129. package/dist/fields/Number/index.d.ts +1 -14
  130. package/dist/fields/Number/index.d.ts.map +1 -1
  131. package/dist/fields/Number/index.js +2 -2
  132. package/dist/fields/Number/index.js.map +1 -1
  133. package/dist/fields/Password/index.d.ts +1 -2
  134. package/dist/fields/Password/index.d.ts.map +1 -1
  135. package/dist/fields/Password/index.js +2 -2
  136. package/dist/fields/Password/index.js.map +1 -1
  137. package/dist/fields/Point/index.d.ts +2 -9
  138. package/dist/fields/Point/index.d.ts.map +1 -1
  139. package/dist/fields/Point/index.js +2 -2
  140. package/dist/fields/Point/index.js.map +1 -1
  141. package/dist/fields/RadioGroup/Radio/index.d.ts +2 -3
  142. package/dist/fields/RadioGroup/Radio/index.d.ts.map +1 -1
  143. package/dist/fields/RadioGroup/Radio/index.js.map +1 -1
  144. package/dist/fields/RadioGroup/index.d.ts +1 -12
  145. package/dist/fields/RadioGroup/index.d.ts.map +1 -1
  146. package/dist/fields/RadioGroup/index.js +2 -2
  147. package/dist/fields/RadioGroup/index.js.map +1 -1
  148. package/dist/fields/Relationship/index.d.ts +1 -2
  149. package/dist/fields/Relationship/index.d.ts.map +1 -1
  150. package/dist/fields/Relationship/index.js +2 -2
  151. package/dist/fields/Relationship/index.js.map +1 -1
  152. package/dist/fields/Relationship/types.d.ts +1 -11
  153. package/dist/fields/Relationship/types.d.ts.map +1 -1
  154. package/dist/fields/Relationship/types.js.map +1 -1
  155. package/dist/fields/RichText/index.d.ts +2 -8
  156. package/dist/fields/RichText/index.d.ts.map +1 -1
  157. package/dist/fields/RichText/index.js.map +1 -1
  158. package/dist/fields/Row/index.d.ts +1 -2
  159. package/dist/fields/Row/index.d.ts.map +1 -1
  160. package/dist/fields/Row/index.js +2 -2
  161. package/dist/fields/Row/index.js.map +1 -1
  162. package/dist/fields/Row/index.scss +1 -5
  163. package/dist/fields/Select/Input.d.ts +1 -2
  164. package/dist/fields/Select/Input.d.ts.map +1 -1
  165. package/dist/fields/Select/Input.js.map +1 -1
  166. package/dist/fields/Select/index.d.ts +1 -13
  167. package/dist/fields/Select/index.d.ts.map +1 -1
  168. package/dist/fields/Select/index.js +2 -2
  169. package/dist/fields/Select/index.js.map +1 -1
  170. package/dist/fields/Tabs/Tab/index.d.ts +1 -1
  171. package/dist/fields/Tabs/Tab/index.d.ts.map +1 -1
  172. package/dist/fields/Tabs/Tab/index.js.map +1 -1
  173. package/dist/fields/Tabs/index.d.ts +1 -9
  174. package/dist/fields/Tabs/index.d.ts.map +1 -1
  175. package/dist/fields/Tabs/index.js +24 -24
  176. package/dist/fields/Tabs/index.js.map +1 -1
  177. package/dist/fields/Text/index.d.ts +3 -2
  178. package/dist/fields/Text/index.d.ts.map +1 -1
  179. package/dist/fields/Text/index.js +2 -2
  180. package/dist/fields/Text/index.js.map +1 -1
  181. package/dist/fields/Text/types.d.ts +1 -15
  182. package/dist/fields/Text/types.d.ts.map +1 -1
  183. package/dist/fields/Text/types.js.map +1 -1
  184. package/dist/fields/Textarea/index.d.ts +3 -2
  185. package/dist/fields/Textarea/index.d.ts.map +1 -1
  186. package/dist/fields/Textarea/index.js +2 -2
  187. package/dist/fields/Textarea/index.js.map +1 -1
  188. package/dist/fields/Textarea/types.d.ts +1 -11
  189. package/dist/fields/Textarea/types.d.ts.map +1 -1
  190. package/dist/fields/Textarea/types.js.map +1 -1
  191. package/dist/fields/Upload/Input.d.ts +1 -2
  192. package/dist/fields/Upload/Input.d.ts.map +1 -1
  193. package/dist/fields/Upload/Input.js.map +1 -1
  194. package/dist/fields/Upload/index.d.ts +1 -1
  195. package/dist/fields/Upload/index.d.ts.map +1 -1
  196. package/dist/fields/Upload/index.js +2 -2
  197. package/dist/fields/Upload/index.js.map +1 -1
  198. package/dist/fields/shared/index.d.ts +1 -25
  199. package/dist/fields/shared/index.d.ts.map +1 -1
  200. package/dist/fields/shared/index.js.map +1 -1
  201. package/dist/forms/Form/createNestedFieldPath.d.ts +1 -2
  202. package/dist/forms/Form/createNestedFieldPath.d.ts.map +1 -1
  203. package/dist/forms/Form/createNestedFieldPath.js.map +1 -1
  204. package/dist/forms/RenderFields/RenderField.d.ts +4 -3
  205. package/dist/forms/RenderFields/RenderField.d.ts.map +1 -1
  206. package/dist/forms/RenderFields/RenderField.js.map +1 -1
  207. package/dist/forms/RenderFields/types.d.ts +1 -2
  208. package/dist/forms/RenderFields/types.d.ts.map +1 -1
  209. package/dist/forms/RenderFields/types.js.map +1 -1
  210. package/dist/forms/WatchChildErrors/buildPathSegments.d.ts +1 -1
  211. package/dist/forms/WatchChildErrors/buildPathSegments.d.ts.map +1 -1
  212. package/dist/forms/WatchChildErrors/buildPathSegments.js.map +1 -1
  213. package/dist/forms/WatchChildErrors/index.d.ts +1 -1
  214. package/dist/forms/WatchChildErrors/index.d.ts.map +1 -1
  215. package/dist/forms/WatchChildErrors/index.js.map +1 -1
  216. package/dist/hooks/usePayloadAPI.d.ts.map +1 -1
  217. package/dist/hooks/usePayloadAPI.js +5 -1
  218. package/dist/hooks/usePayloadAPI.js.map +1 -1
  219. package/dist/hooks/useUseAsTitle.d.ts +1 -2
  220. package/dist/hooks/useUseAsTitle.d.ts.map +1 -1
  221. package/dist/hooks/useUseAsTitle.js.map +1 -1
  222. package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts +1 -2
  223. package/dist/providers/ComponentMap/buildComponentMap/fields.d.ts.map +1 -1
  224. package/dist/providers/ComponentMap/buildComponentMap/fields.js +126 -95
  225. package/dist/providers/ComponentMap/buildComponentMap/fields.js.map +1 -1
  226. package/dist/providers/ComponentMap/buildComponentMap/types.d.ts +1 -56
  227. package/dist/providers/ComponentMap/buildComponentMap/types.d.ts.map +1 -1
  228. package/dist/providers/ComponentMap/buildComponentMap/types.js.map +1 -1
  229. package/dist/providers/ComponentMap/index.d.ts +2 -1
  230. package/dist/providers/ComponentMap/index.d.ts.map +1 -1
  231. package/dist/providers/ComponentMap/index.js.map +1 -1
  232. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  233. package/dist/providers/DocumentInfo/index.js +5 -1
  234. package/dist/providers/DocumentInfo/index.js.map +1 -1
  235. package/dist/styles.css +1 -1
  236. package/dist/utilities/flattenFieldMap.d.ts +1 -1
  237. package/dist/utilities/flattenFieldMap.d.ts.map +1 -1
  238. package/dist/utilities/flattenFieldMap.js.map +1 -1
  239. package/package.json +4 -4
  240. package/dist/fields/Checkbox/types.d.ts +0 -12
  241. package/dist/fields/Checkbox/types.d.ts.map +0 -1
  242. package/dist/fields/Checkbox/types.js +0 -3
  243. package/dist/fields/Checkbox/types.js.map +0 -1
  244. package/dist/fields/Row/types.d.ts +0 -12
  245. package/dist/fields/Row/types.d.ts.map +0 -1
  246. package/dist/fields/Row/types.js +0 -3
  247. package/dist/fields/Row/types.js.map +0 -1
  248. package/dist/fields/Upload/types.d.ts +0 -10
  249. package/dist/fields/Upload/types.d.ts.map +0 -1
  250. package/dist/fields/Upload/types.js +0 -3
  251. package/dist/fields/Upload/types.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/Checkbox/Input.tsx"],"sourcesContent":["'use client'\nimport type { LabelProps, SanitizedLabelProps } from 'payload'\n\nimport React from 'react'\n\nimport { CheckIcon } from '../../icons/Check/index.js'\nimport { LineIcon } from '../../icons/Line/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\n\nexport type CheckboxInputProps = {\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n CustomLabel?: React.ReactNode\n checked?: boolean\n className?: string\n id?: string\n inputRef?: React.RefObject<HTMLInputElement | null>\n label?: LabelProps['label']\n labelProps?: SanitizedLabelProps\n name?: string\n onToggle: (event: React.ChangeEvent<HTMLInputElement>) => void\n partialChecked?: boolean\n readOnly?: boolean\n required?: boolean\n}\n\nexport const inputBaseClass = 'checkbox-input'\n\nexport const CheckboxInput: React.FC<CheckboxInputProps> = ({\n id,\n name,\n AfterInput,\n BeforeInput,\n CustomLabel,\n checked,\n className,\n inputRef,\n label,\n labelProps,\n onToggle,\n partialChecked,\n readOnly,\n required,\n}) => {\n return (\n <div\n className={[\n className,\n inputBaseClass,\n checked && `${inputBaseClass}--checked`,\n readOnly && `${inputBaseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <div className={`${inputBaseClass}__input`}>\n {BeforeInput}\n <input\n aria-label=\"\"\n defaultChecked={Boolean(checked)}\n disabled={readOnly}\n id={id}\n name={name}\n onInput={onToggle}\n ref={inputRef}\n required={required}\n type=\"checkbox\"\n />\n <span\n className={[`${inputBaseClass}__icon`, !checked && partialChecked ? 'check' : 'partial']\n .filter(Boolean)\n .join(' ')}\n >\n {checked && <CheckIcon />}\n {!checked && partialChecked && <LineIcon />}\n </span>\n {AfterInput}\n </div>\n <FieldLabel\n CustomLabel={CustomLabel}\n htmlFor={id}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n </div>\n )\n}\n"],"names":["React","CheckIcon","LineIcon","FieldLabel","inputBaseClass","CheckboxInput","id","name","AfterInput","BeforeInput","CustomLabel","checked","className","inputRef","label","labelProps","onToggle","partialChecked","readOnly","required","div","filter","Boolean","join","input","aria-label","defaultChecked","disabled","onInput","ref","type","span","htmlFor"],"mappings":"AAAA;;AAGA,OAAOA,WAAW,QAAO;AAEzB,SAASC,SAAS,QAAQ,6BAA4B;AACtD,SAASC,QAAQ,QAAQ,4BAA2B;AACpD,SAASC,UAAU,QAAQ,yBAAwB;AAmBnD,OAAO,MAAMC,iBAAiB,iBAAgB;AAE9C,OAAO,MAAMC,gBAA8C,CAAC,EAC1DC,EAAE,EACFC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,WAAW,EACXC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRC,QAAQ,EACT;IACC,qBACE,MAACC;QACCR,WAAW;YACTA;YACAR;YACAO,WAAW,CAAC,EAAEP,eAAe,SAAS,CAAC;YACvCc,YAAY,CAAC,EAAEd,eAAe,WAAW,CAAC;SAC3C,CACEiB,MAAM,CAACC,SACPC,IAAI,CAAC;;0BAER,MAACH;gBAAIR,WAAW,CAAC,EAAER,eAAe,OAAO,CAAC;;oBACvCK;kCACD,KAACe;wBACCC,cAAW;wBACXC,gBAAgBJ,QAAQX;wBACxBgB,UAAUT;wBACVZ,IAAIA;wBACJC,MAAMA;wBACNqB,SAASZ;wBACTa,KAAKhB;wBACLM,UAAUA;wBACVW,MAAK;;kCAEP,MAACC;wBACCnB,WAAW;4BAAC,CAAC,EAAER,eAAe,MAAM,CAAC;4BAAE,CAACO,WAAWM,iBAAiB,UAAU;yBAAU,CACrFI,MAAM,CAACC,SACPC,IAAI,CAAC;;4BAEPZ,yBAAW,KAACV;4BACZ,CAACU,WAAWM,gCAAkB,KAACf;;;oBAEjCM;;;0BAEH,KAACL;gBACCO,aAAaA;gBACbsB,SAAS1B;gBACTQ,OAAOA;gBACPK,UAAUA;gBACT,GAAIJ,cAAc,CAAC,CAAC;;;;AAI7B,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/Checkbox/Input.tsx"],"sourcesContent":["'use client'\nimport type { LabelProps, SanitizedLabelProps } from 'payload'\n\nimport React from 'react'\n\nimport { CheckIcon } from '../../icons/Check/index.js'\nimport { LineIcon } from '../../icons/Line/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\n\nexport type CheckboxInputProps = {\n AfterInput?: React.ReactNode\n BeforeInput?: React.ReactNode\n CustomLabel?: React.ReactNode\n checked?: boolean\n className?: string\n id?: string\n inputRef?: React.RefObject<HTMLInputElement | null>\n label?: LabelProps<'checkbox'>['label']\n labelProps?: SanitizedLabelProps\n name?: string\n onToggle: (event: React.ChangeEvent<HTMLInputElement>) => void\n partialChecked?: boolean\n readOnly?: boolean\n required?: boolean\n}\n\nexport const inputBaseClass = 'checkbox-input'\n\nexport const CheckboxInput: React.FC<CheckboxInputProps> = ({\n id,\n name,\n AfterInput,\n BeforeInput,\n CustomLabel,\n checked,\n className,\n inputRef,\n label,\n labelProps,\n onToggle,\n partialChecked,\n readOnly,\n required,\n}) => {\n return (\n <div\n className={[\n className,\n inputBaseClass,\n checked && `${inputBaseClass}--checked`,\n readOnly && `${inputBaseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n <div className={`${inputBaseClass}__input`}>\n {BeforeInput}\n <input\n aria-label=\"\"\n defaultChecked={Boolean(checked)}\n disabled={readOnly}\n id={id}\n name={name}\n onInput={onToggle}\n ref={inputRef}\n required={required}\n type=\"checkbox\"\n />\n <span\n className={[`${inputBaseClass}__icon`, !checked && partialChecked ? 'check' : 'partial']\n .filter(Boolean)\n .join(' ')}\n >\n {checked && <CheckIcon />}\n {!checked && partialChecked && <LineIcon />}\n </span>\n {AfterInput}\n </div>\n <FieldLabel\n CustomLabel={CustomLabel}\n htmlFor={id}\n label={label}\n required={required}\n {...(labelProps || {})}\n />\n </div>\n )\n}\n"],"names":["React","CheckIcon","LineIcon","FieldLabel","inputBaseClass","CheckboxInput","id","name","AfterInput","BeforeInput","CustomLabel","checked","className","inputRef","label","labelProps","onToggle","partialChecked","readOnly","required","div","filter","Boolean","join","input","aria-label","defaultChecked","disabled","onInput","ref","type","span","htmlFor"],"mappings":"AAAA;;AAGA,OAAOA,WAAW,QAAO;AAEzB,SAASC,SAAS,QAAQ,6BAA4B;AACtD,SAASC,QAAQ,QAAQ,4BAA2B;AACpD,SAASC,UAAU,QAAQ,yBAAwB;AAmBnD,OAAO,MAAMC,iBAAiB,iBAAgB;AAE9C,OAAO,MAAMC,gBAA8C,CAAC,EAC1DC,EAAE,EACFC,IAAI,EACJC,UAAU,EACVC,WAAW,EACXC,WAAW,EACXC,OAAO,EACPC,SAAS,EACTC,QAAQ,EACRC,KAAK,EACLC,UAAU,EACVC,QAAQ,EACRC,cAAc,EACdC,QAAQ,EACRC,QAAQ,EACT;IACC,qBACE,MAACC;QACCR,WAAW;YACTA;YACAR;YACAO,WAAW,CAAC,EAAEP,eAAe,SAAS,CAAC;YACvCc,YAAY,CAAC,EAAEd,eAAe,WAAW,CAAC;SAC3C,CACEiB,MAAM,CAACC,SACPC,IAAI,CAAC;;0BAER,MAACH;gBAAIR,WAAW,CAAC,EAAER,eAAe,OAAO,CAAC;;oBACvCK;kCACD,KAACe;wBACCC,cAAW;wBACXC,gBAAgBJ,QAAQX;wBACxBgB,UAAUT;wBACVZ,IAAIA;wBACJC,MAAMA;wBACNqB,SAASZ;wBACTa,KAAKhB;wBACLM,UAAUA;wBACVW,MAAK;;kCAEP,MAACC;wBACCnB,WAAW;4BAAC,CAAC,EAAER,eAAe,MAAM,CAAC;4BAAE,CAACO,WAAWM,iBAAiB,UAAU;yBAAU,CACrFI,MAAM,CAACC,SACPC,IAAI,CAAC;;4BAEPZ,yBAAW,KAACV;4BACZ,CAACU,WAAWM,gCAAkB,KAACf;;;oBAEjCM;;;0BAEH,KAACL;gBACCO,aAAaA;gBACbsB,SAAS1B;gBACTQ,OAAOA;gBACPK,UAAUA;gBACT,GAAIJ,cAAc,CAAC,CAAC;;;;AAI7B,EAAC"}
@@ -1,6 +1,6 @@
1
+ import type { CheckboxFieldProps } from 'payload';
1
2
  import React from 'react';
2
3
  import type { CheckboxInputProps } from './Input.js';
3
- import type { CheckboxFieldProps } from './types.js';
4
4
  import { CheckboxInput } from './Input.js';
5
5
  import './index.scss';
6
6
  export { CheckboxFieldProps, CheckboxInput, type CheckboxInputProps };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Checkbox/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAWpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,cAAc,CAAA;AAIrB,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,CAAA;AAwGrE,eAAO,MAAM,aAAa,8BAAgC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Checkbox/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAkB,MAAM,SAAS,CAAA;AAEjE,OAAO,KAAsB,MAAM,OAAO,CAAA;AAE1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAWpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,cAAc,CAAA;AAIrB,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,CAAA;AAwGrE,eAAO,MAAM,aAAa,8BAAwC,CAAA"}
@@ -14,7 +14,7 @@ import { CheckboxInput } from './Input.js';
14
14
  import './index.scss';
15
15
  const baseClass = 'checkbox';
16
16
  export { CheckboxInput };
17
- const _CheckboxField = (props)=>{
17
+ const CheckboxFieldComponent = (props)=>{
18
18
  const { 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 } = props;
19
19
  const { uuid } = useForm();
20
20
  const editDepth = useEditDepth();
@@ -90,6 +90,6 @@ const _CheckboxField = (props)=>{
90
90
  ]
91
91
  });
92
92
  };
93
- export const CheckboxField = withCondition(_CheckboxField);
93
+ export const CheckboxField = withCondition(CheckboxFieldComponent);
94
94
 
95
95
  //# sourceMappingURL=index.js.map
@@ -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 || {})} 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,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MA;gBAAO,GAAIN,cAAc,CAAC,CAAC;gBAAGgC,YAAW;;0BACrF,KAAChD;gBACCM,YAAYA;gBACZC,aAAaA;gBACbG,aAAaA;gBACbC,SAASA;gBACTP,IAAIwC;gBACJK,UAAU;gBACVhC,OAAOA;gBACPC,YAAYA;gBACZb,MAAMiB;gBACNoB,UAAUA;gBACVrB,gBAAgBA;gBAChBG,UAAUiB;gBACVf,UAAUA;;YAEXlB,sBAAsB0C,YACrB1C,kCAEA,KAACX;gBAAkB,GAAIiB,oBAAoB,CAAC,CAAC;;;;AAIrD;AAEA,OAAO,MAAMqC,gBAAgBzD,cAAcQ,gBAAe"}
1
+ {"version":3,"sources":["../../../src/fields/Checkbox/index.tsx"],"sourcesContent":["'use client'\nimport type { CheckboxFieldProps, ClientValidate } from 'payload'\n\nimport React, { useCallback } from 'react'\n\nimport type { CheckboxInputProps } from './Input.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 CheckboxFieldComponent: 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(CheckboxFieldComponent)\n"],"names":["React","useCallback","useFieldProps","useForm","useField","withCondition","useEditDepth","generateFieldID","FieldDescription","FieldError","fieldBaseClass","CheckboxInput","baseClass","CheckboxFieldComponent","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;AAI1C,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,yBAAuD,CAACC;IAC5D,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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AcQ,wBAAuB"}
@@ -1,13 +1,5 @@
1
- import type { CodeField as CodeFieldType } from 'payload';
1
+ import type { CodeFieldProps } from 'payload';
2
2
  import React from 'react';
3
- import type { FormFieldBase } from '../shared/index.js';
4
3
  import './index.scss';
5
- export type CodeFieldProps = {
6
- editorOptions?: CodeFieldType['admin']['editorOptions'];
7
- language?: CodeFieldType['admin']['language'];
8
- name?: string;
9
- path?: string;
10
- width: string;
11
- } & FormFieldBase;
12
4
  export declare const CodeField: React.FC<CodeFieldProps>;
13
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Code/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAE7C,OAAO,KAAsB,MAAM,OAAO,CAAA;AAU1C,OAAO,cAAc,CAAA;AAyFrB,eAAO,MAAM,SAAS,0BAAoC,CAAA"}
@@ -15,7 +15,7 @@ const prismToMonacoLanguageMap = {
15
15
  ts: 'typescript'
16
16
  };
17
17
  const baseClass = 'code-field';
18
- const _CodeField = (props)=>{
18
+ const CodeFieldComponent = (props)=>{
19
19
  const { name, AfterInput, BeforeInput, CustomDescription, CustomError, CustomLabel, className, descriptionProps, editorOptions = {}, errorProps, label, labelProps, language = 'javascript', path: pathFromProps, readOnly: readOnlyFromProps, required, style, validate, width } = props;
20
20
  const memoizedValidate = useCallback((value, options)=>{
21
21
  if (typeof validate === 'function') {
@@ -78,6 +78,6 @@ const _CodeField = (props)=>{
78
78
  ]
79
79
  });
80
80
  };
81
- export const CodeField = withCondition(_CodeField);
81
+ export const CodeField = withCondition(CodeFieldComponent);
82
82
 
83
83
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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,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MAAM,CAACC,SACPC,IAAI,CAAC;QACRhB,OAAO;YACL,GAAGA,KAAK;YACRE;QACF;;0BAEA,KAAC5B;gBACCa,aAAaA;gBACbK,OAAOA;gBACPO,UAAUA;gBACT,GAAIN,cAAc,CAAC,CAAC;;0BAEvB,MAACoB;gBAAIzB,WAAW,CAAC,EAAEb,eAAe,MAAM,CAAC;;kCACvC,KAACF;wBAAWa,aAAaA;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"}
1
+ {"version":3,"sources":["../../../src/fields/Code/index.tsx"],"sourcesContent":["'use client'\nimport type { CodeFieldProps } from 'payload'\n\nimport React, { useCallback } from 'react'\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\nconst prismToMonacoLanguageMap = {\n js: 'javascript',\n ts: 'typescript',\n}\n\nconst baseClass = 'code-field'\n\nconst CodeFieldComponent: 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(CodeFieldComponent)\n"],"names":["React","useCallback","CodeEditor","useFieldProps","useField","withCondition","FieldDescription","FieldError","FieldLabel","fieldBaseClass","prismToMonacoLanguageMap","js","ts","baseClass","CodeFieldComponent","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;AAE1C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C,YAAY;SACb,CACEE,MAAM,CAACC,SACPC,IAAI,CAAC;QACRhB,OAAO;YACL,GAAGA,KAAK;YACRE;QACF;;0BAEA,KAAC5B;gBACCa,aAAaA;gBACbK,OAAOA;gBACPO,UAAUA;gBACT,GAAIN,cAAc,CAAC,CAAC;;0BAEvB,MAACoB;gBAAIzB,WAAW,CAAC,EAAEb,eAAe,MAAM,CAAC;;kCACvC,KAACF;wBAAWa,aAAaA;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,oBAAmB"}
@@ -1,11 +1,5 @@
1
+ import type { CollapsibleFieldProps } from 'payload';
1
2
  import React from 'react';
2
3
  import './index.scss';
3
- import type { FieldMap } from '../../providers/ComponentMap/buildComponentMap/types.js';
4
- import type { FormFieldBase } from '../shared/index.js';
5
- export type CollapsibleFieldProps = {
6
- fieldMap: FieldMap;
7
- initCollapsed?: boolean;
8
- width?: string;
9
- } & FormFieldBase;
10
4
  export declare const CollapsibleField: React.FC<CollapsibleFieldProps>;
11
5
  //# 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;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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Collapsible/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAuB,MAAM,SAAS,CAAA;AAEzE,OAAO,KAAqD,MAAM,OAAO,CAAA;AAazE,OAAO,cAAc,CAAA;AA6IrB,eAAO,MAAM,gBAAgB,iCAA2C,CAAA"}
@@ -16,7 +16,7 @@ import './index.scss';
16
16
  const baseClass = 'collapsible-field';
17
17
  import { useFormInitializing, useFormProcessing } from '../../forms/Form/context.js';
18
18
  import { FieldDescription } from '../FieldDescription/index.js';
19
- const _CollapsibleField = (props)=>{
19
+ const CollapsibleFieldComponent = (props)=>{
20
20
  const { CustomDescription, CustomLabel, className, descriptionProps, fieldMap, initCollapsed = false, label, path: pathFromProps, readOnly: readOnlyFromProps } = props;
21
21
  const { indexPath, path: pathFromContext, readOnly: readOnlyFromContext, schemaPath, siblingPermissions } = useFieldProps();
22
22
  const formInitializing = useFormInitializing();
@@ -141,6 +141,6 @@ const _CollapsibleField = (props)=>{
141
141
  ]
142
142
  });
143
143
  };
144
- export const CollapsibleField = withCondition(_CollapsibleField);
144
+ export const CollapsibleField = withCondition(CollapsibleFieldComponent);
145
145
 
146
146
  //# sourceMappingURL=index.js.map
@@ -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 = {\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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EAAER,UAAU,aAAa,CAAC;wBACtCkD,kBAAkBhB,iBAAiB,UAAU;wBAC7CiB,sBACE,MAACL;4BAAItC,WAAW,CAAC,EAAER,UAAU,gBAAgB,CAAC;;8CAC5C,KAACP;oCAAS2D,mBAAmB7C;oCAAaiB,MAAMA;oCAAMX,MAAMA;oCAAMwC,UAAUzC;;gCAC3EsB,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 { CollapsibleFieldProps, DocumentPreferences } 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 { useFormInitializing, useFormProcessing } from '../../forms/Form/context.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\n\nconst CollapsibleFieldComponent: 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): Promise<void> => {\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(CollapsibleFieldComponent)\n"],"names":["React","Fragment","useCallback","useEffect","useState","Collapsible","CollapsibleElement","ErrorPill","useFieldProps","RenderFields","RowLabel","WatchChildErrors","withCondition","useDocumentInfo","usePreferences","useTranslation","fieldBaseClass","baseClass","useFormInitializing","useFormProcessing","FieldDescription","CollapsibleFieldComponent","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;AAElB,SAASC,mBAAmB,EAAEC,iBAAiB,QAAQ,8BAA6B;AACpF,SAASC,gBAAgB,QAAQ,+BAA8B;AAE/D,MAAMC,4BAA6D,CAACC;IAClE,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,O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,CAAC,CAAC;;;;;;AAI3F;AAEA,OAAO,MAAMkD,mBAAmBhE,cAAcS,2BAA0B"}
@@ -1,13 +1,5 @@
1
- import type { DateField } from 'payload';
1
+ import type { DateFieldProps } from 'payload';
2
2
  import React from 'react';
3
3
  import './index.scss';
4
- import type { FormFieldBase } from '../shared/index.js';
5
- export type DateFieldProps = {
6
- date?: DateField['admin']['date'];
7
- name?: string;
8
- path?: string;
9
- placeholder?: DateField['admin']['placeholder'] | string;
10
- width?: string;
11
- } & FormFieldBase;
12
4
  export declare const DateTimeField: React.FC<DateFieldProps>;
13
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/DateTime/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA6B,cAAc,EAAE,MAAM,SAAS,CAAA;AAGxE,OAAO,KAAsB,MAAM,OAAO,CAAA;AAO1C,OAAO,cAAc,CAAA;AAiGrB,eAAO,MAAM,aAAa,0BAAwC,CAAA"}
@@ -13,7 +13,7 @@ import { useFieldProps } from '../../forms/FieldPropsProvider/index.js';
13
13
  import { withCondition } from '../../forms/withCondition/index.js';
14
14
  import { FieldDescription } from '../FieldDescription/index.js';
15
15
  import { FieldError } from '../FieldError/index.js';
16
- const _DateTimeField = (props)=>{
16
+ const DateTimeFieldComponent = (props)=>{
17
17
  const { name, AfterInput, BeforeInput, CustomDescription, CustomError, CustomLabel, className, date: datePickerProps, descriptionProps, errorProps, label, labelProps, path: pathFromProps, placeholder, readOnly: readOnlyFromProps, required, style, validate, width } = props;
18
18
  const { i18n } = useTranslation();
19
19
  const memoizedValidate = useCallback((value, options)=>{
@@ -80,6 +80,6 @@ const _DateTimeField = (props)=>{
80
80
  ]
81
81
  });
82
82
  };
83
- export const DateTimeField = withCondition(_DateTimeField);
83
+ export const DateTimeField = withCondition(DateTimeFieldComponent);
84
84
 
85
85
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
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,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, DateFieldProps } 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 { 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\nconst DateTimeFieldComponent: 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(DateTimeFieldComponent)\n"],"names":["getTranslation","React","useCallback","DatePickerField","useField","useTranslation","FieldLabel","fieldBaseClass","baseClass","useFieldProps","withCondition","FieldDescription","FieldError","DateTimeFieldComponent","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;AAElB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,aAAa,QAAQ,qCAAoC;AAClE,SAASC,gBAAgB,QAAQ,+BAA8B;AAC/D,SAASC,UAAU,QAAQ,yBAAwB;AAEnD,MAAMC,yBAAmD,CAACC;IACxD,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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AOA;;oBAERvB;;;YAEFE,sBAAsBuC,YACrBvC,kCAEA,KAACP;gBAAkB,GAAIa,oBAAoB,CAAC,CAAC;;;;AAIrD;AAEA,OAAO,MAAMkC,gBAAgBhD,cAAcG,wBAAuB"}
@@ -1,13 +1,5 @@
1
- import type { EmailField as EmailFieldType } from 'payload';
1
+ import type { EmailFieldProps } from 'payload';
2
2
  import React from 'react';
3
- import type { FormFieldBase } from '../shared/index.js';
4
3
  import './index.scss';
5
- export type EmailFieldProps = {
6
- autoComplete?: string;
7
- name?: string;
8
- path?: string;
9
- placeholder?: EmailFieldType['admin']['placeholder'];
10
- width?: string;
11
- } & FormFieldBase;
12
4
  export declare const EmailField: React.FC<EmailFieldProps>;
13
5
  //# 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;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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Email/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9D,OAAO,KAAsB,MAAM,OAAO,CAAA;AAU1C,OAAO,cAAc,CAAA;AAqFrB,eAAO,MAAM,UAAU,2BAAqC,CAAA"}
@@ -11,7 +11,7 @@ import { FieldError } from '../FieldError/index.js';
11
11
  import { FieldLabel } from '../FieldLabel/index.js';
12
12
  import { fieldBaseClass } from '../shared/index.js';
13
13
  import './index.scss';
14
- const _EmailField = (props)=>{
14
+ const EmailFieldComponent = (props)=>{
15
15
  const { name, AfterInput, BeforeInput, CustomDescription, CustomError, CustomLabel, autoComplete, className, descriptionProps, errorProps, label, labelProps, path: pathFromProps, placeholder, readOnly: readOnlyFromProps, required, style, validate, width } = props;
16
16
  const { i18n } = useTranslation();
17
17
  const memoizedValidate = useCallback((value, options)=>{
@@ -78,6 +78,6 @@ const _EmailField = (props)=>{
78
78
  ]
79
79
  });
80
80
  };
81
- export const EmailField = withCondition(_EmailField);
81
+ export const EmailField = withCondition(EmailFieldComponent);
82
82
 
83
83
  //# sourceMappingURL=index.js.map
@@ -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 = {\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","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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, EmailFieldProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { useCallback } from 'react'\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\nconst EmailFieldComponent: 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(EmailFieldComponent)\n"],"names":["getTranslation","React","useCallback","useFieldProps","useField","withCondition","useTranslation","FieldDescription","FieldError","FieldLabel","fieldBaseClass","EmailFieldComponent","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;AAE1C,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;AAErB,MAAMC,sBAAiD,CAACC;IACtD,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,qBAAoB"}
@@ -1,5 +1,5 @@
1
- import type { FieldDescriptionProps } from 'payload';
1
+ import type { GenericDescriptionProps } from 'payload';
2
2
  import React from 'react';
3
3
  import './index.scss';
4
- export declare const FieldDescription: React.FC<FieldDescriptionProps>;
4
+ export declare const FieldDescription: React.FC<GenericDescriptionProps>;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/FieldDescription/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAGpD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,cAAc,CAAA;AA+BrB,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAQ5D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/FieldDescription/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAA;AAGtD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,cAAc,CAAA;AA+BrB,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAQ9D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/FieldDescription/index.tsx"],"sourcesContent":["'use client'\nimport type { FieldDescriptionProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport './index.scss'\n\nconst baseClass = 'field-description'\n\nconst DefaultFieldDescription: React.FC<FieldDescriptionProps> = (props) => {\n const { className, description, marginPlacement } = props\n\n const { path } = useFieldProps()\n\n const { i18n } = useTranslation()\n\n if (description) {\n return (\n <div\n className={[\n baseClass,\n className,\n `field-description-${path.replace(/\\./g, '__')}`,\n marginPlacement && `${baseClass}--margin-${marginPlacement}`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {getTranslation(description, i18n)}\n </div>\n )\n }\n\n return null\n}\n\nexport const FieldDescription: React.FC<FieldDescriptionProps> = (props) => {\n const { CustomDescription } = props\n\n if (CustomDescription !== undefined) {\n return CustomDescription\n }\n\n return <DefaultFieldDescription {...props} />\n}\n"],"names":["getTranslation","React","useFieldProps","useTranslation","baseClass","DefaultFieldDescription","props","className","description","marginPlacement","path","i18n","div","replace","filter","Boolean","join","FieldDescription","CustomDescription","undefined"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,WAAW,QAAO;AAEzB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,MAAMC,0BAA2D,CAACC;IAChE,MAAM,EAAEC,SAAS,EAAEC,WAAW,EAAEC,eAAe,EAAE,GAAGH;IAEpD,MAAM,EAAEI,IAAI,EAAE,GAAGR;IAEjB,MAAM,EAAES,IAAI,EAAE,GAAGR;IAEjB,IAAIK,aAAa;QACf,qBACE,KAACI;YACCL,WAAW;gBACTH;gBACAG;gBACA,CAAC,kBAAkB,EAAEG,KAAKG,OAAO,CAAC,OAAO,MAAM,CAAC;gBAChDJ,mBAAmB,CAAC,EAAEL,UAAU,SAAS,EAAEK,gBAAgB,CAAC;aAC7D,CACEK,MAAM,CAACC,SACPC,IAAI,CAAC;sBAEPhB,eAAeQ,aAAaG;;IAGnC;IAEA,OAAO;AACT;AAEA,OAAO,MAAMM,mBAAoD,CAACX;IAChE,MAAM,EAAEY,iBAAiB,EAAE,GAAGZ;IAE9B,IAAIY,sBAAsBC,WAAW;QACnC,OAAOD;IACT;IAEA,qBAAO,KAACb;QAAyB,GAAGC,KAAK;;AAC3C,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/FieldDescription/index.tsx"],"sourcesContent":["'use client'\nimport type { GenericDescriptionProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport './index.scss'\n\nconst baseClass = 'field-description'\n\nconst DefaultFieldDescription: React.FC<GenericDescriptionProps> = (props) => {\n const { className, description, marginPlacement } = props\n\n const { path } = useFieldProps()\n\n const { i18n } = useTranslation()\n\n if (description) {\n return (\n <div\n className={[\n baseClass,\n className,\n `field-description-${path.replace(/\\./g, '__')}`,\n marginPlacement && `${baseClass}--margin-${marginPlacement}`,\n ]\n .filter(Boolean)\n .join(' ')}\n >\n {getTranslation(description, i18n)}\n </div>\n )\n }\n\n return null\n}\n\nexport const FieldDescription: React.FC<GenericDescriptionProps> = (props) => {\n const { CustomDescription } = props\n\n if (CustomDescription !== undefined) {\n return CustomDescription\n }\n\n return <DefaultFieldDescription {...props} />\n}\n"],"names":["getTranslation","React","useFieldProps","useTranslation","baseClass","DefaultFieldDescription","props","className","description","marginPlacement","path","i18n","div","replace","filter","Boolean","join","FieldDescription","CustomDescription","undefined"],"mappings":"AAAA;;AAGA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,WAAW,QAAO;AAEzB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,MAAMC,0BAA6D,CAACC;IAClE,MAAM,EAAEC,SAAS,EAAEC,WAAW,EAAEC,eAAe,EAAE,GAAGH;IAEpD,MAAM,EAAEI,IAAI,EAAE,GAAGR;IAEjB,MAAM,EAAES,IAAI,EAAE,GAAGR;IAEjB,IAAIK,aAAa;QACf,qBACE,KAACI;YACCL,WAAW;gBACTH;gBACAG;gBACA,CAAC,kBAAkB,EAAEG,KAAKG,OAAO,CAAC,OAAO,MAAM,CAAC;gBAChDJ,mBAAmB,CAAC,EAAEL,UAAU,SAAS,EAAEK,gBAAgB,CAAC;aAC7D,CACEK,MAAM,CAACC,SACPC,IAAI,CAAC;sBAEPhB,eAAeQ,aAAaG;;IAGnC;IAEA,OAAO;AACT;AAEA,OAAO,MAAMM,mBAAsD,CAACX;IAClE,MAAM,EAAEY,iBAAiB,EAAE,GAAGZ;IAE9B,IAAIY,sBAAsBC,WAAW;QACnC,OAAOD;IACT;IAEA,qBAAO,KAACb;QAAyB,GAAGC,KAAK;;AAC3C,EAAC"}
@@ -1,5 +1,5 @@
1
- import type { ErrorProps } from 'payload';
1
+ import type { GenericErrorProps } from 'payload';
2
2
  import React from 'react';
3
3
  import './index.scss';
4
- export declare const FieldError: React.FC<ErrorProps>;
4
+ export declare const FieldError: React.FC<GenericErrorProps>;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/FieldError/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,cAAc,CAAA;AAkCrB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAQ3C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/FieldError/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAEhD,OAAO,KAAK,MAAM,OAAO,CAAA;AAKzB,OAAO,cAAc,CAAA;AAkCrB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAQlD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/FieldError/index.tsx"],"sourcesContent":["'use client'\n\nimport type { ErrorProps } from 'payload'\n\nimport React from 'react'\n\nimport { Tooltip } from '../../elements/Tooltip/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useFormFields, useFormSubmitted } from '../../forms/Form/context.js'\nimport './index.scss'\n\nconst baseClass = 'field-error'\n\nconst DefaultFieldError: React.FC<ErrorProps> = (props) => {\n const {\n alignCaret = 'right',\n message: messageFromProps,\n path: pathFromProps,\n showError: showErrorFromProps,\n } = props\n\n const { path: pathFromContext } = useFieldProps()\n const path = pathFromContext ?? pathFromProps\n\n const hasSubmitted = useFormSubmitted()\n const field = useFormFields(([fields]) => (fields && fields?.[path]) || null)\n\n const { errorMessage, valid } = field || {}\n\n const message = messageFromProps || errorMessage\n const showMessage = showErrorFromProps || (hasSubmitted && valid === false)\n\n if (showMessage && message?.length) {\n return (\n <Tooltip alignCaret={alignCaret} className={baseClass} delay={0} staticPositioning>\n {message}\n </Tooltip>\n )\n }\n\n return null\n}\n\nexport const FieldError: React.FC<ErrorProps> = (props) => {\n const { CustomError } = props\n\n if (CustomError !== undefined) {\n return CustomError\n }\n\n return <DefaultFieldError {...props} />\n}\n"],"names":["React","Tooltip","useFieldProps","useFormFields","useFormSubmitted","baseClass","DefaultFieldError","props","alignCaret","message","messageFromProps","path","pathFromProps","showError","showErrorFromProps","pathFromContext","hasSubmitted","field","fields","errorMessage","valid","showMessage","length","className","delay","staticPositioning","FieldError","CustomError","undefined"],"mappings":"AAAA;;AAIA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,kCAAiC;AACzD,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,8BAA6B;AAC7E,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,MAAMC,oBAA0C,CAACC;IAC/C,MAAM,EACJC,aAAa,OAAO,EACpBC,SAASC,gBAAgB,EACzBC,MAAMC,aAAa,EACnBC,WAAWC,kBAAkB,EAC9B,GAAGP;IAEJ,MAAM,EAAEI,MAAMI,eAAe,EAAE,GAAGb;IAClC,MAAMS,OAAOI,mBAAmBH;IAEhC,MAAMI,eAAeZ;IACrB,MAAMa,QAAQd,cAAc,CAAC,CAACe,OAAO,GAAK,AAACA,UAAUA,QAAQ,CAACP,KAAK,IAAK;IAExE,MAAM,EAAEQ,YAAY,EAAEC,KAAK,EAAE,GAAGH,SAAS,CAAC;IAE1C,MAAMR,UAAUC,oBAAoBS;IACpC,MAAME,cAAcP,sBAAuBE,gBAAgBI,UAAU;IAErE,IAAIC,eAAeZ,SAASa,QAAQ;QAClC,qBACE,KAACrB;YAAQO,YAAYA;YAAYe,WAAWlB;YAAWmB,OAAO;YAAGC,iBAAiB;sBAC/EhB;;IAGP;IAEA,OAAO;AACT;AAEA,OAAO,MAAMiB,aAAmC,CAACnB;IAC/C,MAAM,EAAEoB,WAAW,EAAE,GAAGpB;IAExB,IAAIoB,gBAAgBC,WAAW;QAC7B,OAAOD;IACT;IAEA,qBAAO,KAACrB;QAAmB,GAAGC,KAAK;;AACrC,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/FieldError/index.tsx"],"sourcesContent":["'use client'\n\nimport type { GenericErrorProps } from 'payload'\n\nimport React from 'react'\n\nimport { Tooltip } from '../../elements/Tooltip/index.js'\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useFormFields, useFormSubmitted } from '../../forms/Form/context.js'\nimport './index.scss'\n\nconst baseClass = 'field-error'\n\nconst DefaultFieldError: React.FC<GenericErrorProps> = (props) => {\n const {\n alignCaret = 'right',\n message: messageFromProps,\n path: pathFromProps,\n showError: showErrorFromProps,\n } = props\n\n const { path: pathFromContext } = useFieldProps()\n const path = pathFromContext ?? pathFromProps\n\n const hasSubmitted = useFormSubmitted()\n const field = useFormFields(([fields]) => (fields && fields?.[path]) || null)\n\n const { errorMessage, valid } = field || {}\n\n const message = messageFromProps || errorMessage\n const showMessage = showErrorFromProps || (hasSubmitted && valid === false)\n\n if (showMessage && message?.length) {\n return (\n <Tooltip alignCaret={alignCaret} className={baseClass} delay={0} staticPositioning>\n {message}\n </Tooltip>\n )\n }\n\n return null\n}\n\nexport const FieldError: React.FC<GenericErrorProps> = (props) => {\n const { CustomError } = props\n\n if (CustomError !== undefined) {\n return CustomError\n }\n\n return <DefaultFieldError {...props} />\n}\n"],"names":["React","Tooltip","useFieldProps","useFormFields","useFormSubmitted","baseClass","DefaultFieldError","props","alignCaret","message","messageFromProps","path","pathFromProps","showError","showErrorFromProps","pathFromContext","hasSubmitted","field","fields","errorMessage","valid","showMessage","length","className","delay","staticPositioning","FieldError","CustomError","undefined"],"mappings":"AAAA;;AAIA,OAAOA,WAAW,QAAO;AAEzB,SAASC,OAAO,QAAQ,kCAAiC;AACzD,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,aAAa,EAAEC,gBAAgB,QAAQ,8BAA6B;AAC7E,OAAO,eAAc;AAErB,MAAMC,YAAY;AAElB,MAAMC,oBAAiD,CAACC;IACtD,MAAM,EACJC,aAAa,OAAO,EACpBC,SAASC,gBAAgB,EACzBC,MAAMC,aAAa,EACnBC,WAAWC,kBAAkB,EAC9B,GAAGP;IAEJ,MAAM,EAAEI,MAAMI,eAAe,EAAE,GAAGb;IAClC,MAAMS,OAAOI,mBAAmBH;IAEhC,MAAMI,eAAeZ;IACrB,MAAMa,QAAQd,cAAc,CAAC,CAACe,OAAO,GAAK,AAACA,UAAUA,QAAQ,CAACP,KAAK,IAAK;IAExE,MAAM,EAAEQ,YAAY,EAAEC,KAAK,EAAE,GAAGH,SAAS,CAAC;IAE1C,MAAMR,UAAUC,oBAAoBS;IACpC,MAAME,cAAcP,sBAAuBE,gBAAgBI,UAAU;IAErE,IAAIC,eAAeZ,SAASa,QAAQ;QAClC,qBACE,KAACrB;YAAQO,YAAYA;YAAYe,WAAWlB;YAAWmB,OAAO;YAAGC,iBAAiB;sBAC/EhB;;IAGP;IAEA,OAAO;AACT;AAEA,OAAO,MAAMiB,aAA0C,CAACnB;IACtD,MAAM,EAAEoB,WAAW,EAAE,GAAGpB;IAExB,IAAIoB,gBAAgBC,WAAW;QAC7B,OAAOD;IACT;IAEA,qBAAO,KAACrB;QAAmB,GAAGC,KAAK;;AACrC,EAAC"}
@@ -1,5 +1,5 @@
1
- import type { LabelProps } from 'payload';
1
+ import type { GenericLabelProps } from 'payload';
2
2
  import React from 'react';
3
3
  import './index.scss';
4
- export declare const FieldLabel: React.FC<LabelProps>;
4
+ export declare const FieldLabel: React.FC<GenericLabelProps>;
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/FieldLabel/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGzC,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,cAAc,CAAA;AA8BrB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,UAAU,CAQ3C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/FieldLabel/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAGhD,OAAO,KAAK,MAAM,OAAO,CAAA;AAOzB,OAAO,cAAc,CAAA;AA8BrB,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAQlD,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/fields/FieldLabel/index.tsx"],"sourcesContent":["'use client'\n\nimport type { LabelProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm } from '../../forms/Form/context.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport './index.scss'\n\nconst DefaultFieldLabel: React.FC<LabelProps> = (props) => {\n const {\n as: Element = 'label',\n htmlFor: htmlForFromProps,\n label: labelFromProps,\n required = false,\n unstyled = false,\n } = props\n\n const { uuid } = useForm()\n const { path } = useFieldProps()\n const editDepth = useEditDepth()\n const htmlFor = htmlForFromProps || generateFieldID(path, editDepth, uuid)\n\n const { i18n } = useTranslation()\n\n if (labelFromProps) {\n return (\n <Element className={`field-label ${unstyled ? 'unstyled' : ''}`} htmlFor={htmlFor}>\n {getTranslation(labelFromProps, i18n)}\n {required && !unstyled && <span className=\"required\">*</span>}\n </Element>\n )\n }\n\n return null\n}\n\nexport const FieldLabel: React.FC<LabelProps> = (props) => {\n const { CustomLabel } = props\n\n if (CustomLabel !== undefined) {\n return CustomLabel\n }\n\n return <DefaultFieldLabel {...props} />\n}\n"],"names":["getTranslation","React","useFieldProps","useForm","useEditDepth","useTranslation","generateFieldID","DefaultFieldLabel","props","as","Element","htmlFor","htmlForFromProps","label","labelFromProps","required","unstyled","uuid","path","editDepth","i18n","className","span","FieldLabel","CustomLabel","undefined"],"mappings":"AAAA;;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,WAAW,QAAO;AAEzB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,OAAO,QAAQ,8BAA6B;AACrD,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,OAAO,eAAc;AAErB,MAAMC,oBAA0C,CAACC;IAC/C,MAAM,EACJC,IAAIC,UAAU,OAAO,EACrBC,SAASC,gBAAgB,EACzBC,OAAOC,cAAc,EACrBC,WAAW,KAAK,EAChBC,WAAW,KAAK,EACjB,GAAGR;IAEJ,MAAM,EAAES,IAAI,EAAE,GAAGd;IACjB,MAAM,EAAEe,IAAI,EAAE,GAAGhB;IACjB,MAAMiB,YAAYf;IAClB,MAAMO,UAAUC,oBAAoBN,gBAAgBY,MAAMC,WAAWF;IAErE,MAAM,EAAEG,IAAI,EAAE,GAAGf;IAEjB,IAAIS,gBAAgB;QAClB,qBACE,MAACJ;YAAQW,WAAW,CAAC,YAAY,EAAEL,WAAW,aAAa,GAAG,CAAC;YAAEL,SAASA;;gBACvEX,eAAec,gBAAgBM;gBAC/BL,YAAY,CAACC,0BAAY,KAACM;oBAAKD,WAAU;8BAAW;;;;IAG3D;IAEA,OAAO;AACT;AAEA,OAAO,MAAME,aAAmC,CAACf;IAC/C,MAAM,EAAEgB,WAAW,EAAE,GAAGhB;IAExB,IAAIgB,gBAAgBC,WAAW;QAC7B,OAAOD;IACT;IAEA,qBAAO,KAACjB;QAAmB,GAAGC,KAAK;;AACrC,EAAC"}
1
+ {"version":3,"sources":["../../../src/fields/FieldLabel/index.tsx"],"sourcesContent":["'use client'\n\nimport type { GenericLabelProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { useFieldProps } from '../../forms/FieldPropsProvider/index.js'\nimport { useForm } from '../../forms/Form/context.js'\nimport { useEditDepth } from '../../providers/EditDepth/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { generateFieldID } from '../../utilities/generateFieldID.js'\nimport './index.scss'\n\nconst DefaultFieldLabel: React.FC<GenericLabelProps> = (props) => {\n const {\n as: Element = 'label',\n htmlFor: htmlForFromProps,\n label: labelFromProps,\n required = false,\n unstyled = false,\n } = props\n\n const { uuid } = useForm()\n const { path } = useFieldProps()\n const editDepth = useEditDepth()\n const htmlFor = htmlForFromProps || generateFieldID(path, editDepth, uuid)\n\n const { i18n } = useTranslation()\n\n if (labelFromProps) {\n return (\n <Element className={`field-label ${unstyled ? 'unstyled' : ''}`} htmlFor={htmlFor}>\n {getTranslation(labelFromProps, i18n)}\n {required && !unstyled && <span className=\"required\">*</span>}\n </Element>\n )\n }\n\n return null\n}\n\nexport const FieldLabel: React.FC<GenericLabelProps> = (props) => {\n const { CustomLabel } = props\n\n if (CustomLabel !== undefined) {\n return CustomLabel\n }\n\n return <DefaultFieldLabel {...props} />\n}\n"],"names":["getTranslation","React","useFieldProps","useForm","useEditDepth","useTranslation","generateFieldID","DefaultFieldLabel","props","as","Element","htmlFor","htmlForFromProps","label","labelFromProps","required","unstyled","uuid","path","editDepth","i18n","className","span","FieldLabel","CustomLabel","undefined"],"mappings":"AAAA;;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,OAAOC,WAAW,QAAO;AAEzB,SAASC,aAAa,QAAQ,0CAAyC;AACvE,SAASC,OAAO,QAAQ,8BAA6B;AACrD,SAASC,YAAY,QAAQ,qCAAoC;AACjE,SAASC,cAAc,QAAQ,uCAAsC;AACrE,SAASC,eAAe,QAAQ,qCAAoC;AACpE,OAAO,eAAc;AAErB,MAAMC,oBAAiD,CAACC;IACtD,MAAM,EACJC,IAAIC,UAAU,OAAO,EACrBC,SAASC,gBAAgB,EACzBC,OAAOC,cAAc,EACrBC,WAAW,KAAK,EAChBC,WAAW,KAAK,EACjB,GAAGR;IAEJ,MAAM,EAAES,IAAI,EAAE,GAAGd;IACjB,MAAM,EAAEe,IAAI,EAAE,GAAGhB;IACjB,MAAMiB,YAAYf;IAClB,MAAMO,UAAUC,oBAAoBN,gBAAgBY,MAAMC,WAAWF;IAErE,MAAM,EAAEG,IAAI,EAAE,GAAGf;IAEjB,IAAIS,gBAAgB;QAClB,qBACE,MAACJ;YAAQW,WAAW,CAAC,YAAY,EAAEL,WAAW,aAAa,GAAG,CAAC;YAAEL,SAASA;;gBACvEX,eAAec,gBAAgBM;gBAC/BL,YAAY,CAACC,0BAAY,KAACM;oBAAKD,WAAU;8BAAW;;;;IAG3D;IAEA,OAAO;AACT;AAEA,OAAO,MAAME,aAA0C,CAACf;IACtD,MAAM,EAAEgB,WAAW,EAAE,GAAGhB;IAExB,IAAIgB,gBAAgBC,WAAW;QAC7B,OAAOD;IACT;IAEA,qBAAO,KAACjB;QAAmB,GAAGC,KAAK;;AACrC,EAAC"}
@@ -1,16 +1,8 @@
1
+ import type { GroupFieldProps } from 'payload';
1
2
  import React from 'react';
2
- import type { FieldMap } from '../../providers/ComponentMap/buildComponentMap/types.js';
3
- import type { FormFieldBase } from '../shared/index.js';
4
3
  import './index.scss';
5
4
  import { GroupProvider, useGroup } from './provider.js';
6
- export type GroupFieldProps = {
7
- fieldMap: FieldMap;
8
- forceRender?: boolean;
9
- hideGutter?: boolean;
10
- name?: string;
11
- width?: string;
12
- } & FormFieldBase;
13
- export declare const _GroupField: React.FC<GroupFieldProps>;
5
+ export declare const GroupFieldComponent: React.FC<GroupFieldProps>;
14
6
  export { GroupProvider, useGroup };
15
7
  export declare const GroupField: React.FC<GroupFieldProps>;
16
8
  //# sourceMappingURL=index.d.ts.map
@@ -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;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
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Group/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAG9C,OAAO,KAAmB,MAAM,OAAO,CAAA;AAkBvC,OAAO,cAAc,CAAA;AACrB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAIvD,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAqFzD,CAAA;AAED,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAA;AAElC,eAAO,MAAM,UAAU,2BAAqC,CAAA"}
@@ -17,7 +17,7 @@ import { fieldBaseClass } from '../shared/index.js';
17
17
  import './index.scss';
18
18
  import { GroupProvider, useGroup } from './provider.js';
19
19
  const baseClass = 'group-field';
20
- export const _GroupField = (props)=>{
20
+ export const GroupFieldComponent = (props)=>{
21
21
  const { CustomDescription, CustomLabel, className, descriptionProps, fieldMap, hideGutter, label, readOnly: readOnlyFromProps, style, width } = props;
22
22
  const { path, permissions, readOnly: readOnlyFromContext, schemaPath } = useFieldProps();
23
23
  const { i18n } = useTranslation();
@@ -94,6 +94,6 @@ export const _GroupField = (props)=>{
94
94
  });
95
95
  };
96
96
  export { GroupProvider, useGroup };
97
- export const GroupField = withCondition(_GroupField);
97
+ export const GroupField = withCondition(GroupFieldComponent);
98
98
 
99
99
  //# sourceMappingURL=index.js.map