@payloadcms/ui 3.29.0-canary.5 → 3.29.0-canary.7

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 (144) hide show
  1. package/dist/elements/Autosave/index.js +1 -1
  2. package/dist/elements/Autosave/index.js.map +1 -1
  3. package/dist/elements/BulkUpload/EditMany/DrawerContent.d.ts.map +1 -1
  4. package/dist/elements/BulkUpload/EditMany/DrawerContent.js +143 -127
  5. package/dist/elements/BulkUpload/EditMany/DrawerContent.js.map +1 -1
  6. package/dist/elements/BulkUpload/EditMany/index.d.ts.map +1 -1
  7. package/dist/elements/BulkUpload/EditMany/index.js +1 -1
  8. package/dist/elements/BulkUpload/EditMany/index.js.map +1 -1
  9. package/dist/elements/BulkUpload/FileSidebar/index.d.ts.map +1 -1
  10. package/dist/elements/BulkUpload/FileSidebar/index.js +5 -5
  11. package/dist/elements/BulkUpload/FileSidebar/index.js.map +1 -1
  12. package/dist/elements/BulkUpload/FormsManager/index.js +1 -1
  13. package/dist/elements/BulkUpload/FormsManager/index.js.map +1 -1
  14. package/dist/elements/DocumentControls/index.js +1 -1
  15. package/dist/elements/DocumentControls/index.js.map +1 -1
  16. package/dist/elements/DocumentFields/index.d.ts.map +1 -1
  17. package/dist/elements/DocumentFields/index.js +1 -5
  18. package/dist/elements/DocumentFields/index.js.map +1 -1
  19. package/dist/elements/EditMany/DrawerContent.d.ts +2 -1
  20. package/dist/elements/EditMany/DrawerContent.d.ts.map +1 -1
  21. package/dist/elements/EditMany/DrawerContent.js +107 -118
  22. package/dist/elements/EditMany/DrawerContent.js.map +1 -1
  23. package/dist/elements/EditMany/index.d.ts.map +1 -1
  24. package/dist/elements/EditMany/index.js +6 -5
  25. package/dist/elements/EditMany/index.js.map +1 -1
  26. package/dist/elements/FieldSelect/index.d.ts +12 -2
  27. package/dist/elements/FieldSelect/index.d.ts.map +1 -1
  28. package/dist/elements/FieldSelect/index.js +31 -48
  29. package/dist/elements/FieldSelect/index.js.map +1 -1
  30. package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingColumns.d.ts +2 -1
  31. package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingColumns.d.ts.map +1 -1
  32. package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingColumns.js +5 -2
  33. package/dist/elements/PublishButton/ScheduleDrawer/buildUpcomingColumns.js.map +1 -1
  34. package/dist/elements/PublishButton/ScheduleDrawer/index.d.ts.map +1 -1
  35. package/dist/elements/PublishButton/ScheduleDrawer/index.js +3 -3
  36. package/dist/elements/PublishButton/ScheduleDrawer/index.js.map +1 -1
  37. package/dist/elements/Table/DefaultCell/fields/Date/index.js +1 -1
  38. package/dist/elements/Table/DefaultCell/fields/Date/index.js.map +1 -1
  39. package/dist/elements/Table/DefaultCell/fields/File/index.d.ts.map +1 -1
  40. package/dist/elements/Table/DefaultCell/fields/File/index.js +24 -1
  41. package/dist/elements/Table/DefaultCell/fields/File/index.js.map +1 -1
  42. package/dist/elements/Table/DefaultCell/fields/Relationship/index.js +1 -1
  43. package/dist/elements/Table/DefaultCell/fields/Relationship/index.js.map +1 -1
  44. package/dist/elements/Thumbnail/index.js +25 -23
  45. package/dist/elements/Thumbnail/index.js.map +1 -1
  46. package/dist/elements/ThumbnailCard/index.js +1 -1
  47. package/dist/elements/ThumbnailCard/index.js.map +1 -1
  48. package/dist/exports/client/index.js +23 -23
  49. package/dist/exports/client/index.js.map +4 -4
  50. package/dist/exports/shared/index.d.ts +2 -2
  51. package/dist/exports/shared/index.d.ts.map +1 -1
  52. package/dist/exports/shared/index.js +2 -2
  53. package/dist/exports/shared/index.js.map +4 -4
  54. package/dist/fields/Array/index.d.ts.map +1 -1
  55. package/dist/fields/Array/index.js +4 -3
  56. package/dist/fields/Array/index.js.map +1 -1
  57. package/dist/fields/Blocks/index.d.ts.map +1 -1
  58. package/dist/fields/Blocks/index.js +5 -4
  59. package/dist/fields/Blocks/index.js.map +1 -1
  60. package/dist/fields/Checkbox/index.d.ts +1 -1
  61. package/dist/fields/Checkbox/index.d.ts.map +1 -1
  62. package/dist/fields/Checkbox/index.js +4 -3
  63. package/dist/fields/Checkbox/index.js.map +1 -1
  64. package/dist/fields/Code/index.d.ts.map +1 -1
  65. package/dist/fields/Code/index.js +4 -3
  66. package/dist/fields/Code/index.js.map +1 -1
  67. package/dist/fields/Collapsible/index.d.ts.map +1 -1
  68. package/dist/fields/Collapsible/index.js +3 -2
  69. package/dist/fields/Collapsible/index.js.map +1 -1
  70. package/dist/fields/ConfirmPassword/index.js +13 -11
  71. package/dist/fields/ConfirmPassword/index.js.map +1 -1
  72. package/dist/fields/DateTime/index.d.ts.map +1 -1
  73. package/dist/fields/DateTime/index.js +5 -4
  74. package/dist/fields/DateTime/index.js.map +1 -1
  75. package/dist/fields/Email/index.d.ts.map +1 -1
  76. package/dist/fields/Email/index.js +3 -2
  77. package/dist/fields/Email/index.js.map +1 -1
  78. package/dist/fields/Group/index.d.ts.map +1 -1
  79. package/dist/fields/Group/index.js.map +1 -1
  80. package/dist/fields/Group/index.scss +12 -6
  81. package/dist/fields/JSON/index.d.ts.map +1 -1
  82. package/dist/fields/JSON/index.js +5 -4
  83. package/dist/fields/JSON/index.js.map +1 -1
  84. package/dist/fields/Number/index.d.ts.map +1 -1
  85. package/dist/fields/Number/index.js +6 -5
  86. package/dist/fields/Number/index.js.map +1 -1
  87. package/dist/fields/Password/index.d.ts.map +1 -1
  88. package/dist/fields/Password/index.js +2 -4
  89. package/dist/fields/Password/index.js.map +1 -1
  90. package/dist/fields/Point/index.d.ts.map +1 -1
  91. package/dist/fields/Point/index.js +4 -3
  92. package/dist/fields/Point/index.js.map +1 -1
  93. package/dist/fields/RadioGroup/index.d.ts.map +1 -1
  94. package/dist/fields/RadioGroup/index.js +4 -3
  95. package/dist/fields/RadioGroup/index.js.map +1 -1
  96. package/dist/fields/Relationship/index.d.ts.map +1 -1
  97. package/dist/fields/Relationship/index.js +5 -4
  98. package/dist/fields/Relationship/index.js.map +1 -1
  99. package/dist/fields/Relationship/optionsReducer.js +1 -1
  100. package/dist/fields/Relationship/optionsReducer.js.map +1 -1
  101. package/dist/fields/Select/index.d.ts.map +1 -1
  102. package/dist/fields/Select/index.js +4 -3
  103. package/dist/fields/Select/index.js.map +1 -1
  104. package/dist/fields/Tabs/index.js.map +1 -1
  105. package/dist/fields/Text/index.d.ts.map +1 -1
  106. package/dist/fields/Text/index.js +4 -3
  107. package/dist/fields/Text/index.js.map +1 -1
  108. package/dist/fields/Textarea/index.d.ts.map +1 -1
  109. package/dist/fields/Textarea/index.js +2 -1
  110. package/dist/fields/Textarea/index.js.map +1 -1
  111. package/dist/fields/Upload/index.d.ts.map +1 -1
  112. package/dist/fields/Upload/index.js +2 -1
  113. package/dist/fields/Upload/index.js.map +1 -1
  114. package/dist/forms/Form/fieldReducer.js +1 -1
  115. package/dist/forms/Form/fieldReducer.js.map +1 -1
  116. package/dist/forms/useField/index.d.ts.map +1 -1
  117. package/dist/forms/useField/index.js +70 -67
  118. package/dist/forms/useField/index.js.map +1 -1
  119. package/dist/forms/useField/types.d.ts +1 -0
  120. package/dist/forms/useField/types.d.ts.map +1 -1
  121. package/dist/forms/useField/types.js.map +1 -1
  122. package/dist/providers/DocumentInfo/index.d.ts.map +1 -1
  123. package/dist/providers/DocumentInfo/index.js +1 -1
  124. package/dist/providers/DocumentInfo/index.js.map +1 -1
  125. package/dist/styles.css +1 -1
  126. package/dist/utilities/{formatDate.d.ts → formatDocTitle/formatDateTitle.d.ts} +1 -1
  127. package/dist/utilities/formatDocTitle/formatDateTitle.d.ts.map +1 -0
  128. package/dist/utilities/{formatDate.js → formatDocTitle/formatDateTitle.js} +1 -1
  129. package/dist/utilities/formatDocTitle/formatDateTitle.js.map +1 -0
  130. package/dist/utilities/formatDocTitle/formatLexicalDocTitle.d.ts +19 -0
  131. package/dist/utilities/formatDocTitle/formatLexicalDocTitle.d.ts.map +1 -0
  132. package/dist/utilities/formatDocTitle/formatLexicalDocTitle.js +19 -0
  133. package/dist/utilities/formatDocTitle/formatLexicalDocTitle.js.map +1 -0
  134. package/dist/utilities/{formatDocTitle.d.ts → formatDocTitle/index.d.ts} +2 -2
  135. package/dist/utilities/formatDocTitle/index.d.ts.map +1 -0
  136. package/dist/utilities/{formatDocTitle.js → formatDocTitle/index.js} +11 -3
  137. package/dist/utilities/formatDocTitle/index.js.map +1 -0
  138. package/dist/views/Edit/SetDocumentTitle/index.js +1 -1
  139. package/dist/views/Edit/SetDocumentTitle/index.js.map +1 -1
  140. package/package.json +5 -5
  141. package/dist/utilities/formatDate.d.ts.map +0 -1
  142. package/dist/utilities/formatDate.js.map +0 -1
  143. package/dist/utilities/formatDocTitle.d.ts.map +0 -1
  144. package/dist/utilities/formatDocTitle.js.map +0 -1
@@ -147,6 +147,7 @@ const BlocksFieldComponent = props => {
147
147
  }
148
148
  const {
149
149
  customComponents: t8,
150
+ disabled,
150
151
  errorPaths,
151
152
  rows: t9,
152
153
  showError,
@@ -428,7 +429,7 @@ const BlocksFieldComponent = props => {
428
429
  const rowPath = `${path}.${i}`;
429
430
  const rowErrorCount = errorPaths.filter(errorPath => errorPath.startsWith(rowPath + ".")).length;
430
431
  return _jsx(DraggableSortableItem, {
431
- disabled: readOnly || !isSortable,
432
+ disabled: readOnly || disabled || !isSortable,
432
433
  id: row_0.id,
433
434
  children: draggableSortableItemProps => _jsx(BlockRow, {
434
435
  ...draggableSortableItemProps,
@@ -447,7 +448,7 @@ const BlocksFieldComponent = props => {
447
448
  parentPath: path,
448
449
  path: rowPath,
449
450
  permissions,
450
- readOnly,
451
+ readOnly: readOnly || disabled,
451
452
  removeRow,
452
453
  row: row_0,
453
454
  rowCount: rows.length,
@@ -474,11 +475,11 @@ const BlocksFieldComponent = props => {
474
475
  }), !hasMaxRows && _jsxs(Fragment, {
475
476
  children: [_jsx(DrawerToggler, {
476
477
  className: `${baseClass}__drawer-toggler`,
477
- disabled: readOnly,
478
+ disabled: readOnly || disabled,
478
479
  slug: drawerSlug,
479
480
  children: _jsx(Button, {
480
481
  buttonStyle: "icon-label",
481
- disabled: readOnly,
482
+ disabled: readOnly || disabled,
482
483
  el: "span",
483
484
  icon: "plus",
484
485
  iconPosition: "left",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","getTranslation","React","Fragment","useCallback","Banner","Button","DraggableSortableItem","DraggableSortable","DrawerToggler","useDrawerSlug","ErrorPill","RenderCustomComponent","useForm","useFormSubmitted","extractRowsAndCollapsedIDs","toggleAllRows","NullifyLocaleField","useField","withCondition","useConfig","useDocumentInfo","useLocale","useTranslation","scrollToID","FieldDescription","FieldError","FieldLabel","fieldBaseClass","BlockRow","BlocksDrawer","baseClass","BlocksFieldComponent","props","$","i18n","t","field","t0","path","permissions","readOnly","schemaPath","schemaPathFromProps","validate","name","admin","t1","blockReferences","blocks","label","labels","labelsFromProps","localized","maxRows","minRows","minRowsProp","required","t2","undefined","className","description","isSortable","t3","setDocFieldPreferences","addFieldRow","dispatchFields","setModified","code","locale","config","t4","localization","drawerSlug","submitted","plural","singular","t5","bb0","fallback","defaultLocale","editingDefaultLocale","t6","value","options","memoizedValidate","t7","hasRows","customComponents","t8","errorPaths","rows","t9","showError","valid","value_0","t10","AfterInput","BeforeInput","Description","Error","Label","RowLabels","t11","t12","rowIndex","blockType","setTimeout","addRow","t13","rowIndex_0","type","duplicateRow","t14","rowIndex_1","removeRow","t15","moveFromIndex","moveToIndex","moveRow","t16","collapsed","collapsedIDs","updatedRows","toggleCollapseAll","t17","rowID","collapsed_0","collapsedIDs_0","updatedRows_0","setCollapse","hasMaxRows","length","fieldErrorCount","fieldHasErrors","showMinRows","showRequired","t18","t19","filter","Boolean","t20","_jsx","CustomComponent","Fallback","t21","count","withMessage","_jsxs","join","id","replace","children","onClick","fieldValue","ids","map","_temp","onDragEnd","t22","moveFromIndex_0","moveToIndex_0","row_0","i","blockType_0","isLoading","row","blockConfig","blocksMap","find","block","slug","rowPath","rowErrorCount","errorPath","startsWith","disabled","draggableSortableItemProps","errorCount","fields","parentPath","rowCount","buttonStyle","el","icon","iconPosition","iconStyle","addRowIndex","BlocksField"],"sources":["../../../src/fields/Blocks/index.tsx"],"sourcesContent":["'use client'\nimport type { BlocksFieldClientComponent, ClientBlock } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback } from 'react'\n\nimport { Banner } from '../../elements/Banner/index.js'\nimport { Button } from '../../elements/Button/index.js'\nimport { DraggableSortableItem } from '../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../elements/DraggableSortable/index.js'\nimport { DrawerToggler } from '../../elements/Drawer/index.js'\nimport { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { useForm, useFormSubmitted } from '../../forms/Form/context.js'\nimport { extractRowsAndCollapsedIDs, toggleAllRows } from '../../forms/Form/rowHelpers.js'\nimport { NullifyLocaleField } from '../../forms/NullifyField/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { scrollToID } from '../../utilities/scrollToID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { BlockRow } from './BlockRow.js'\nimport { BlocksDrawer } from './BlocksDrawer/index.js'\nimport './index.scss'\n\nconst baseClass = 'blocks-field'\n\nconst BlocksFieldComponent: BlocksFieldClientComponent = (props) => {\n const { i18n, t } = useTranslation()\n\n const {\n field: {\n name,\n admin: { className, description, isSortable = true } = {},\n blockReferences,\n blocks,\n label,\n labels: labelsFromProps,\n localized,\n maxRows,\n minRows: minRowsProp,\n required,\n },\n path,\n permissions,\n readOnly,\n schemaPath: schemaPathFromProps,\n validate,\n } = props\n const schemaPath = schemaPathFromProps ?? name\n\n const minRows = (minRowsProp ?? required) ? 1 : 0\n\n const { setDocFieldPreferences } = useDocumentInfo()\n const { addFieldRow, dispatchFields, setModified } = useForm()\n const { code: locale } = useLocale()\n const {\n config: { localization },\n config,\n } = useConfig()\n const drawerSlug = useDrawerSlug('blocks-drawer')\n const submitted = useFormSubmitted()\n\n const labels = {\n plural: t('fields:blocks'),\n singular: t('fields:block'),\n ...labelsFromProps,\n }\n\n const editingDefaultLocale = (() => {\n if (localization && localization.fallback) {\n const defaultLocale = localization.defaultLocale\n return locale === defaultLocale\n }\n\n return true\n })()\n\n const memoizedValidate = useCallback(\n (value, options) => {\n // alternative locales can be null\n if (!editingDefaultLocale && value === null) {\n return true\n }\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxRows, minRows, required })\n }\n },\n [maxRows, minRows, required, validate, editingDefaultLocale],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label, RowLabels } = {},\n errorPaths,\n rows = [],\n showError,\n valid,\n value,\n } = useField<number>({\n hasRows: true,\n path,\n validate: memoizedValidate,\n })\n\n const addRow = useCallback(\n (rowIndex: number, blockType: string) => {\n addFieldRow({\n blockType,\n path,\n rowIndex,\n schemaPath,\n })\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [addFieldRow, path, schemaPath],\n )\n\n const duplicateRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'DUPLICATE_ROW', path, rowIndex })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [dispatchFields, path, setModified],\n )\n\n const removeRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({\n type: 'REMOVE_ROW',\n path,\n rowIndex,\n })\n\n setModified(true)\n },\n [path, dispatchFields, setModified],\n )\n\n const moveRow = useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const toggleCollapseAll = useCallback(\n (collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = toggleAllRows({\n collapsed,\n rows,\n })\n dispatchFields({ type: 'SET_ALL_ROWS_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const setCollapse = useCallback(\n (rowID: string, collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = extractRowsAndCollapsedIDs({\n collapsed,\n rowID,\n rows,\n })\n dispatchFields({ type: 'SET_ROW_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const hasMaxRows = maxRows && rows.length >= maxRows\n\n const fieldErrorCount = errorPaths.length\n const fieldHasErrors = submitted && fieldErrorCount + (valid ? 0 : 1) > 0\n\n const showMinRows = rows.length < minRows || (required && rows.length === 0)\n const showRequired = readOnly && rows.length === 0\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path?.replace(/\\./g, '__')}`}\n >\n {showError && (\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n )}\n <header className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-wrap`}>\n <div className={`${baseClass}__heading-with-error`}>\n <h3>\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n </h3>\n {fieldHasErrors && fieldErrorCount > 0 && (\n <ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />\n )}\n </div>\n {rows.length > 0 && (\n <ul className={`${baseClass}__header-actions`}>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(true)}\n type=\"button\"\n >\n {t('fields:collapseAll')}\n </button>\n </li>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(false)}\n type=\"button\"\n >\n {t('fields:showAll')}\n </button>\n </li>\n </ul>\n )}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </header>\n {BeforeInput}\n <NullifyLocaleField fieldValue={value} localized={localized} path={path} />\n {(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (\n <DraggableSortable\n className={`${baseClass}__rows`}\n ids={rows.map((row) => row.id)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {rows.map((row, i) => {\n const { blockType, isLoading } = row\n const blockConfig: ClientBlock =\n config.blocksMap[blockType] ??\n ((blockReferences ?? blocks).find(\n (block) => typeof block !== 'string' && block.slug === blockType,\n ) as ClientBlock)\n\n if (blockConfig) {\n const rowPath = `${path}.${i}`\n\n const rowErrorCount = errorPaths.filter((errorPath) =>\n errorPath.startsWith(rowPath + '.'),\n ).length\n\n return (\n <DraggableSortableItem disabled={readOnly || !isSortable} id={row.id} key={row.id}>\n {(draggableSortableItemProps) => (\n <BlockRow\n {...draggableSortableItemProps}\n addRow={addRow}\n block={blockConfig}\n blocks={blockReferences ?? blocks}\n duplicateRow={duplicateRow}\n errorCount={rowErrorCount}\n fields={blockConfig.fields}\n hasMaxRows={hasMaxRows}\n isLoading={isLoading}\n isSortable={isSortable}\n Label={RowLabels?.[i]}\n labels={labels}\n moveRow={moveRow}\n parentPath={path}\n path={rowPath}\n permissions={permissions}\n readOnly={readOnly}\n removeRow={removeRow}\n row={row}\n rowCount={rows.length}\n rowIndex={i}\n schemaPath={schemaPath + blockConfig.slug}\n setCollapse={setCollapse}\n />\n )}\n </DraggableSortableItem>\n )\n }\n\n return null\n })}\n {!editingDefaultLocale && (\n <React.Fragment>\n {showMinRows && (\n <Banner type=\"error\">\n {t('validation:requiresAtLeast', {\n count: minRows,\n label:\n getTranslation(minRows > 1 ? labels.plural : labels.singular, i18n) ||\n t(minRows > 1 ? 'general:row' : 'general:rows'),\n })}\n </Banner>\n )}\n {showRequired && (\n <Banner>\n {t('validation:fieldHasNo', { label: getTranslation(labels.plural, i18n) })}\n </Banner>\n )}\n </React.Fragment>\n )}\n </DraggableSortable>\n )}\n {!hasMaxRows && (\n <Fragment>\n <DrawerToggler\n className={`${baseClass}__drawer-toggler`}\n disabled={readOnly}\n slug={drawerSlug}\n >\n <Button\n buttonStyle=\"icon-label\"\n disabled={readOnly}\n el=\"span\"\n icon=\"plus\"\n iconPosition=\"left\"\n iconStyle=\"with-border\"\n >\n {t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n </Button>\n </DrawerToggler>\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={rows?.length || 0}\n blocks={blockReferences ?? blocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n </Fragment>\n )}\n {AfterInput}\n </div>\n )\n}\n\nexport const BlocksField = withCondition(BlocksFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,QAAQ;AAE7C,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAC9B,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,OAAO,EAAEC,gBAAgB,QAAQ;AAC1C,SAASC,0BAA0B,EAAEC,aAAa,QAAQ;AAC1D,SAASC,kBAAkB,QAAQ;AACnC,SAASC,QAAQ,QAA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UAAA;EAAA,C;CAGP;AAEA,OAAO,MAAM2F,WAAA,GAAczK,aAAA,CAAca,oBAAA;AA3UgB,SAAA6H,MAAAS,GAAA;EAAA,OAiOxBA,GAAA,CAAAhB,EAAA;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","getTranslation","React","Fragment","useCallback","Banner","Button","DraggableSortableItem","DraggableSortable","DrawerToggler","useDrawerSlug","ErrorPill","RenderCustomComponent","useForm","useFormSubmitted","extractRowsAndCollapsedIDs","toggleAllRows","NullifyLocaleField","useField","withCondition","useConfig","useDocumentInfo","useLocale","useTranslation","scrollToID","FieldDescription","FieldError","FieldLabel","fieldBaseClass","BlockRow","BlocksDrawer","baseClass","BlocksFieldComponent","props","$","i18n","t","field","t0","path","permissions","readOnly","schemaPath","schemaPathFromProps","validate","name","admin","t1","blockReferences","blocks","label","labels","labelsFromProps","localized","maxRows","minRows","minRowsProp","required","t2","undefined","className","description","isSortable","t3","setDocFieldPreferences","addFieldRow","dispatchFields","setModified","code","locale","config","t4","localization","drawerSlug","submitted","plural","singular","t5","bb0","fallback","defaultLocale","editingDefaultLocale","t6","value","options","memoizedValidate","t7","hasRows","customComponents","t8","disabled","errorPaths","rows","t9","showError","valid","value_0","t10","AfterInput","BeforeInput","Description","Error","Label","RowLabels","t11","t12","rowIndex","blockType","setTimeout","addRow","t13","rowIndex_0","type","duplicateRow","t14","rowIndex_1","removeRow","t15","moveFromIndex","moveToIndex","moveRow","t16","collapsed","collapsedIDs","updatedRows","toggleCollapseAll","t17","rowID","collapsed_0","collapsedIDs_0","updatedRows_0","setCollapse","hasMaxRows","length","fieldErrorCount","fieldHasErrors","showMinRows","showRequired","t18","t19","filter","Boolean","t20","_jsx","CustomComponent","Fallback","t21","count","withMessage","_jsxs","join","id","replace","children","onClick","fieldValue","ids","map","_temp","onDragEnd","t22","moveFromIndex_0","moveToIndex_0","row_0","i","blockType_0","isLoading","row","blockConfig","blocksMap","find","block","slug","rowPath","rowErrorCount","errorPath","startsWith","draggableSortableItemProps","errorCount","fields","parentPath","rowCount","buttonStyle","el","icon","iconPosition","iconStyle","addRowIndex","BlocksField"],"sources":["../../../src/fields/Blocks/index.tsx"],"sourcesContent":["'use client'\nimport type { BlocksFieldClientComponent, ClientBlock } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback } from 'react'\n\nimport { Banner } from '../../elements/Banner/index.js'\nimport { Button } from '../../elements/Button/index.js'\nimport { DraggableSortableItem } from '../../elements/DraggableSortable/DraggableSortableItem/index.js'\nimport { DraggableSortable } from '../../elements/DraggableSortable/index.js'\nimport { DrawerToggler } from '../../elements/Drawer/index.js'\nimport { useDrawerSlug } from '../../elements/Drawer/useDrawerSlug.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { useForm, useFormSubmitted } from '../../forms/Form/context.js'\nimport { extractRowsAndCollapsedIDs, toggleAllRows } from '../../forms/Form/rowHelpers.js'\nimport { NullifyLocaleField } from '../../forms/NullifyField/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useConfig } from '../../providers/Config/index.js'\nimport { useDocumentInfo } from '../../providers/DocumentInfo/index.js'\nimport { useLocale } from '../../providers/Locale/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { scrollToID } from '../../utilities/scrollToID.js'\nimport { FieldDescription } from '../FieldDescription/index.js'\nimport { FieldError } from '../FieldError/index.js'\nimport { FieldLabel } from '../FieldLabel/index.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { BlockRow } from './BlockRow.js'\nimport { BlocksDrawer } from './BlocksDrawer/index.js'\nimport './index.scss'\n\nconst baseClass = 'blocks-field'\n\nconst BlocksFieldComponent: BlocksFieldClientComponent = (props) => {\n const { i18n, t } = useTranslation()\n\n const {\n field: {\n name,\n admin: { className, description, isSortable = true } = {},\n blockReferences,\n blocks,\n label,\n labels: labelsFromProps,\n localized,\n maxRows,\n minRows: minRowsProp,\n required,\n },\n path,\n permissions,\n readOnly,\n schemaPath: schemaPathFromProps,\n validate,\n } = props\n\n const schemaPath = schemaPathFromProps ?? name\n\n const minRows = (minRowsProp ?? required) ? 1 : 0\n\n const { setDocFieldPreferences } = useDocumentInfo()\n const { addFieldRow, dispatchFields, setModified } = useForm()\n const { code: locale } = useLocale()\n const {\n config: { localization },\n config,\n } = useConfig()\n const drawerSlug = useDrawerSlug('blocks-drawer')\n const submitted = useFormSubmitted()\n\n const labels = {\n plural: t('fields:blocks'),\n singular: t('fields:block'),\n ...labelsFromProps,\n }\n\n const editingDefaultLocale = (() => {\n if (localization && localization.fallback) {\n const defaultLocale = localization.defaultLocale\n return locale === defaultLocale\n }\n\n return true\n })()\n\n const memoizedValidate = useCallback(\n (value, options) => {\n // alternative locales can be null\n if (!editingDefaultLocale && value === null) {\n return true\n }\n if (typeof validate === 'function') {\n return validate(value, { ...options, maxRows, minRows, required })\n }\n },\n [maxRows, minRows, required, validate, editingDefaultLocale],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label, RowLabels } = {},\n disabled,\n errorPaths,\n rows = [],\n showError,\n valid,\n value,\n } = useField<number>({\n hasRows: true,\n path,\n validate: memoizedValidate,\n })\n\n const addRow = useCallback(\n (rowIndex: number, blockType: string) => {\n addFieldRow({\n blockType,\n path,\n rowIndex,\n schemaPath,\n })\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [addFieldRow, path, schemaPath],\n )\n\n const duplicateRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({ type: 'DUPLICATE_ROW', path, rowIndex })\n setModified(true)\n\n setTimeout(() => {\n scrollToID(`${path}-row-${rowIndex + 1}`)\n }, 0)\n },\n [dispatchFields, path, setModified],\n )\n\n const removeRow = useCallback(\n (rowIndex: number) => {\n dispatchFields({\n type: 'REMOVE_ROW',\n path,\n rowIndex,\n })\n\n setModified(true)\n },\n [path, dispatchFields, setModified],\n )\n\n const moveRow = useCallback(\n (moveFromIndex: number, moveToIndex: number) => {\n dispatchFields({ type: 'MOVE_ROW', moveFromIndex, moveToIndex, path })\n setModified(true)\n },\n [dispatchFields, path, setModified],\n )\n\n const toggleCollapseAll = useCallback(\n (collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = toggleAllRows({\n collapsed,\n rows,\n })\n dispatchFields({ type: 'SET_ALL_ROWS_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const setCollapse = useCallback(\n (rowID: string, collapsed: boolean) => {\n const { collapsedIDs, updatedRows } = extractRowsAndCollapsedIDs({\n collapsed,\n rowID,\n rows,\n })\n dispatchFields({ type: 'SET_ROW_COLLAPSED', path, updatedRows })\n setDocFieldPreferences(path, { collapsed: collapsedIDs })\n },\n [dispatchFields, path, rows, setDocFieldPreferences],\n )\n\n const hasMaxRows = maxRows && rows.length >= maxRows\n\n const fieldErrorCount = errorPaths.length\n const fieldHasErrors = submitted && fieldErrorCount + (valid ? 0 : 1) > 0\n\n const showMinRows = rows.length < minRows || (required && rows.length === 0)\n const showRequired = readOnly && rows.length === 0\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n fieldHasErrors ? `${baseClass}--has-error` : `${baseClass}--has-no-error`,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path?.replace(/\\./g, '__')}`}\n >\n {showError && (\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n )}\n <header className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-wrap`}>\n <div className={`${baseClass}__heading-with-error`}>\n <h3>\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n </h3>\n {fieldHasErrors && fieldErrorCount > 0 && (\n <ErrorPill count={fieldErrorCount} i18n={i18n} withMessage />\n )}\n </div>\n {rows.length > 0 && (\n <ul className={`${baseClass}__header-actions`}>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(true)}\n type=\"button\"\n >\n {t('fields:collapseAll')}\n </button>\n </li>\n <li>\n <button\n className={`${baseClass}__header-action`}\n onClick={() => toggleCollapseAll(false)}\n type=\"button\"\n >\n {t('fields:showAll')}\n </button>\n </li>\n </ul>\n )}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </header>\n {BeforeInput}\n <NullifyLocaleField fieldValue={value} localized={localized} path={path} />\n {(rows.length > 0 || (!valid && (showRequired || showMinRows))) && (\n <DraggableSortable\n className={`${baseClass}__rows`}\n ids={rows.map((row) => row.id)}\n onDragEnd={({ moveFromIndex, moveToIndex }) => moveRow(moveFromIndex, moveToIndex)}\n >\n {rows.map((row, i) => {\n const { blockType, isLoading } = row\n const blockConfig: ClientBlock =\n config.blocksMap[blockType] ??\n ((blockReferences ?? blocks).find(\n (block) => typeof block !== 'string' && block.slug === blockType,\n ) as ClientBlock)\n\n if (blockConfig) {\n const rowPath = `${path}.${i}`\n\n const rowErrorCount = errorPaths.filter((errorPath) =>\n errorPath.startsWith(rowPath + '.'),\n ).length\n\n return (\n <DraggableSortableItem\n disabled={readOnly || disabled || !isSortable}\n id={row.id}\n key={row.id}\n >\n {(draggableSortableItemProps) => (\n <BlockRow\n {...draggableSortableItemProps}\n addRow={addRow}\n block={blockConfig}\n blocks={blockReferences ?? blocks}\n duplicateRow={duplicateRow}\n errorCount={rowErrorCount}\n fields={blockConfig.fields}\n hasMaxRows={hasMaxRows}\n isLoading={isLoading}\n isSortable={isSortable}\n Label={RowLabels?.[i]}\n labels={labels}\n moveRow={moveRow}\n parentPath={path}\n path={rowPath}\n permissions={permissions}\n readOnly={readOnly || disabled}\n removeRow={removeRow}\n row={row}\n rowCount={rows.length}\n rowIndex={i}\n schemaPath={schemaPath + blockConfig.slug}\n setCollapse={setCollapse}\n />\n )}\n </DraggableSortableItem>\n )\n }\n\n return null\n })}\n {!editingDefaultLocale && (\n <React.Fragment>\n {showMinRows && (\n <Banner type=\"error\">\n {t('validation:requiresAtLeast', {\n count: minRows,\n label:\n getTranslation(minRows > 1 ? labels.plural : labels.singular, i18n) ||\n t(minRows > 1 ? 'general:row' : 'general:rows'),\n })}\n </Banner>\n )}\n {showRequired && (\n <Banner>\n {t('validation:fieldHasNo', { label: getTranslation(labels.plural, i18n) })}\n </Banner>\n )}\n </React.Fragment>\n )}\n </DraggableSortable>\n )}\n {!hasMaxRows && (\n <Fragment>\n <DrawerToggler\n className={`${baseClass}__drawer-toggler`}\n disabled={readOnly || disabled}\n slug={drawerSlug}\n >\n <Button\n buttonStyle=\"icon-label\"\n disabled={readOnly || disabled}\n el=\"span\"\n icon=\"plus\"\n iconPosition=\"left\"\n iconStyle=\"with-border\"\n >\n {t('fields:addLabel', { label: getTranslation(labels.singular, i18n) })}\n </Button>\n </DrawerToggler>\n <BlocksDrawer\n addRow={addRow}\n addRowIndex={rows?.length || 0}\n blocks={blockReferences ?? blocks}\n drawerSlug={drawerSlug}\n labels={labels}\n />\n </Fragment>\n )}\n {AfterInput}\n </div>\n )\n}\n\nexport const BlocksField = withCondition(BlocksFieldComponent)\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,QAAQ;AAE7C,SAASC,MAAM,QAAQ;AACvB,SAASC,MAAM,QAAQ;AACvB,SAASC,qBAAqB,QAAQ;AACtC,SAASC,iBAAiB,QAAQ;AAClC,SAASC,aAAa,QAAQ;AAC9B,SAASC,aAAa,QAAQ;AAC9B,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,OAAO,EAAEC,gBAAgB,QAAQ;AAC1C,SAASC,0BAA0B,EAAEC,aAAa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QAAA+E,MAAA;QAAA8E,WAAA,EAEe/F,IAAA,EAAAyC,MAAA,KAAgB;QAAApF,MAAA,EACrBD,eAAA,IAAmBC,MAAA;QAAAwB,UAAA;QAAAtB;MAAA,C;QAMhC+C,UAAA;EAAA,C;CAGP;AAEA,OAAO,MAAM0F,WAAA,GAAczK,aAAA,CAAca,oBAAA;AAjVgB,SAAA8H,MAAAS,GAAA;EAAA,OAmOxBA,GAAA,CAAAhB,EAAA;AAAA","ignoreList":[]}
@@ -1,8 +1,8 @@
1
1
  import type { CheckboxFieldClientProps, CheckboxFieldValidation } from 'payload';
2
2
  import React from 'react';
3
3
  import type { CheckboxInputProps } from './Input.js';
4
- import './index.scss';
5
4
  import { CheckboxInput } from './Input.js';
5
+ import './index.scss';
6
6
  export { CheckboxFieldClientProps, CheckboxInput, type CheckboxInputProps };
7
7
  export declare const CheckboxField: React.FC<{
8
8
  readonly checked?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Checkbox/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAA+B,MAAM,OAAO,CAAA;AAEnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAWpD,OAAO,cAAc,CAAA;AAErB,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAI1C,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,CAAA;AAmG3E,eAAO,MAAM,aAAa;;;;;;;;;;+EAAwC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Checkbox/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,SAAS,CAAA;AAEhB,OAAO,KAA+B,MAAM,OAAO,CAAA;AAEnD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAYpD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,cAAc,CAAA;AAIrB,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,CAAA;AAoG3E,eAAO,MAAM,aAAa;;;;;;;;;;+EAAwC,CAAA"}
@@ -11,9 +11,9 @@ import { withCondition } from '../../forms/withCondition/index.js';
11
11
  import { useEditDepth } from '../../providers/EditDepth/index.js';
12
12
  import { generateFieldID } from '../../utilities/generateFieldID.js';
13
13
  import { mergeFieldStyles } from '../mergeFieldStyles.js';
14
- import './index.scss';
15
14
  import { fieldBaseClass } from '../shared/index.js';
16
15
  import { CheckboxInput } from './Input.js';
16
+ import './index.scss';
17
17
  const baseClass = 'checkbox';
18
18
  export { CheckboxInput };
19
19
  const CheckboxFieldComponent = props => {
@@ -56,6 +56,7 @@ const CheckboxFieldComponent = props => {
56
56
  Error,
57
57
  Label
58
58
  } = {},
59
+ disabled,
59
60
  setValue,
60
61
  showError,
61
62
  value: value_0
@@ -76,7 +77,7 @@ const CheckboxFieldComponent = props => {
76
77
  const fieldID = id || generateFieldID(path, editDepth, uuid);
77
78
  const styles = useMemo(() => mergeFieldStyles(field), [field]);
78
79
  return /*#__PURE__*/_jsxs("div", {
79
- className: [fieldBaseClass, baseClass, showError && 'error', className, value_0 && `${baseClass}--checked`, readOnly && `${baseClass}--read-only`].filter(Boolean).join(' '),
80
+ className: [fieldBaseClass, baseClass, showError && 'error', className, value_0 && `${baseClass}--checked`, (readOnly || disabled) && `${baseClass}--read-only`].filter(Boolean).join(' '),
80
81
  style: styles,
81
82
  children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
82
83
  CustomComponent: Error,
@@ -95,7 +96,7 @@ const CheckboxFieldComponent = props => {
95
96
  name: path,
96
97
  onToggle: onToggle,
97
98
  partialChecked: partialChecked,
98
- readOnly: readOnly,
99
+ readOnly: readOnly || disabled,
99
100
  required: required
100
101
  }), /*#__PURE__*/_jsx(RenderCustomComponent, {
101
102
  CustomComponent: Description,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useMemo","RenderCustomComponent","FieldDescription","FieldError","useForm","useField","withCondition","useEditDepth","generateFieldID","mergeFieldStyles","fieldBaseClass","CheckboxInput","baseClass","CheckboxFieldComponent","props","id","checked","checkedFromProps","disableFormData","field","admin","className","description","label","required","onChange","onChangeFromProps","partialChecked","path","readOnly","validate","uuid","editDepth","memoizedValidate","value","options","customComponents","AfterInput","BeforeInput","Description","Error","Label","setValue","showError","onToggle","Boolean","fieldID","styles","_jsxs","filter","join","style","_jsx","CustomComponent","Fallback","inputRef","name","CheckboxField"],"sources":["../../../src/fields/Checkbox/index.tsx"],"sourcesContent":["'use client'\nimport type {\n CheckboxFieldClientComponent,\n CheckboxFieldClientProps,\n CheckboxFieldValidation,\n} from 'payload'\n\nimport React, { useCallback, useMemo } from 'react'\n\nimport type { CheckboxInputProps } from './Input.js'\n\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/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 { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { CheckboxInput } from './Input.js'\n\nconst baseClass = 'checkbox'\n\nexport { CheckboxFieldClientProps, CheckboxInput, type CheckboxInputProps }\n\nconst CheckboxFieldComponent: CheckboxFieldClientComponent = (props) => {\n const {\n id,\n checked: checkedFromProps,\n disableFormData,\n field,\n field: {\n admin: { className, description } = {} as CheckboxFieldClientProps['field']['admin'],\n label,\n required,\n } = {} as CheckboxFieldClientProps['field'],\n onChange: onChangeFromProps,\n partialChecked,\n path,\n readOnly,\n validate,\n } = props\n\n const { uuid } = useForm()\n\n const editDepth = useEditDepth()\n\n const memoizedValidate: CheckboxFieldValidation = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n setValue,\n showError,\n value,\n } = useField({\n disableFormData,\n path,\n validate: memoizedValidate,\n })\n\n const onToggle = useCallback(() => {\n if (!readOnly) {\n setValue(!value)\n if (typeof onChangeFromProps === 'function') {\n onChangeFromProps(!value)\n }\n }\n }, [onChangeFromProps, readOnly, setValue, value])\n\n const checked = checkedFromProps || Boolean(value)\n\n const fieldID = id || generateFieldID(path, editDepth, uuid)\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n showError && 'error',\n className,\n value && `${baseClass}--checked`,\n readOnly && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n style={styles}\n >\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n <CheckboxInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n checked={checked}\n id={fieldID}\n inputRef={null}\n Label={Label}\n label={label}\n name={path}\n onToggle={onToggle}\n partialChecked={partialChecked}\n readOnly={readOnly}\n required={required}\n />\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const CheckboxField = withCondition(CheckboxFieldComponent)\n"],"mappings":"AAAA;;;AAOA,OAAOA,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAI5C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,OAAO,QAAQ;AACxB,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa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B,WAAA,EAAaA,WAAA;QAAaM,IAAA,EAAMA;;;;AAIpE;AAEA,OAAO,MAAM6B,aAAA,GAAgBnD,aAAA,CAAcO,sBAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useMemo","RenderCustomComponent","FieldDescription","FieldError","useForm","useField","withCondition","useEditDepth","generateFieldID","mergeFieldStyles","fieldBaseClass","CheckboxInput","baseClass","CheckboxFieldComponent","props","id","checked","checkedFromProps","disableFormData","field","admin","className","description","label","required","onChange","onChangeFromProps","partialChecked","path","readOnly","validate","uuid","editDepth","memoizedValidate","value","options","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","setValue","showError","onToggle","Boolean","fieldID","styles","_jsxs","filter","join","style","_jsx","CustomComponent","Fallback","inputRef","name","CheckboxField"],"sources":["../../../src/fields/Checkbox/index.tsx"],"sourcesContent":["'use client'\nimport type {\n CheckboxFieldClientComponent,\n CheckboxFieldClientProps,\n CheckboxFieldValidation,\n} from 'payload'\n\nimport React, { useCallback, useMemo } from 'react'\n\nimport type { CheckboxInputProps } from './Input.js'\n\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/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 { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { CheckboxInput } from './Input.js'\nimport './index.scss'\n\nconst baseClass = 'checkbox'\n\nexport { CheckboxFieldClientProps, CheckboxInput, type CheckboxInputProps }\n\nconst CheckboxFieldComponent: CheckboxFieldClientComponent = (props) => {\n const {\n id,\n checked: checkedFromProps,\n disableFormData,\n field,\n field: {\n admin: { className, description } = {} as CheckboxFieldClientProps['field']['admin'],\n label,\n required,\n } = {} as CheckboxFieldClientProps['field'],\n onChange: onChangeFromProps,\n partialChecked,\n path,\n readOnly,\n validate,\n } = props\n\n const { uuid } = useForm()\n\n const editDepth = useEditDepth()\n\n const memoizedValidate: CheckboxFieldValidation = useCallback(\n (value, options) => {\n if (typeof validate === 'function') {\n return validate(value, { ...options, required })\n }\n },\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled,\n setValue,\n showError,\n value,\n } = useField({\n disableFormData,\n path,\n validate: memoizedValidate,\n })\n\n const onToggle = useCallback(() => {\n if (!readOnly) {\n setValue(!value)\n if (typeof onChangeFromProps === 'function') {\n onChangeFromProps(!value)\n }\n }\n }, [onChangeFromProps, readOnly, setValue, value])\n\n const checked = checkedFromProps || Boolean(value)\n\n const fieldID = id || generateFieldID(path, editDepth, uuid)\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n showError && 'error',\n className,\n value && `${baseClass}--checked`,\n (readOnly || disabled) && `${baseClass}--read-only`,\n ]\n .filter(Boolean)\n .join(' ')}\n style={styles}\n >\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n <CheckboxInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n checked={checked}\n id={fieldID}\n inputRef={null}\n Label={Label}\n label={label}\n name={path}\n onToggle={onToggle}\n partialChecked={partialChecked}\n readOnly={readOnly || disabled}\n required={required}\n />\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const CheckboxField = withCondition(CheckboxFieldComponent)\n"],"mappings":"AAAA;;;AAOA,OAAOA,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAI5C,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC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AUA;qBAEZ6B,IAAA,CAACpD,qBAAA;MACCqD,eAAA,EAAiBf,WAAA;MACjBgB,QAAA,eAAUF,IAAA,CAACnD,gBAAA;QAAiBoB,WAAA,EAAaA,WAAA;QAAaM,IAAA,EAAMA;;;;AAIpE;AAEA,OAAO,MAAM8B,aAAA,GAAgBpD,aAAA,CAAcO,sBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Code/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAUnD,OAAO,cAAc,CAAA;AAyFrB,eAAO,MAAM,SAAS;;;;;;;+EAAoC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Code/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAUnD,OAAO,cAAc,CAAA;AA0FrB,eAAO,MAAM,SAAS;;;;;;;+EAAoC,CAAA"}
@@ -52,6 +52,7 @@ const CodeFieldComponent = props => {
52
52
  Error,
53
53
  Label
54
54
  } = {},
55
+ disabled,
55
56
  setValue,
56
57
  showError,
57
58
  value: value_0
@@ -61,7 +62,7 @@ const CodeFieldComponent = props => {
61
62
  });
62
63
  const styles = useMemo(() => mergeFieldStyles(field), [field]);
63
64
  return /*#__PURE__*/_jsxs("div", {
64
- className: [fieldBaseClass, baseClass, className, showError && 'error', readOnly && 'read-only'].filter(Boolean).join(' '),
65
+ className: [fieldBaseClass, baseClass, className, showError && 'error', (readOnly || disabled) && 'read-only'].filter(Boolean).join(' '),
65
66
  style: styles,
66
67
  children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
67
68
  CustomComponent: Label,
@@ -81,10 +82,10 @@ const CodeFieldComponent = props => {
81
82
  })
82
83
  }), BeforeInput, /*#__PURE__*/_jsx(CodeEditor, {
83
84
  defaultLanguage: prismToMonacoLanguageMap[language] || language,
84
- onChange: readOnly ? () => null : val => setValue(val),
85
+ onChange: readOnly || disabled ? () => null : val => setValue(val),
85
86
  onMount: onMount,
86
87
  options: editorOptions,
87
- readOnly: readOnly,
88
+ readOnly: readOnly || disabled,
88
89
  value: value_0 || ''
89
90
  }), AfterInput]
90
91
  }), /*#__PURE__*/_jsx(RenderCustomComponent, {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["React","useCallback","useMemo","CodeEditor","RenderCustomComponent","FieldDescription","FieldError","FieldLabel","useField","withCondition","mergeFieldStyles","fieldBaseClass","prismToMonacoLanguageMap","js","ts","baseClass","CodeFieldComponent","props","field","admin","className","description","editorOptions","language","label","localized","required","onMount","path","readOnly","validate","memoizedValidate","value","options","customComponents","AfterInput","BeforeInput","Description","Error","Label","setValue","showError","styles","_jsxs","filter","Boolean","join","style","_jsx","CustomComponent","Fallback","defaultLanguage","onChange","val","CodeField"],"sources":["../../../src/fields/Code/index.tsx"],"sourcesContent":["'use client'\nimport type { CodeFieldClientComponent } from 'payload'\n\nimport React, { useCallback, useMemo } from 'react'\n\nimport { CodeEditor } from '../../elements/CodeEditor/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/index.js'\nimport { FieldLabel } from '../../fields/FieldLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst prismToMonacoLanguageMap = {\n js: 'javascript',\n ts: 'typescript',\n}\n\nconst baseClass = 'code-field'\n\nconst CodeFieldComponent: CodeFieldClientComponent = (props) => {\n const {\n field,\n field: {\n admin: { className, description, editorOptions = {}, language = 'javascript' } = {},\n label,\n localized,\n required,\n },\n onMount,\n path,\n readOnly,\n validate,\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 {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n setValue,\n showError,\n value,\n } = useField({\n path,\n validate: memoizedValidate,\n })\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n readOnly && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={styles}\n >\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {BeforeInput}\n <CodeEditor\n defaultLanguage={prismToMonacoLanguageMap[language] || language}\n onChange={readOnly ? () => null : (val) => setValue(val)}\n onMount={onMount}\n options={editorOptions}\n readOnly={readOnly}\n value={(value as string) || ''}\n />\n {AfterInput}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const CodeField = withCondition(CodeFieldComponent)\n"],"mappings":"AAAA;;;AAGA,OAAOA,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAE5C,SAASC,UAAU,QAAQ;AAC3B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,gBAAgB,QAAQ;AACjC,OAAO;AACP,SAASC,cAAc,QAAQ;AAE/B,MAAMC,wBAAA,GAA2B;EAC/BC,EAAA,EAAI;EACJC,EAAA,EAAI;AACN;AAEA,MAAMC,SAAA,GAAY;AAElB,MAAMC,kBAAA,GAAgDC,KAAA;EACpD,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MACLC,KAAA,EAA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,QAAsB;8BACvCqC,IAAA,CAAC5C,qBAAA;QACC6C,eAAA,EAAiBX,KAAA;QACjBY,QAAA,eAAUF,IAAA,CAAC1C,UAAA;UAAWsB,IAAA,EAAMA,IAAA;UAAMa,SAAA,EAAWA;;UAE9CL,WAAA,E,aACDY,IAAA,CAAC7C,UAAA;QACCgD,eAAA,EAAiBvC,wBAAwB,CAACW,QAAA,CAAS,IAAIA,QAAA;QACvD6B,QAAA,EAAUvB,QAAA,GAAW,MAAM,OAAQwB,GAAA,IAAQb,QAAA,CAASa,GAAA;QACpD1B,OAAA,EAASA,OAAA;QACTM,OAAA,EAASX,aAAA;QACTO,QAAA,EAAUA,QAAA;QACVG,KAAA,EAAOA,OAAC,IAAoB;UAE7BG,UAAA;qBAEHa,IAAA,CAAC5C,qBAAA;MACC6C,eAAA,EAAiBZ,WAAA;MACjBa,QAAA,eAAUF,IAAA,CAAC3C,gBAAA;QAAiBgB,WAAA,EAAaA,WAAA;QAAaO,IAAA,EAAMA;;;;AAIpE;AAEA,OAAO,MAAM0B,SAAA,GAAY7C,aAAA,CAAcO,kBAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["React","useCallback","useMemo","CodeEditor","RenderCustomComponent","FieldDescription","FieldError","FieldLabel","useField","withCondition","mergeFieldStyles","fieldBaseClass","prismToMonacoLanguageMap","js","ts","baseClass","CodeFieldComponent","props","field","admin","className","description","editorOptions","language","label","localized","required","onMount","path","readOnly","validate","memoizedValidate","value","options","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","setValue","showError","styles","_jsxs","filter","Boolean","join","style","_jsx","CustomComponent","Fallback","defaultLanguage","onChange","val","CodeField"],"sources":["../../../src/fields/Code/index.tsx"],"sourcesContent":["'use client'\nimport type { CodeFieldClientComponent } from 'payload'\n\nimport React, { useCallback, useMemo } from 'react'\n\nimport { CodeEditor } from '../../elements/CodeEditor/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldError } from '../../fields/FieldError/index.js'\nimport { FieldLabel } from '../../fields/FieldLabel/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst prismToMonacoLanguageMap = {\n js: 'javascript',\n ts: 'typescript',\n}\n\nconst baseClass = 'code-field'\n\nconst CodeFieldComponent: CodeFieldClientComponent = (props) => {\n const {\n field,\n field: {\n admin: { className, description, editorOptions = {}, language = 'javascript' } = {},\n label,\n localized,\n required,\n },\n onMount,\n path,\n readOnly,\n validate,\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 {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled,\n setValue,\n showError,\n value,\n } = useField({\n path,\n validate: memoizedValidate,\n })\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n className,\n showError && 'error',\n (readOnly || disabled) && 'read-only',\n ]\n .filter(Boolean)\n .join(' ')}\n style={styles}\n >\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <FieldLabel label={label} localized={localized} path={path} required={required} />\n }\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {BeforeInput}\n <CodeEditor\n defaultLanguage={prismToMonacoLanguageMap[language] || language}\n onChange={readOnly || disabled ? () => null : (val) => setValue(val)}\n onMount={onMount}\n options={editorOptions}\n readOnly={readOnly || disabled}\n value={(value as string) || ''}\n />\n {AfterInput}\n </div>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n )\n}\n\nexport const CodeField = withCondition(CodeField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AAA,GAAY9C,aAAA,CAAcO,kBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Collapsible/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAelF,OAAO,cAAc,CAAA;AA6IrB,eAAO,MAAM,gBAAgB;;+EAA2C,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/Collapsible/index.tsx"],"names":[],"mappings":"AAIA,OAAO,KAA8D,MAAM,OAAO,CAAA;AAelF,OAAO,cAAc,CAAA;AA8IrB,eAAO,MAAM,gBAAgB;;+EAA2C,CAAA"}
@@ -58,7 +58,8 @@ const CollapsibleFieldComponent = props => {
58
58
  BeforeInput,
59
59
  Description,
60
60
  Label
61
- } = {}
61
+ } = {},
62
+ disabled
62
63
  } = useField({
63
64
  path
64
65
  });
@@ -141,7 +142,7 @@ const CollapsibleFieldComponent = props => {
141
142
  parentPath: parentPath,
142
143
  parentSchemaPath: parentSchemaPath,
143
144
  permissions: permissions,
144
- readOnly: readOnly
145
+ readOnly: readOnly || disabled
145
146
  })
146
147
  }), AfterInput, /*#__PURE__*/_jsx(RenderCustomComponent, {
147
148
  CustomComponent: Description,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["getTranslation","React","Fragment","useCallback","useEffect","useMemo","useState","Collapsible","CollapsibleElement","ErrorPill","RenderCustomComponent","FieldDescription","RenderFields","RowLabel","useField","WatchChildErrors","withCondition","useDocumentInfo","usePreferences","useTranslation","mergeFieldStyles","fieldBaseClass","baseClass","CollapsibleFieldComponent","props","field","admin","className","description","initCollapsed","fields","label","indexPath","parentPath","parentSchemaPath","path","permissions","readOnly","i18n","getPreference","setPreference","preferencesKey","collapsedOnMount","setCollapsedOnMount","fieldPreferencesKey","replace","errorCount","setErrorCount","fieldHasErrors","customComponents","AfterInput","BeforeInput","Description","Label","onToggle","newCollapsedState","existingPreferences","collapsed","fetchInitialState","preferences","specificPreference","undefined","Boolean","styles","_jsxs","_jsx","split","slice","filter","join","id","style","collapsibleStyle","header","CustomComponent","count","withMessage","margins","parentIndexPath","Fallback","CollapsibleField"],"sources":["../../../src/fields/Collapsible/index.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleFieldClientComponent, DocumentPreferences } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { Collapsible as CollapsibleElement } from '../../elements/Collapsible/index.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { RowLabel } from '../../forms/RowLabel/index.js'\nimport { useField } from '../../forms/useField/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 { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst baseClass = 'collapsible-field'\n\nconst CollapsibleFieldComponent: CollapsibleFieldClientComponent = (props) => {\n const {\n field,\n field: { admin: { className, description, initCollapsed = false } = {}, fields, label } = {},\n indexPath,\n parentPath,\n parentSchemaPath,\n path,\n permissions,\n readOnly,\n } = props\n\n const { i18n } = useTranslation()\n const { getPreference, setPreference } = usePreferences()\n const { preferencesKey } = useDocumentInfo()\n const [collapsedOnMount, setCollapsedOnMount] = useState<boolean>()\n const fieldPreferencesKey = `collapsible-${path?.replace(/\\./g, '__')}`\n const [errorCount, setErrorCount] = useState(0)\n const fieldHasErrors = errorCount > 0\n\n const { customComponents: { AfterInput, BeforeInput, Description, Label } = {} } = useField({\n path,\n })\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 const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n if (typeof collapsedOnMount !== 'boolean') {\n return null\n }\n\n return (\n <Fragment>\n <WatchChildErrors\n fields={fields}\n // removes the 'collapsible' path segment, i.e. `_index-0`\n path={path.split('.').slice(0, -1)}\n setErrorCount={setErrorCount}\n />\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}`}\n style={styles}\n >\n {BeforeInput}\n <CollapsibleElement\n className={`${baseClass}__collapsible`}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__row-label-wrap`}>\n <RowLabel CustomComponent={Label} label={getTranslation(label, i18n)} path={path} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n }\n initCollapsed={collapsedOnMount}\n onToggle={onToggle}\n >\n <RenderFields\n fields={fields}\n margins=\"small\"\n parentIndexPath={indexPath}\n parentPath={parentPath}\n parentSchemaPath={parentSchemaPath}\n permissions={permissions}\n readOnly={readOnly}\n />\n </CollapsibleElement>\n {AfterInput}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </Fragment>\n )\n}\n\nexport const CollapsibleField = withCondition(CollapsibleFieldComponent)\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAE3E,SAASC,WAAA,IAAeC,kBAAkB,QAAQ;AAClD,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,QAAQ,QAAQ;AACzB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ;AACjC,OAAO;AACP,SAASC,cAAc,QAAQ;AAE/B,MAAMC,SAAA,GAAY;AAElB,MAAMC,yBAAA,GAA8DC,KAAA;EAClE,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MAAEC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAW;QAAEC,aAAA,GAAgB;MAAK,CAAE,GAAG,CAAC,CAAC;MAAEC,MAAM;MAAEC;IAAK,CAAE,GAAG,CAAC,CAAC;IAC5FC,S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AAG1B,SAAA,aAAsB,GAAG,GAAGA,SAAA,gBAAyB,CAC1E,CACE8C,MAAM,CAACN,OAAA,EACPO,IAAI,CAAC;MACRC,EAAA,EAAI,SAAS1B,mBAAA,EAAqB;MAClC2B,KAAA,EAAOR,MAAA;iBAENZ,WAAA,E,aACDc,IAAA,CAACzD,kBAAA;QACCmB,SAAA,EAAW,GAAGL,SAAA,eAAwB;QACtCkD,gBAAA,EAAkBxB,cAAA,GAAiB,UAAU;QAC7CyB,MAAA,eACET,KAAA,CAAC;UAAIrC,SAAA,EAAW,GAAGL,SAAA,kBAA2B;kCAC5C2C,IAAA,CAACpD,QAAA;YAAS6D,eAAA,EAAiBrB,KAAA;YAAOtB,KAAA,EAAO/B,cAAA,CAAe+B,KAAA,EAAOO,IAAA;YAAOH,IAAA,EAAMA;cAC3Ea,cAAA,iBAAkBiB,IAAA,CAACxD,SAAA;YAAUkE,KAAA,EAAO7B,UAAA;YAAYR,IAAA,EAAMA,IAAA;YAAMsC,WAAW;;;QAG5E/C,aAAA,EAAea,gBAAA;QACfY,QAAA,EAAUA,QAAA;kBAEV,aAAAW,IAAA,CAACrD,YAAA;UACCkB,MAAA,EAAQA,MAAA;UACR+C,OAAA,EAAQ;UACRC,eAAA,EAAiB9C,SAAA;UACjBC,UAAA,EAAYA,UAAA;UACZC,gBAAA,EAAkBA,gBAAA;UAClBE,WAAA,EAAaA,WAAA;UACbC,QAAA,EAAUA;;UAGba,UAAA,E,aACDe,IAAA,CAACvD,qBAAA;QACCgE,eAAA,EAAiBtB,WAAA;QACjB2B,QAAA,eAAUd,IAAA,CAACtD,gBAAA;UAAiBiB,WAAA,EAAaA,WAAA;UAAaO,IAAA,EAAMA;;;;;AAKtE;AAEA,OAAO,MAAM6C,gBAAA,GAAmBhE,aAAA,CAAcO,yBAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["getTranslation","React","Fragment","useCallback","useEffect","useMemo","useState","Collapsible","CollapsibleElement","ErrorPill","RenderCustomComponent","FieldDescription","RenderFields","RowLabel","useField","WatchChildErrors","withCondition","useDocumentInfo","usePreferences","useTranslation","mergeFieldStyles","fieldBaseClass","baseClass","CollapsibleFieldComponent","props","field","admin","className","description","initCollapsed","fields","label","indexPath","parentPath","parentSchemaPath","path","permissions","readOnly","i18n","getPreference","setPreference","preferencesKey","collapsedOnMount","setCollapsedOnMount","fieldPreferencesKey","replace","errorCount","setErrorCount","fieldHasErrors","customComponents","AfterInput","BeforeInput","Description","Label","disabled","onToggle","newCollapsedState","existingPreferences","collapsed","fetchInitialState","preferences","specificPreference","undefined","Boolean","styles","_jsxs","_jsx","split","slice","filter","join","id","style","collapsibleStyle","header","CustomComponent","count","withMessage","margins","parentIndexPath","Fallback","CollapsibleField"],"sources":["../../../src/fields/Collapsible/index.tsx"],"sourcesContent":["'use client'\nimport type { CollapsibleFieldClientComponent, DocumentPreferences } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React, { Fragment, useCallback, useEffect, useMemo, useState } from 'react'\n\nimport { Collapsible as CollapsibleElement } from '../../elements/Collapsible/index.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { RowLabel } from '../../forms/RowLabel/index.js'\nimport { useField } from '../../forms/useField/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 { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { fieldBaseClass } from '../shared/index.js'\n\nconst baseClass = 'collapsible-field'\n\nconst CollapsibleFieldComponent: CollapsibleFieldClientComponent = (props) => {\n const {\n field,\n field: { admin: { className, description, initCollapsed = false } = {}, fields, label } = {},\n indexPath,\n parentPath,\n parentSchemaPath,\n path,\n permissions,\n readOnly,\n } = props\n\n const { i18n } = useTranslation()\n const { getPreference, setPreference } = usePreferences()\n const { preferencesKey } = useDocumentInfo()\n const [collapsedOnMount, setCollapsedOnMount] = useState<boolean>()\n const fieldPreferencesKey = `collapsible-${path?.replace(/\\./g, '__')}`\n const [errorCount, setErrorCount] = useState(0)\n const fieldHasErrors = errorCount > 0\n\n const { customComponents: { AfterInput, BeforeInput, Description, Label } = {}, disabled } =\n useField({\n path,\n })\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 const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n if (typeof collapsedOnMount !== 'boolean') {\n return null\n }\n\n return (\n <Fragment>\n <WatchChildErrors\n fields={fields}\n // removes the 'collapsible' path segment, i.e. `_index-0`\n path={path.split('.').slice(0, -1)}\n setErrorCount={setErrorCount}\n />\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}`}\n style={styles}\n >\n {BeforeInput}\n <CollapsibleElement\n className={`${baseClass}__collapsible`}\n collapsibleStyle={fieldHasErrors ? 'error' : 'default'}\n header={\n <div className={`${baseClass}__row-label-wrap`}>\n <RowLabel CustomComponent={Label} label={getTranslation(label, i18n)} path={path} />\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n }\n initCollapsed={collapsedOnMount}\n onToggle={onToggle}\n >\n <RenderFields\n fields={fields}\n margins=\"small\"\n parentIndexPath={indexPath}\n parentPath={parentPath}\n parentSchemaPath={parentSchemaPath}\n permissions={permissions}\n readOnly={readOnly || disabled}\n />\n </CollapsibleElement>\n {AfterInput}\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </Fragment>\n )\n}\n\nexport const CollapsibleField = withCondition(CollapsibleFieldComponent)\n"],"mappings":"AAAA;;;AAGA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,IAASC,QAAQ,EAAEC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ;AAE3E,SAASC,WAAA,IAAeC,kBAAkB,QAAQ;AAClD,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,QAAQ,QAAQ;AACzB,SAASC,gBAAgB,QAAQ;AACjC,SAASC,aAAa,QAAQ;AAC9B,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B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AAA,EAAUA,QAAA,IAAYiB;;UAGzBJ,UAAA,E,aACDgB,IAAA,CAACxD,qBAAA;QACCiE,eAAA,EAAiBvB,WAAA;QACjB4B,QAAA,eAAUd,IAAA,CAACvD,gBAAA;UAAiBiB,WAAA,EAAaA,WAAA;UAAaO,IAAA,EAAMA;;;;;AAKtE;AAEA,OAAO,MAAM8C,gBAAA,GAAmBjE,aAAA,CAAcO,yBAAA","ignoreList":[]}
@@ -11,9 +11,9 @@ import { FieldLabel } from '../FieldLabel/index.js';
11
11
  import { fieldBaseClass } from '../shared/index.js';
12
12
  import './index.scss';
13
13
  export const ConfirmPasswordField = props => {
14
- const $ = _c(11);
14
+ const $ = _c(12);
15
15
  const {
16
- disabled,
16
+ disabled: disabledFromProps,
17
17
  path: t0
18
18
  } = props;
19
19
  const path = t0 === undefined ? "confirm-password" : t0;
@@ -32,6 +32,7 @@ export const ConfirmPasswordField = props => {
32
32
  t1 = $[1];
33
33
  }
34
34
  const {
35
+ disabled,
35
36
  setValue,
36
37
  showError,
37
38
  value: value_0
@@ -47,7 +48,7 @@ export const ConfirmPasswordField = props => {
47
48
  }
48
49
  const t4 = t3.join(" ");
49
50
  let t5;
50
- if ($[4] !== disabled || $[5] !== path || $[6] !== setValue || $[7] !== t || $[8] !== t4 || $[9] !== value_0) {
51
+ if ($[4] !== disabled || $[5] !== disabledFromProps || $[6] !== path || $[7] !== setValue || $[8] !== t || $[9] !== t4 || $[10] !== value_0) {
51
52
  t5 = _jsxs("div", {
52
53
  className: t4,
53
54
  children: [_jsx(FieldLabel, {
@@ -61,7 +62,7 @@ export const ConfirmPasswordField = props => {
61
62
  }), _jsx("input", {
62
63
  "aria-label": t("authentication:confirmPassword"),
63
64
  autoComplete: "off",
64
- disabled: !!disabled,
65
+ disabled: !!(disabled || disabledFromProps),
65
66
  id: "field-confirm-password",
66
67
  name: "confirm-password",
67
68
  onChange: setValue,
@@ -71,14 +72,15 @@ export const ConfirmPasswordField = props => {
71
72
  })]
72
73
  });
73
74
  $[4] = disabled;
74
- $[5] = path;
75
- $[6] = setValue;
76
- $[7] = t;
77
- $[8] = t4;
78
- $[9] = value_0;
79
- $[10] = t5;
75
+ $[5] = disabledFromProps;
76
+ $[6] = path;
77
+ $[7] = setValue;
78
+ $[8] = t;
79
+ $[9] = t4;
80
+ $[10] = value_0;
81
+ $[11] = t5;
80
82
  } else {
81
- t5 = $[10];
83
+ t5 = $[11];
82
84
  }
83
85
  return t5;
84
86
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["c","_c","confirmPassword","React","useField","useTranslation","FieldError","FieldLabel","fieldBaseClass","ConfirmPasswordField","props","$","disabled","path","t0","undefined","t","t1","validate","_temp","setValue","showError","value","value_0","t2","t3","filter","Boolean","t4","join","t5","_jsxs","className","children","_jsx","htmlFor","label","required","autoComplete","id","name","onChange","type","options"],"sources":["../../../src/fields/ConfirmPassword/index.tsx"],"sourcesContent":["'use client'\n\nimport { confirmPassword } from 'payload/shared'\nimport React from 'react'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { useTranslation } from '../../providers/Translation/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 ConfirmPasswordFieldProps = {\n readonly disabled?: boolean\n readonly path?: string\n}\n\nexport const ConfirmPasswordField: React.FC<ConfirmPasswordFieldProps> = (props) => {\n const { disabled, path = 'confirm-password' } = props\n const { t } = useTranslation()\n\n const { setValue, showError, value } = useField({\n path,\n validate: (value, options) => {\n return confirmPassword(value, {\n name: 'confirm-password',\n type: 'text',\n required: true,\n ...options,\n })\n },\n })\n\n return (\n <div\n className={[fieldBaseClass, 'confirm-password', showError && 'error']\n .filter(Boolean)\n .join(' ')}\n >\n <FieldLabel\n htmlFor=\"field-confirm-password\"\n label={t('authentication:confirmPassword')}\n required\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError path={path} />\n <input\n aria-label={t('authentication:confirmPassword')}\n autoComplete=\"off\"\n disabled={!!disabled}\n id=\"field-confirm-password\"\n name=\"confirm-password\"\n onChange={setValue}\n type=\"password\"\n value={(value as string) || ''}\n />\n </div>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,eAAe,QAAQ;AAChC,OAAOC,KAAA,MAAW;AAElB,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAC/B,OAAO;AAOP,OAAO,MAAMC,oBAAA,GAA4DC,KAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EACvE;IAAAW,QAAA;IAAAC,IAAA,EAAAC;EAAA,IAAgDJ,KAAA;EAA9B,MAAAG,IAAA,GAAAC,EAAyB,KAAAC,SAAA,GAAlB,kBAAkB,GAAzBD,EAAyB;EAC3C;IAAAE;EAAA,IAAcX,cAAA;EAAA,IAAAY,EAAA;EAAA,IAAAN,CAAA,QAAAE,IAAA;IAEkCI,EAAA;MAAAJ,IAAA;MAAAK,QAAA,EAAAC;IAAA;IAUhDR,CAAA,MAAAE,IAAA;IAAAF,CAAA,MAAAM,EAAA;EAAA;IAAAA,EAAA,GAAAN,CAAA;EAAA;EAVA;IAAAS,QAAA;IAAAC,SAAA;IAAAC,KAAA,EAAAC;EAAA,IAAuCnB,QAAA,CAASa,EAUhD;EAIoD,MAAAO,EAAA,GAAAH,SAAA,IAAa;EAAA,IAAAI,EAAA;EAAA,IAAAd,CAAA,QAAAa,EAAA;IAAlDC,EAAA,IAAAjB,cAAA,EAAiB,oBAAoBgB,EAAa,EAAAE,MAAA,CAAAC,OACnD;IAAAhB,CAAA,MAAAa,EAAA;IAAAb,CAAA,MAAAc,EAAA;EAAA;IAAAA,EAAA,GAAAd,CAAA;EAAA;EADC,MAAAiB,EAAA,GAAAH,EACD,CAAAI,IAAA,CACF;EAAA,IAAAC,EAAA;EAAA,IAAAnB,CAAA,QAAAC,QAAA,IAAAD,CAAA,QAAAE,IAAA,IAAAF,CAAA,QAAAS,QAAA,IAAAT,CAAA,QAAAK,CAAA,IAAAL,CAAA,QAAAiB,EAAA,IAAAjB,CAAA,QAAAY,OAAA;IAHVO,EAAA,GAAAC,KAAA,CAAC;MAAAC,SAAA,EACYJ,EAEH;MAAAK,QAAA,GAERC,IAAA,CAAA3B,UAAA;QAAA4B,OAAA,EACU;QAAAC,KAAA,EACDpB,CAAA,CAAE;QAAAqB,QAAA;MAAA,C,GAGXN,KAAA,CAAC;QAAAC,SAAA,EAAe,GAAAxB,cAAA,QAAyB;QAAAyB,QAAA,GACvCC,IAAA,CAAA5B,UAAA;UAAAO;QAAA,C,GACAqB,IAAA,CAAC;UAAA,cACalB,CAAA,CAAE;UAAAsB,YAAA,EACD;UAAA1B,QAAA,IACDA,QAAA;UAAA2B,EAAA,EACT;UAAAC,IAAA,EACE;UAAAC,QAAA,EACKrB,QAAA;UAAAsB,IAAA,EACL;UAAApB,KAAA,EACEA,OAAC,IAAoB;QAAA,C;;;;;;;;;;;;;SApBlCQ,E;CAyBJ;AA1CyE,SAAAX,MAAAG,KAAA,EAAAqB,OAAA;EAAA,OAO5DzC,eAAA,CAAgBoB,KAAA;IAAAkB,IAAA,EACf;IAAAE,IAAA,EACA;IAAAL,QAAA;IAAA,GAEHM;EAAO,CACZ;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["c","_c","confirmPassword","React","useField","useTranslation","FieldError","FieldLabel","fieldBaseClass","ConfirmPasswordField","props","$","disabled","disabledFromProps","path","t0","undefined","t","t1","validate","_temp","setValue","showError","value","value_0","t2","t3","filter","Boolean","t4","join","t5","_jsxs","className","children","_jsx","htmlFor","label","required","autoComplete","id","name","onChange","type","options"],"sources":["../../../src/fields/ConfirmPassword/index.tsx"],"sourcesContent":["'use client'\n\nimport { confirmPassword } from 'payload/shared'\nimport React from 'react'\n\nimport { useField } from '../../forms/useField/index.js'\nimport { useTranslation } from '../../providers/Translation/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 ConfirmPasswordFieldProps = {\n readonly disabled?: boolean\n readonly path?: string\n}\n\nexport const ConfirmPasswordField: React.FC<ConfirmPasswordFieldProps> = (props) => {\n const { disabled: disabledFromProps, path = 'confirm-password' } = props\n const { t } = useTranslation()\n\n const { disabled, setValue, showError, value } = useField({\n path,\n validate: (value, options) => {\n return confirmPassword(value, {\n name: 'confirm-password',\n type: 'text',\n required: true,\n ...options,\n })\n },\n })\n\n return (\n <div\n className={[fieldBaseClass, 'confirm-password', showError && 'error']\n .filter(Boolean)\n .join(' ')}\n >\n <FieldLabel\n htmlFor=\"field-confirm-password\"\n label={t('authentication:confirmPassword')}\n required\n />\n <div className={`${fieldBaseClass}__wrap`}>\n <FieldError path={path} />\n <input\n aria-label={t('authentication:confirmPassword')}\n autoComplete=\"off\"\n disabled={!!(disabled || disabledFromProps)}\n id=\"field-confirm-password\"\n name=\"confirm-password\"\n onChange={setValue}\n type=\"password\"\n value={(value as string) || ''}\n />\n </div>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,eAAe,QAAQ;AAChC,OAAOC,KAAA,MAAW;AAElB,SAASC,QAAQ,QAAQ;AACzB,SAASC,cAAc,QAAQ;AAC/B,SAASC,UAAU,QAAQ;AAC3B,SAASC,UAAU,QAAQ;AAC3B,SAASC,cAAc,QAAQ;AAC/B,OAAO;AAOP,OAAO,MAAMC,oBAAA,GAA4DC,KAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EACvE;IAAAW,QAAA,EAAAC,iBAAA;IAAAC,IAAA,EAAAC;EAAA,IAAmEL,KAAA;EAA9B,MAAAI,IAAA,GAAAC,EAAyB,KAAAC,SAAA,GAAlB,kBAAkB,G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UAAA3B,QAAA,KACAA,QAAA,IAAYC,iBAAgB;UAAA2B,EAAA,EACtC;UAAAC,IAAA,EACE;UAAAC,QAAA,EACKrB,QAAA;UAAAsB,IAAA,EACL;UAAApB,KAAA,EACEA,OAAC,IAAoB;QAAA,C;;;;;;;;;;;;;;SApBlCQ,E;CAyBJ;AA1CyE,SAAAX,MAAAG,KAAA,EAAAqB,OAAA;EAAA,OAO5D1C,eAAA,CAAgBqB,KAAA;IAAAkB,IAAA,EACf;IAAAE,IAAA,EACA;IAAAL,QAAA;IAAA,GAEHM;EAAO,CACZ;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/DateTime/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA4B,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAe5E,OAAO,cAAc,CAAA;AA4LrB,eAAO,MAAM,aAAa;;;;;+EAAwC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fields/DateTime/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA4B,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAe5E,OAAO,cAAc,CAAA;AA6LrB,eAAO,MAAM,aAAa;;;;;+EAAwC,CAAA"}
@@ -68,6 +68,7 @@ const DateTimeFieldComponent = props => {
68
68
  Error,
69
69
  Label
70
70
  } = {},
71
+ disabled,
71
72
  setValue,
72
73
  showError,
73
74
  value: value_0
@@ -102,7 +103,7 @@ const DateTimeFieldComponent = props => {
102
103
  }, [timezone, selectedTimezone, value_0, userTimezone]);
103
104
  const styles = useMemo(() => mergeFieldStyles(field), [field]);
104
105
  const onChange = useCallback(incomingDate => {
105
- if (!readOnly) {
106
+ if (!(readOnly || disabled)) {
106
107
  if (timezone && selectedTimezone && incomingDate) {
107
108
  // Create TZDate instances for the selected timezone
108
109
  const TZDateWithSelectedTz = TZDate.tz(selectedTimezone);
@@ -127,7 +128,7 @@ const DateTimeFieldComponent = props => {
127
128
  setValue(incomingDate?.toISOString() || null);
128
129
  }
129
130
  }
130
- }, [readOnly, setValue, timezone, selectedTimezone]);
131
+ }, [readOnly, disabled, timezone, selectedTimezone, isDateOnly, setValue]);
131
132
  const onChangeTimezone = useCallback(timezone_0 => {
132
133
  if (timezonePath) {
133
134
  dispatchFields({
@@ -139,7 +140,7 @@ const DateTimeFieldComponent = props => {
139
140
  }
140
141
  }, [dispatchFields, setModified, timezonePath]);
141
142
  return /*#__PURE__*/_jsxs("div", {
142
- className: [fieldBaseClass, baseClass, className, showError && `${baseClass}--has-error`, readOnly && 'read-only'].filter(Boolean).join(' '),
143
+ className: [fieldBaseClass, baseClass, className, showError && `${baseClass}--has-error`, (readOnly || disabled) && 'read-only'].filter(Boolean).join(' '),
143
144
  style: styles,
144
145
  children: [/*#__PURE__*/_jsx(RenderCustomComponent, {
145
146
  CustomComponent: Label,
@@ -164,7 +165,7 @@ const DateTimeFieldComponent = props => {
164
165
  ...datePickerProps?.overrides
165
166
  },
166
167
  placeholder: getTranslation(placeholder, i18n),
167
- readOnly: readOnly,
168
+ readOnly: readOnly || disabled,
168
169
  value: displayedValue
169
170
  }), timezone && supportedTimezones.length > 0 && /*#__PURE__*/_jsx(TimezonePicker, {
170
171
  id: `${path}-timezone-picker`,