Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
9.2 KiB
Plaintext
1 line
9.2 KiB
Plaintext
{"version":3,"file":"index.js","names":["getTranslation","groupHasName","React","useMemo","useCollapsible","ErrorPill","RenderCustomComponent","FieldDescription","FieldLabel","useFormSubmitted","RenderFields","useField","withCondition","useTranslation","mergeFieldStyles","useRow","fieldBaseClass","useTabs","GroupProvider","useGroup","baseClass","GroupFieldComponent","props","field","admin","className","description","hideGutter","fields","label","indexPath","parentPath","parentSchemaPath","path","permissions","readOnly","schemaPath","schemaPathFromProps","type","name","i18n","isWithinCollapsible","isWithinGroup","isWithinRow","isWithinTab","customComponents","AfterInput","BeforeInput","Description","Label","errorPaths","submitted","errorCount","length","fieldHasErrors","isTopLevel","styles","_jsxs","filter","Boolean","join","id","replace","style","_jsx","CustomComponent","Fallback","as","localized","required","count","withMessage","margins","parentIndexPath","GroupField"],"sources":["../../../src/fields/Group/index.tsx"],"sourcesContent":["'use client'\n\nimport type { GroupFieldClientComponent } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport { groupHasName } from 'payload/shared'\nimport React, { useMemo } from 'react'\n\nimport { useCollapsible } from '../../elements/Collapsible/provider.js'\nimport { ErrorPill } from '../../elements/ErrorPill/index.js'\nimport { RenderCustomComponent } from '../../elements/RenderCustomComponent/index.js'\nimport { FieldDescription } from '../../fields/FieldDescription/index.js'\nimport { FieldLabel } from '../../fields/FieldLabel/index.js'\nimport { useFormSubmitted } from '../../forms/Form/context.js'\nimport { RenderFields } from '../../forms/RenderFields/index.js'\nimport { useField } from '../../forms/useField/index.js'\nimport { withCondition } from '../../forms/withCondition/index.js'\nimport { useTranslation } from '../../providers/Translation/index.js'\nimport { mergeFieldStyles } from '../mergeFieldStyles.js'\nimport './index.scss'\nimport { useRow } from '../Row/provider.js'\nimport { fieldBaseClass } from '../shared/index.js'\nimport { useTabs } from '../Tabs/provider.js'\nimport { GroupProvider, useGroup } from './provider.js'\n\nconst baseClass = 'group-field'\n\nexport const GroupFieldComponent: GroupFieldClientComponent = (props) => {\n const {\n field,\n field: { admin: { className, description, hideGutter } = {}, fields, label },\n indexPath,\n parentPath,\n parentSchemaPath,\n path,\n permissions,\n readOnly,\n schemaPath: schemaPathFromProps,\n } = props\n\n const schemaPath =\n schemaPathFromProps ?? (field.type === 'group' && groupHasName(field) ? field.name : path)\n\n const { i18n } = useTranslation()\n const { isWithinCollapsible } = useCollapsible()\n const isWithinGroup = useGroup()\n const isWithinRow = useRow()\n const isWithinTab = useTabs()\n\n const { customComponents: { AfterInput, BeforeInput, Description, Label } = {}, errorPaths } =\n useField({ path })\n\n const submitted = useFormSubmitted()\n const errorCount = errorPaths.length\n const fieldHasErrors = submitted && errorCount > 0\n\n const isTopLevel = !(isWithinCollapsible || isWithinGroup || isWithinRow)\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n return (\n <div\n className={[\n fieldBaseClass,\n baseClass,\n isTopLevel && `${baseClass}--top-level`,\n isWithinCollapsible && `${baseClass}--within-collapsible`,\n isWithinGroup && `${baseClass}--within-group`,\n isWithinRow && `${baseClass}--within-row`,\n isWithinTab && `${baseClass}--within-tab`,\n !hideGutter && isWithinGroup && `${baseClass}--gutter`,\n fieldHasErrors && `${baseClass}--has-error`,\n className,\n ]\n .filter(Boolean)\n .join(' ')}\n id={`field-${path?.replace(/\\./g, '__')}`}\n style={styles}\n >\n <GroupProvider>\n <div className={`${baseClass}__wrap`}>\n {Boolean(Label || Description || label || fieldHasErrors) && (\n <div className={`${baseClass}__header`}>\n {Boolean(Label || Description || label) && (\n <header>\n <RenderCustomComponent\n CustomComponent={Label}\n Fallback={\n <h3 className={`${baseClass}__title`}>\n <FieldLabel\n as=\"span\"\n label={getTranslation(label, i18n)}\n localized={false}\n path={path}\n required={false}\n />\n </h3>\n }\n />\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </header>\n )}\n {fieldHasErrors && <ErrorPill count={errorCount} i18n={i18n} withMessage />}\n </div>\n )}\n {BeforeInput}\n {/* Render an unnamed group differently */}\n {groupHasName(field) ? (\n <RenderFields\n fields={fields}\n margins=\"small\"\n parentIndexPath=\"\"\n parentPath={path}\n parentSchemaPath={schemaPath}\n permissions={permissions === true ? permissions : permissions?.fields}\n readOnly={readOnly}\n />\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 )}\n </div>\n </GroupProvider>\n {AfterInput}\n </div>\n )\n}\n\nexport { GroupProvider, useGroup }\n\nexport const GroupField = withCondition(GroupFieldComponent)\n"],"mappings":"AAAA;;;AAIA,SAASA,cAAc,QAAQ;AAC/B,SAASC,YAAY,QAAQ;AAC7B,OAAOC,KAAA,IAASC,OAAO,QAAQ;AAE/B,SAASC,cAAc,QAAQ;AAC/B,SAASC,SAAS,QAAQ;AAC1B,SAASC,qBAAqB,QAAQ;AACtC,SAASC,gBAAgB,QAAQ;AACjC,SAASC,UAAU,QAAQ;AAC3B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,YAAY,QAAQ;AAC7B,SAASC,QAAQ,QAAQ;AACzB,SAASC,aAAa,QAAQ;AAC9B,SAASC,cAAc,QAAQ;AAC/B,SAASC,gBAAgB,QAAQ;AACjC,OAAO;AACP,SAASC,MAAM,QAAQ;AACvB,SAASC,cAAc,QAAQ;AAC/B,SAASC,OAAO,QAAQ;AACxB,SAASC,aAAa,EAAEC,QAAQ,QAAQ;AAExC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,mBAAA,GAAkDC,KAAA;E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