@payloadcms/next 3.0.0-beta.95 → 3.0.0-beta.97
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.
- package/dist/elements/DocumentHeader/Tabs/Tab/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js +4 -4
- package/dist/elements/DocumentHeader/Tabs/Tab/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/index.js +10 -4
- package/dist/elements/DocumentHeader/Tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.js.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js +2 -2
- package/dist/elements/DocumentHeader/Tabs/tabs/index.js.map +1 -1
- package/dist/elements/DocumentHeader/index.d.ts.map +1 -1
- package/dist/elements/DocumentHeader/index.js.map +1 -1
- package/dist/elements/EmailAndUsername/index.d.ts +1 -1
- package/dist/elements/EmailAndUsername/index.d.ts.map +1 -1
- package/dist/elements/EmailAndUsername/index.js.map +1 -1
- package/dist/elements/LeaveWithoutSaving/index.d.ts.map +1 -1
- package/dist/elements/LeaveWithoutSaving/index.js.map +1 -1
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.d.ts.map +1 -1
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js +3 -1
- package/dist/elements/LeaveWithoutSaving/usePreventLeave.js.map +1 -1
- package/dist/elements/Logo/index.js +1 -1
- package/dist/elements/Logo/index.js.map +1 -1
- package/dist/elements/Nav/index.client.d.ts.map +1 -1
- package/dist/elements/Nav/index.client.js +1 -1
- package/dist/elements/Nav/index.client.js.map +1 -1
- package/dist/elements/Nav/index.d.ts.map +1 -1
- package/dist/elements/Nav/index.js +1 -1
- package/dist/elements/Nav/index.js.map +1 -1
- package/dist/exports/layouts.d.ts +1 -1
- package/dist/exports/layouts.d.ts.map +1 -1
- package/dist/exports/layouts.js +1 -1
- package/dist/exports/layouts.js.map +1 -1
- package/dist/exports/views.d.ts +1 -1
- package/dist/exports/views.d.ts.map +1 -1
- package/dist/exports/views.js +1 -1
- package/dist/exports/views.js.map +1 -1
- package/dist/fetchAPI-multipart/fileFactory.d.ts +2 -1
- package/dist/fetchAPI-multipart/fileFactory.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/fileFactory.js.map +1 -1
- package/dist/fetchAPI-multipart/handlers.d.ts +1 -1
- package/dist/fetchAPI-multipart/handlers.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/handlers.js +3 -1
- package/dist/fetchAPI-multipart/handlers.js.map +1 -1
- package/dist/fetchAPI-multipart/index.d.ts +1 -101
- package/dist/fetchAPI-multipart/index.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/index.js.map +1 -1
- package/dist/fetchAPI-multipart/processMultipart.d.ts +2 -1
- package/dist/fetchAPI-multipart/processMultipart.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/processMultipart.js +1 -0
- package/dist/fetchAPI-multipart/processMultipart.js.map +1 -1
- package/dist/fetchAPI-multipart/processNested.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/processNested.js +8 -4
- package/dist/fetchAPI-multipart/processNested.js.map +1 -1
- package/dist/fetchAPI-multipart/uploadTimer.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/uploadTimer.js +3 -1
- package/dist/fetchAPI-multipart/uploadTimer.js.map +1 -1
- package/dist/fetchAPI-multipart/utilities.d.ts +1 -1
- package/dist/fetchAPI-multipart/utilities.d.ts.map +1 -1
- package/dist/fetchAPI-multipart/utilities.js +32 -12
- package/dist/fetchAPI-multipart/utilities.js.map +1 -1
- package/dist/layouts/Root/index.js +2 -2
- package/dist/layouts/Root/index.js.map +1 -1
- package/dist/prod/styles.css +1 -1
- package/dist/routes/rest/collections/updateByID.d.ts.map +1 -1
- package/dist/routes/rest/collections/updateByID.js +6 -2
- package/dist/routes/rest/collections/updateByID.js.map +1 -1
- package/dist/routes/rest/files/checkFileAccess.d.ts.map +1 -1
- package/dist/routes/rest/files/checkFileAccess.js +4 -2
- package/dist/routes/rest/files/checkFileAccess.js.map +1 -1
- package/dist/routes/rest/files/getFile.d.ts.map +1 -1
- package/dist/routes/rest/files/getFile.js +6 -2
- package/dist/routes/rest/files/getFile.js.map +1 -1
- package/dist/routes/rest/globals/update.d.ts.map +1 -1
- package/dist/routes/rest/globals/update.js +6 -2
- package/dist/routes/rest/globals/update.js.map +1 -1
- package/dist/routes/rest/index.d.ts.map +1 -1
- package/dist/routes/rest/index.js +42 -14
- package/dist/routes/rest/index.js.map +1 -1
- package/dist/routes/rest/og/image.d.ts +1 -1
- package/dist/routes/rest/og/image.d.ts.map +1 -1
- package/dist/routes/rest/og/image.js +7 -7
- package/dist/routes/rest/og/image.js.map +1 -1
- package/dist/routes/rest/og/index.js +2 -2
- package/dist/routes/rest/og/index.js.map +1 -1
- package/dist/routes/rest/utilities/sanitizeCollectionID.d.ts.map +1 -1
- package/dist/routes/rest/utilities/sanitizeCollectionID.js +6 -2
- package/dist/routes/rest/utilities/sanitizeCollectionID.js.map +1 -1
- package/dist/templates/Default/Wrapper/index.scss +0 -1
- package/dist/templates/Default/index.d.ts.map +1 -1
- package/dist/templates/Default/index.js +1 -1
- package/dist/templates/Default/index.js.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.d.ts.map +1 -1
- package/dist/utilities/addDataAndFileToRequest.js.map +1 -1
- package/dist/utilities/addLocalesToRequest.d.ts.map +1 -1
- package/dist/utilities/addLocalesToRequest.js +6 -2
- package/dist/utilities/addLocalesToRequest.js.map +1 -1
- package/dist/utilities/createPayloadRequest.d.ts.map +1 -1
- package/dist/utilities/createPayloadRequest.js +9 -3
- package/dist/utilities/createPayloadRequest.js.map +1 -1
- package/dist/utilities/getPayloadHMR.js.map +1 -1
- package/dist/utilities/getRequestTheme.d.ts.map +1 -1
- package/dist/utilities/getRequestTheme.js.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.d.ts.map +1 -1
- package/dist/utilities/initPage/handleAuthRedirect.js +3 -1
- package/dist/utilities/initPage/handleAuthRedirect.js.map +1 -1
- package/dist/utilities/initPage/index.d.ts.map +1 -1
- package/dist/utilities/initPage/index.js +3 -1
- package/dist/utilities/initPage/index.js.map +1 -1
- package/dist/utilities/timestamp.d.ts.map +1 -1
- package/dist/utilities/timestamp.js +3 -1
- package/dist/utilities/timestamp.js.map +1 -1
- package/dist/views/API/RenderJSON/index.d.ts +1 -1
- package/dist/views/API/RenderJSON/index.d.ts.map +1 -1
- package/dist/views/API/RenderJSON/index.js.map +1 -1
- package/dist/views/API/index.client.d.ts.map +1 -1
- package/dist/views/API/index.client.js.map +1 -1
- package/dist/views/Account/Settings/index.d.ts.map +1 -1
- package/dist/views/Account/Settings/index.js.map +1 -1
- package/dist/views/Account/index.d.ts.map +1 -1
- package/dist/views/Account/index.js +1 -1
- package/dist/views/Account/index.js.map +1 -1
- package/dist/views/CreateFirstUser/index.client.d.ts +1 -1
- package/dist/views/CreateFirstUser/index.client.d.ts.map +1 -1
- package/dist/views/CreateFirstUser/index.client.js.map +1 -1
- package/dist/views/Dashboard/Default/index.js +4 -4
- package/dist/views/Dashboard/Default/index.js.map +1 -1
- package/dist/views/Dashboard/index.js +2 -2
- package/dist/views/Dashboard/index.js.map +1 -1
- package/dist/views/Document/getMetaBySegment.d.ts +2 -2
- package/dist/views/Document/getMetaBySegment.d.ts.map +1 -1
- package/dist/views/Document/getMetaBySegment.js.map +1 -1
- package/dist/views/Document/index.js +1 -1
- package/dist/views/Document/index.js.map +1 -1
- package/dist/views/Edit/Default/Auth/APIKey.js +3 -3
- package/dist/views/Edit/Default/Auth/APIKey.js.map +1 -1
- package/dist/views/Edit/Default/Auth/types.d.ts +1 -1
- package/dist/views/Edit/Default/Auth/types.d.ts.map +1 -1
- package/dist/views/Edit/Default/Auth/types.js.map +1 -1
- package/dist/views/Edit/Default/SetDocumentStepNav/index.d.ts.map +1 -1
- package/dist/views/Edit/Default/SetDocumentStepNav/index.js.map +1 -1
- package/dist/views/Edit/Default/index.d.ts.map +1 -1
- package/dist/views/Edit/Default/index.js +9 -5
- package/dist/views/Edit/Default/index.js.map +1 -1
- package/dist/views/ForgotPassword/index.js +1 -1
- package/dist/views/ForgotPassword/index.js.map +1 -1
- package/dist/views/List/Default/index.d.ts.map +1 -1
- package/dist/views/List/Default/index.js +105 -95
- package/dist/views/List/Default/index.js.map +1 -1
- package/dist/views/List/index.js +3 -3
- package/dist/views/List/index.js.map +1 -1
- package/dist/views/LivePreview/Context/context.d.ts +1 -1
- package/dist/views/LivePreview/Context/context.d.ts.map +1 -1
- package/dist/views/LivePreview/Context/context.js.map +1 -1
- package/dist/views/LivePreview/Context/index.d.ts.map +1 -1
- package/dist/views/LivePreview/Context/index.js +3 -1
- package/dist/views/LivePreview/Context/index.js.map +1 -1
- package/dist/views/LivePreview/Device/index.d.ts.map +1 -1
- package/dist/views/LivePreview/Device/index.js +5 -1
- package/dist/views/LivePreview/Device/index.js.map +1 -1
- package/dist/views/LivePreview/Toolbar/Controls/index.js +1 -1
- package/dist/views/LivePreview/Toolbar/Controls/index.js.map +1 -1
- package/dist/views/LivePreview/Toolbar/SizeInput/index.d.ts.map +1 -1
- package/dist/views/LivePreview/Toolbar/SizeInput/index.js.map +1 -1
- package/dist/views/LivePreview/index.client.d.ts.map +1 -1
- package/dist/views/LivePreview/index.client.js +2 -2
- package/dist/views/LivePreview/index.client.js.map +1 -1
- package/dist/views/LivePreview/usePopupWindow.d.ts +1 -1
- package/dist/views/LivePreview/usePopupWindow.d.ts.map +1 -1
- package/dist/views/LivePreview/usePopupWindow.js.map +1 -1
- package/dist/views/Login/LoginForm/index.d.ts.map +1 -1
- package/dist/views/Login/LoginForm/index.js.map +1 -1
- package/dist/views/Login/index.d.ts.map +1 -1
- package/dist/views/Login/index.js +1 -1
- package/dist/views/Login/index.js.map +1 -1
- package/dist/views/Logout/LogoutClient.js +1 -1
- package/dist/views/Logout/LogoutClient.js.map +1 -1
- package/dist/views/Logout/index.d.ts.map +1 -1
- package/dist/views/Logout/index.js.map +1 -1
- package/dist/views/NotFound/index.client.js +1 -1
- package/dist/views/NotFound/index.client.js.map +1 -1
- package/dist/views/ResetPassword/index.js +1 -1
- package/dist/views/ResetPassword/index.js.map +1 -1
- package/dist/views/Root/getViewFromConfig.js +2 -2
- package/dist/views/Root/getViewFromConfig.js.map +1 -1
- package/dist/views/Root/index.js +1 -1
- package/dist/views/Root/index.js.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.d.ts.map +1 -1
- package/dist/views/Root/isPathMatchingRoute.js +6 -2
- package/dist/views/Root/isPathMatchingRoute.js.map +1 -1
- package/dist/views/Unauthorized/index.js +1 -1
- package/dist/views/Unauthorized/index.js.map +1 -1
- package/dist/views/Verify/index.d.ts.map +1 -1
- package/dist/views/Verify/index.js +6 -4
- package/dist/views/Verify/index.js.map +1 -1
- package/dist/views/Version/Default/index.d.ts.map +1 -1
- package/dist/views/Version/Default/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js +4 -2
- package/dist/views/Version/RenderFieldsToDiff/fields/Iterable/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Nested/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js +3 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Select/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js +9 -3
- package/dist/views/Version/RenderFieldsToDiff/fields/Text/index.js.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.d.ts.map +1 -1
- package/dist/views/Version/RenderFieldsToDiff/index.js +7 -3
- package/dist/views/Version/RenderFieldsToDiff/index.js.map +1 -1
- package/dist/views/Version/SelectComparison/index.d.ts.map +1 -1
- package/dist/views/Version/SelectComparison/index.js +4 -2
- package/dist/views/Version/SelectComparison/index.js.map +1 -1
- package/dist/views/Version/SelectLocales/index.d.ts.map +1 -1
- package/dist/views/Version/SelectLocales/index.js.map +1 -1
- package/dist/views/Versions/buildColumns.js +8 -8
- package/dist/views/Versions/buildColumns.js.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.d.ts.map +1 -1
- package/dist/views/Versions/cells/CreatedAt/index.js.map +1 -1
- package/dist/views/Versions/index.client.d.ts.map +1 -1
- package/dist/views/Versions/index.client.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/DocumentHeader/Tabs/Tab/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAGlE,OAAO,KAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/DocumentHeader/Tabs/Tab/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAA;AAGlE,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,cAAc,CAAA;AAGrB,eAAO,MAAM,SAAS,YAAY,CAAA;AAElC,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAChC;IAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;CAAE,GAAG,iBAAiB,GAAG,gBAAgB,CAqF9E,CAAA"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getCreateMappedComponent, RenderComponent } from '@payloadcms/ui/shared';
|
|
3
3
|
import React, { Fragment } from 'react';
|
|
4
4
|
import { DocumentTabLink } from './TabLink.js';
|
|
5
5
|
export const baseClass = 'doc-tab';
|
|
6
6
|
export const DocumentTab = props => {
|
|
7
7
|
const {
|
|
8
|
-
Pill,
|
|
9
|
-
Pill_Component,
|
|
10
8
|
apiURL,
|
|
11
9
|
collectionConfig,
|
|
12
10
|
condition,
|
|
@@ -17,7 +15,9 @@ export const DocumentTab = props => {
|
|
|
17
15
|
label,
|
|
18
16
|
newTab,
|
|
19
17
|
payload,
|
|
20
|
-
permissions
|
|
18
|
+
permissions,
|
|
19
|
+
Pill,
|
|
20
|
+
Pill_Component
|
|
21
21
|
} = props;
|
|
22
22
|
const {
|
|
23
23
|
config
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["getCreateMappedComponent","RenderComponent","React","Fragment","DocumentTabLink","baseClass","DocumentTab","props","apiURL","collectionConfig","condition","globalConfig","href","tabHref","i18n","isActive","tabIsActive","label","newTab","payload","permissions","Pill","Pill_Component","config","routes","collection","global","meetsCondition","Boolean","labelToRender","t","createMappedComponent","importMap","serverProps","mappedPin","undefined","_jsx","adminRoute","admin","ariaLabel","isCollection","_jsxs","className","mappedComponent"],"sources":["../../../../../src/elements/DocumentHeader/Tabs/Tab/index.tsx"],"sourcesContent":["import type { DocumentTabConfig, DocumentTabProps } from 'payload'\n\nimport { getCreateMappedComponent, RenderComponent } from '@payloadcms/ui/shared'\nimport React, { Fragment } from 'react'\n\nimport './index.scss'\nimport { DocumentTabLink } from './TabLink.js'\n\nexport const baseClass = 'doc-tab'\n\nexport const DocumentTab: React.FC<\n { readonly Pill_Component?: React.FC } & DocumentTabConfig & DocumentTabProps\n> = (props) => {\n const {\n apiURL,\n collectionConfig,\n condition,\n globalConfig,\n href: tabHref,\n i18n,\n isActive: tabIsActive,\n label,\n newTab,\n payload,\n permissions,\n Pill,\n Pill_Component,\n } = props\n const { config } = payload\n const { routes } = config\n\n let href = typeof tabHref === 'string' ? tabHref : ''\n let isActive = typeof tabIsActive === 'boolean' ? tabIsActive : false\n\n if (typeof tabHref === 'function') {\n href = tabHref({\n apiURL,\n collection: collectionConfig,\n global: globalConfig,\n routes,\n })\n }\n\n if (typeof tabIsActive === 'function') {\n isActive = tabIsActive({\n href,\n })\n }\n\n const meetsCondition =\n !condition ||\n (condition && Boolean(condition({ collectionConfig, config, globalConfig, permissions })))\n\n if (meetsCondition) {\n const labelToRender =\n typeof label === 'function'\n ? label({\n t: i18n.t,\n })\n : label\n\n const createMappedComponent = getCreateMappedComponent({\n importMap: payload.importMap,\n serverProps: {\n i18n,\n payload,\n permissions,\n },\n })\n\n const mappedPin = createMappedComponent(Pill, undefined, Pill_Component, 'Pill')\n\n return (\n <DocumentTabLink\n adminRoute={routes.admin}\n ariaLabel={labelToRender}\n baseClass={baseClass}\n href={href}\n isActive={isActive}\n isCollection={!!collectionConfig && !globalConfig}\n newTab={newTab}\n >\n <span className={`${baseClass}__label`}>\n {labelToRender}\n {mappedPin && (\n <Fragment>\n \n <RenderComponent mappedComponent={mappedPin} />\n </Fragment>\n )}\n </span>\n </DocumentTabLink>\n )\n }\n\n return null\n}\n"],"mappings":";AAEA,SAASA,wBAAwB,EAAEC,eAAe,QAAQ;AAC1D,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAGhC,SAASC,eAAe,QAAQ;AAEhC,OAAO,MAAMC,SAAA,GAAY;AAEzB,OAAO,MAAMC,WAAA,GAERC,KAAA;EACH,MAAM;IACJC,MAAM;IACNC,gBAAgB;IAChBC,SAAS;IACTC,YAAY;IACZC,IAAA,EAAMC,OA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;MACXO,IAAA,EAAMA,IAAA;MACNG,QAAA,EAAUA,QAAA;MACVyB,YAAA,EAAc,CAAC,CAAC/B,gBAAA,IAAoB,CAACE,YAAA;MACrCO,MAAA,EAAQA,MAAA;gBAER,aAAAuB,KAAA,CAAC;QAAKC,SAAA,EAAW,GAAGrC,SAAA,SAAkB;mBACnCwB,aAAA,EACAK,SAAA,iBACCO,KAAA,CAACtC,QAAA;qBAAS,K,aAERiC,IAAA,CAACnC,eAAA;YAAgB0C,eAAA,EAAiBT;;;;;EAM9C;EAEA,OAAO;AACT","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/DocumentHeader/Tabs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/elements/DocumentHeader/Tabs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,OAAO,cAAc,CAAA;AAOrB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC;IAClC,gBAAgB,EAAE,yBAAyB,CAAA;IAC3C,YAAY,EAAE,qBAAqB,CAAA;IACnC,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,WAAW,CAAA;CACzB,CAwGA,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { getCreateMappedComponent, RenderComponent } from '@payloadcms/ui/shared';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { ShouldRenderTabs } from './ShouldRenderTabs.js';
|
|
5
|
-
import { DocumentTab } from './Tab/index.js';
|
|
6
4
|
import { getCustomViews } from './getCustomViews.js';
|
|
7
5
|
import { getViewConfig } from './getViewConfig.js';
|
|
6
|
+
import { ShouldRenderTabs } from './ShouldRenderTabs.js';
|
|
7
|
+
import { DocumentTab } from './Tab/index.js';
|
|
8
8
|
import { tabs as defaultTabs } from './tabs/index.js';
|
|
9
9
|
const baseClass = 'doc-tabs';
|
|
10
10
|
export const DocumentTabs = props => {
|
|
@@ -30,7 +30,13 @@ export const DocumentTabs = props => {
|
|
|
30
30
|
children: /*#__PURE__*/_jsxs("ul", {
|
|
31
31
|
className: `${baseClass}__tabs`,
|
|
32
32
|
children: [Object.entries(defaultTabs)?.sort(([, a], [, b]) => {
|
|
33
|
-
if (a.order === undefined && b.order === undefined)
|
|
33
|
+
if (a.order === undefined && b.order === undefined) {
|
|
34
|
+
return 0;
|
|
35
|
+
} else if (a.order === undefined) {
|
|
36
|
+
return 1;
|
|
37
|
+
} else if (b.order === undefined) {
|
|
38
|
+
return -1;
|
|
39
|
+
}
|
|
34
40
|
return a.order - b.order;
|
|
35
41
|
})?.map(([name, tab], index) => {
|
|
36
42
|
const viewConfig = getViewConfig({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["getCreateMappedComponent","RenderComponent","React","getCustomViews","getViewConfig","ShouldRenderTabs","DocumentTab","tabs","defaultTabs","baseClass","DocumentTabs","props","collectionConfig","globalConfig","i18n","payload","permissions","config","customViews","_jsx","className","_jsxs","Object","entries","sort","a","b","order","undefined","map","name","tab","index","viewConfig","tabFromConfig","condition","meetsCondition","Boolean","CustomView","path","Component","createMappedComponent","importMap","serverProps","key","mappedTab","clientProps","mappedComponent"],"sources":["../../../../src/elements/DocumentHeader/Tabs/index.tsx"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n Payload,\n Permissions,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport { getCreateMappedComponent, RenderComponent } from '@payloadcms/ui/shared'\nimport React from 'react'\n\nimport { getCustomViews } from './getCustomViews.js'\nimport { getViewConfig } from './getViewConfig.js'\nimport './index.scss'\nimport { ShouldRenderTabs } from './ShouldRenderTabs.js'\nimport { DocumentTab } from './Tab/index.js'\nimport { tabs as defaultTabs } from './tabs/index.js'\n\nconst baseClass = 'doc-tabs'\n\nexport const DocumentTabs: React.FC<{\n collectionConfig: SanitizedCollectionConfig\n globalConfig: SanitizedGlobalConfig\n i18n: I18n\n payload: Payload\n permissions: Permissions\n}> = (props) => {\n const { collectionConfig, globalConfig, i18n, payload, permissions } = props\n const { config } = payload\n\n const customViews = getCustomViews({ collectionConfig, globalConfig })\n\n return (\n <ShouldRenderTabs>\n <div className={baseClass}>\n <div className={`${baseClass}__tabs-container`}>\n <ul className={`${baseClass}__tabs`}>\n {Object.entries(defaultTabs)\n // sort `defaultViews` based on `order` property from smallest to largest\n // if no `order`, append the view to the end\n // TODO: open `order` to the config and merge `defaultViews` with `customViews`\n ?.sort(([, a], [, b]) => {\n if (a.order === undefined && b.order === undefined) {\n return 0\n } else if (a.order === undefined) {\n return 1\n } else if (b.order === undefined) {\n return -1\n }\n return a.order - b.order\n })\n ?.map(([name, tab], index) => {\n const viewConfig = getViewConfig({ name, collectionConfig, globalConfig })\n const tabFromConfig = viewConfig && 'tab' in viewConfig ? viewConfig.tab : undefined\n\n const { condition } = tabFromConfig || {}\n\n const meetsCondition =\n !condition ||\n (condition &&\n Boolean(condition({ collectionConfig, config, globalConfig, permissions })))\n\n if (meetsCondition) {\n return (\n <DocumentTab\n key={`tab-${index}`}\n {...{\n ...props,\n ...(tab || {}),\n ...(tabFromConfig || {}),\n }}\n />\n )\n }\n\n return null\n })}\n {customViews?.map((CustomView, index) => {\n if ('tab' in CustomView) {\n const { path, tab } = CustomView\n\n if (tab.Component) {\n const createMappedComponent = getCreateMappedComponent({\n importMap: payload.importMap,\n serverProps: {\n i18n,\n payload,\n permissions,\n ...props,\n key: `tab-custom-${index}`,\n path,\n },\n })\n\n const mappedTab = createMappedComponent(\n tab.Component,\n undefined,\n undefined,\n 'tab.Component',\n )\n\n return (\n <RenderComponent\n clientProps={{\n key: `tab-custom-${index}`,\n path,\n }}\n key={`tab-custom-${index}`}\n mappedComponent={mappedTab}\n />\n )\n }\n\n return (\n <DocumentTab\n key={`tab-custom-${index}`}\n {...{\n ...props,\n ...tab,\n }}\n />\n )\n }\n return null\n })}\n </ul>\n </div>\n </div>\n </ShouldRenderTabs>\n )\n}\n"],"mappings":";AAQA,SAASA,wBAAwB,EAAEC,eAAe,QAAQ;AAC1D,OAAOC,KAAA,MAAW;AAElB,SAASC,cAAc,QAAQ;AAC/B,SAASC,aAAa,QAAQ;AAE9B,SAASC,gBAAgB,QAAQ;AACjC,SAASC,WAAW,QAAQ;AAC5B,SAASC,IAAA,IAAQC,WAAW,QAAQ;AAEpC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,YAAA,GAMPC,KAAA;EACJ,MAAM;IAAEC,gBAAgB;IAAEC,YAAY;IAAEC,IAAI;IAAEC,OAAO;IAAEC;EAAW,CAAE,GAAGL,KAAA;EACvE,MAAM;IAAEM;EAAM,CAAE,GAAGF,OAAA;EAEnB,MAAMG,WAAA,GAAcf,cAAA,CAAe;IAAES,gBAAA;IAAkBC;EAAa;EAEpE,oBACEM,IAAA,CAACd,gBAAA;cACC,aAAAc,IAAA,CAAC;MAAIC,SAAA,EAAWX,SAAA;gBACd,aAAAU,IAAA,CAAC;QAAIC,SAAA,EAAW,GAAGX,SAAA,kBAA2B;kBAC5C,aAAAY,KAAA,CAAC;UAAG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ER;cAAG,CAAE,GAAGO,UAAA;cAEtB,IAAIP,GAAA,CAAIS,SAAS,EAAE;gBACjB,MAAMC,qBAAA,GAAwBzC,wBAAA,CAAyB;kBACrD0C,SAAA,EAAW3B,OAAA,CAAQ2B,SAAS;kBAC5BC,WAAA,EAAa;oBACX7B,IAAA;oBACAC,OAAA;oBACAC,WAAA;oBACA,GAAGL,KAAK;oBACRiC,GAAA,EAAK,cAAcZ,KAAA,EAAO;oBAC1BO;kBACF;gBACF;gBAEA,MAAMM,SAAA,GAAYJ,qBAAA,CAChBV,GAAA,CAAIS,SAAS,EACbZ,SAAA,EACAA,SAAA,EACA;gBAGF,oBACET,IAAA,CAAClB,eAAA;kBACC6C,WAAA,EAAa;oBACXF,GAAA,EAAK,cAAcZ,KAAA,EAAO;oBAC1BO;kBACF;kBAEAQ,eAAA,EAAiBF;mBADZ,cAAcb,KAAA,EAAO;cAIhC;cAEA,oBACEb,IAAA,CAACb,WAAA;gBAGG,GAAGK,KAAK;gBACR,GAAGoB;iBAHA,cAAcC,KAAA,EAAO;YAOhC;YACA,OAAO;UACT;;;;;AAMZ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAmBhC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","useDocumentInfo","React","baseClass","VersionsPill","$","versions","hasVersions","totalDocs","t0","t1","filter","Boolean","t2","join","t3","_jsx","className","children","toString"],"sources":["../../../../../../src/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.tsx"],"sourcesContent":["'use client'\nimport { useDocumentInfo } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { baseClass } from '../../Tab/index.js'\n\nexport const VersionsPill: React.FC = () => {\n const { versions } = useDocumentInfo()\n\n // To prevent CLS (versions are currently loaded client-side), render non-breaking space if there are no versions\n // The pill is already conditionally rendered to begin with based on whether the document is version-enabled\n // documents that are version enabled _always_ have at least one version\n const hasVersions = versions?.totalDocs > 0\n\n if (hasVersions)\n return (\n <span\n className={[`${baseClass}__count`, hasVersions ? `${baseClass}__count--has-count` : '']\n .filter(Boolean)\n .join(' ')}\n >\n {versions.totalDocs.toString()}\n </span>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,eAAe,QAAQ;AAChC,OAAOC,KAAA,MAAW;AAElB,SAASC,SAAS,QAAQ;AAE1B,OAAO,MAAMC,YAAA,GAAyBA,CAAA;EAAA,MAAAC,CAAA,GAAAL,EAAA;EACpC;IAAAM;EAAA,IAAqBL,eAAA;EAKrB,MAAAM,WAAA,GAAoBD,QAAA,EAAAE,SAAA,IAAsB;EAAA,IAEtCD,WAAA;IAGqC,MAAAE,EAAA,GAAAF,WAAA,GAAc,GAAAJ,SAAA,oBAAgC,GAAG;IAAA,IAAAO,EAAA;IAAA,IAAAL,CAAA,QAAAI,EAAA;MAAzEC,EAAA,IAAC,GAAAP,SAAA,SAAqB,EAAEM,EAAiD,EAAAE,MAAA,CAAAC,OAC1E;MAAAP,CAAA,MAAAI,EAAA;MAAAJ,CAAA,MAAAK,EAAA;IAAA;MAAAA,EAAA,GAAAL,CAAA;IAAA;IADC,MAAAQ,EAAA,GAAAH,EACD,CAAAI,IAAA,CACF;IAAA,IAAAC,EAAA;IAAA,IAAAV,CAAA,QAAAC,QAAA,CAAAE,SAAA,IAAAH,CAAA,QAAAQ,EAAA;MAHVE,EAAA,GAAAC,IAAA,CAAC;QAAAC,SAAA,EACYJ,EAEH;QAAAK,QAAA,EAEPZ,QAAA,CAAAE,SAAA,CAAAW,QAAA,CAA2B;MAAA,C;;;;;;;WAL9BJ,E;;
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","useDocumentInfo","React","baseClass","VersionsPill","$","versions","hasVersions","totalDocs","t0","t1","filter","Boolean","t2","join","t3","_jsx","className","children","toString"],"sources":["../../../../../../src/elements/DocumentHeader/Tabs/tabs/VersionsPill/index.tsx"],"sourcesContent":["'use client'\nimport { useDocumentInfo } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { baseClass } from '../../Tab/index.js'\n\nexport const VersionsPill: React.FC = () => {\n const { versions } = useDocumentInfo()\n\n // To prevent CLS (versions are currently loaded client-side), render non-breaking space if there are no versions\n // The pill is already conditionally rendered to begin with based on whether the document is version-enabled\n // documents that are version enabled _always_ have at least one version\n const hasVersions = versions?.totalDocs > 0\n\n if (hasVersions) {\n return (\n <span\n className={[`${baseClass}__count`, hasVersions ? `${baseClass}__count--has-count` : '']\n .filter(Boolean)\n .join(' ')}\n >\n {versions.totalDocs.toString()}\n </span>\n )\n }\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,eAAe,QAAQ;AAChC,OAAOC,KAAA,MAAW;AAElB,SAASC,SAAS,QAAQ;AAE1B,OAAO,MAAMC,YAAA,GAAyBA,CAAA;EAAA,MAAAC,CAAA,GAAAL,EAAA;EACpC;IAAAM;EAAA,IAAqBL,eAAA;EAKrB,MAAAM,WAAA,GAAoBD,QAAA,EAAAE,SAAA,IAAsB;EAAA,IAEtCD,WAAA;IAGqC,MAAAE,EAAA,GAAAF,WAAA,GAAc,GAAAJ,SAAA,oBAAgC,GAAG;IAAA,IAAAO,EAAA;IAAA,IAAAL,CAAA,QAAAI,EAAA;MAAzEC,EAAA,IAAC,GAAAP,SAAA,SAAqB,EAAEM,EAAiD,EAAAE,MAAA,CAAAC,OAC1E;MAAAP,CAAA,MAAAI,EAAA;MAAAJ,CAAA,MAAAK,EAAA;IAAA;MAAAA,EAAA,GAAAL,CAAA;IAAA;IADC,MAAAQ,EAAA,GAAAH,EACD,CAAAI,IAAA,CACF;IAAA,IAAAC,EAAA;IAAA,IAAAV,CAAA,QAAAC,QAAA,CAAAE,SAAA,IAAAH,CAAA,QAAAQ,EAAA;MAHVE,EAAA,GAAAC,IAAA,CAAC;QAAAC,SAAA,EACYJ,EAEH;QAAAK,QAAA,EAEPZ,QAAA,CAAAE,SAAA,CAAAW,QAAA,CAA2B;MAAA,C;;;;;;;WAL9BJ,E;;CASN","ignoreList":[]}
|
|
@@ -3,7 +3,7 @@ import type React from 'react';
|
|
|
3
3
|
export declare const documentViewKeys: string[];
|
|
4
4
|
export type DocumentViewKey = (typeof documentViewKeys)[number];
|
|
5
5
|
export declare const tabs: Record<DocumentViewKey, {
|
|
6
|
-
Pill_Component?: React.FC;
|
|
7
6
|
order?: number;
|
|
7
|
+
Pill_Component?: React.FC;
|
|
8
8
|
} & DocumentTabConfig>;
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/DocumentHeader/Tabs/tabs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,eAAO,MAAM,gBAAgB,UAQ5B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/D,eAAO,MAAM,IAAI,EAAE,MAAM,CACvB,eAAe,EACf;IACE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/DocumentHeader/Tabs/tabs/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAChD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,eAAO,MAAM,gBAAgB,UAQ5B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/D,eAAO,MAAM,IAAI,EAAE,MAAM,CACvB,eAAe,EACf;IACE,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,KAAK,CAAC,EAAE,CAAA;CAC1B,GAAG,iBAAiB,CA6DtB,CAAA"}
|
|
@@ -49,7 +49,6 @@ export const tabs = {
|
|
|
49
49
|
condition: () => false
|
|
50
50
|
},
|
|
51
51
|
versions: {
|
|
52
|
-
Pill_Component: VersionsPill,
|
|
53
52
|
condition: ({
|
|
54
53
|
collectionConfig,
|
|
55
54
|
globalConfig,
|
|
@@ -59,7 +58,8 @@ export const tabs = {
|
|
|
59
58
|
label: ({
|
|
60
59
|
t
|
|
61
60
|
}) => t('version:versions'),
|
|
62
|
-
order: 200
|
|
61
|
+
order: 200,
|
|
62
|
+
Pill_Component: VersionsPill
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["VersionsPill","documentViewKeys","tabs","api","condition","collectionConfig","globalConfig","admin","hideAPIURL","href","label","order","default","t","livePreview","config","Boolean","collections","includes","slug","globals","references","relationships","version","versions","
|
|
1
|
+
{"version":3,"file":"index.js","names":["VersionsPill","documentViewKeys","tabs","api","condition","collectionConfig","globalConfig","admin","hideAPIURL","href","label","order","default","t","livePreview","config","Boolean","collections","includes","slug","globals","references","relationships","version","versions","permissions","readVersions","permission","Pill_Component"],"sources":["../../../../../src/elements/DocumentHeader/Tabs/tabs/index.tsx"],"sourcesContent":["import type { DocumentTabConfig } from 'payload'\nimport type React from 'react'\n\nimport { VersionsPill } from './VersionsPill/index.js'\n\nexport const documentViewKeys = [\n 'api',\n 'default',\n 'livePreview',\n 'references',\n 'relationships',\n 'version',\n 'versions',\n]\n\nexport type DocumentViewKey = (typeof documentViewKeys)[number]\n\nexport const tabs: Record<\n DocumentViewKey,\n {\n order?: number // TODO: expose this to the globalConfig config\n Pill_Component?: React.FC\n } & DocumentTabConfig\n> = {\n api: {\n condition: ({ collectionConfig, globalConfig }) =>\n (collectionConfig && !collectionConfig?.admin?.hideAPIURL) ||\n (globalConfig && !globalConfig?.admin?.hideAPIURL),\n href: '/api',\n label: 'API',\n order: 1000,\n },\n default: {\n href: '',\n // isActive: ({ href, location }) =>\n // location.pathname === href || location.pathname === `${href}/create`,\n label: ({ t }) => t('general:edit'),\n order: 0,\n },\n livePreview: {\n condition: ({ collectionConfig, config, globalConfig }) => {\n if (collectionConfig) {\n return Boolean(\n config?.admin?.livePreview?.collections?.includes(collectionConfig.slug) ||\n collectionConfig?.admin?.livePreview,\n )\n }\n\n if (globalConfig) {\n return Boolean(\n config?.admin?.livePreview?.globals?.includes(globalConfig.slug) ||\n globalConfig?.admin?.livePreview,\n )\n }\n\n return false\n },\n href: '/preview',\n label: ({ t }) => t('general:livePreview'),\n order: 100,\n },\n references: {\n condition: () => false,\n },\n relationships: {\n condition: () => false,\n },\n version: {\n condition: () => false,\n },\n versions: {\n condition: ({ collectionConfig, globalConfig, permissions }) =>\n Boolean(\n (collectionConfig?.versions &&\n permissions?.collections?.[collectionConfig?.slug]?.readVersions?.permission) ||\n (globalConfig?.versions &&\n permissions?.globals?.[globalConfig?.slug]?.readVersions?.permission),\n ),\n href: '/versions',\n label: ({ t }) => t('version:versions'),\n order: 200,\n Pill_Component: VersionsPill,\n },\n}\n"],"mappings":"AAGA,SAASA,YAAY,QAAQ;AAE7B,OAAO,MAAMC,gBAAA,GAAmB,CAC9B,OACA,WACA,eACA,cACA,iBACA,WACA,WACD;AAID,OAAO,MAAMC,IAAA,GAMT;EACFC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W,CAAE,KACzDT,OAAA,CACEX,gBAAC,EAAkBmB,QAAA,IACjBC,WAAA,EAAaR,WAAA,GAAcZ,gBAAA,EAAkBc,IAAA,CAAK,EAAEO,YAAA,EAAcC,UAAA,IACjErB,YAAA,EAAckB,QAAA,IACbC,WAAA,EAAaL,OAAA,GAAUd,YAAA,EAAca,IAAA,CAAK,EAAEO,YAAA,EAAcC,UAAA;IAElElB,IAAA,EAAM;IACNC,KAAA,EAAOA,CAAC;MAAEG;IAAC,CAAE,KAAKA,CAAA,CAAE;IACpBF,KAAA,EAAO;IACPiB,cAAA,EAAgB5B;EAClB;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/DocumentHeader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAmB,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/DocumentHeader/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAA;AACpD,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,yBAAyB,EACzB,qBAAqB,EACtB,MAAM,SAAS,CAAA;AAGhB,OAAO,KAAmB,MAAM,OAAO,CAAA;AAEvC,OAAO,cAAc,CAAA;AAKrB,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC;IACpC,gBAAgB,CAAC,EAAE,yBAAyB,CAAA;IAC5C,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC9B,YAAY,CAAC,EAAE,qBAAqB,CAAA;IACpC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,WAAW,CAAA;CACzB,CAuBA,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Gutter","RenderTitle","React","Fragment","DocumentTabs","baseClass","DocumentHeader","props","collectionConfig","customHeader","globalConfig","hideTabs","i18n","payload","permissions","_jsxs","className","_jsx"],"sources":["../../../src/elements/DocumentHeader/index.tsx"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n Payload,\n Permissions,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport { Gutter, RenderTitle } from '@payloadcms/ui'\nimport React, { Fragment } from 'react'\n\nimport { DocumentTabs } from './Tabs/index.js'\
|
|
1
|
+
{"version":3,"file":"index.js","names":["Gutter","RenderTitle","React","Fragment","DocumentTabs","baseClass","DocumentHeader","props","collectionConfig","customHeader","globalConfig","hideTabs","i18n","payload","permissions","_jsxs","className","_jsx"],"sources":["../../../src/elements/DocumentHeader/index.tsx"],"sourcesContent":["import type { I18n } from '@payloadcms/translations'\nimport type {\n Payload,\n Permissions,\n SanitizedCollectionConfig,\n SanitizedGlobalConfig,\n} from 'payload'\n\nimport { Gutter, RenderTitle } from '@payloadcms/ui'\nimport React, { Fragment } from 'react'\n\nimport './index.scss'\nimport { DocumentTabs } from './Tabs/index.js'\n\nconst baseClass = `doc-header`\n\nexport const DocumentHeader: React.FC<{\n collectionConfig?: SanitizedCollectionConfig\n customHeader?: React.ReactNode\n globalConfig?: SanitizedGlobalConfig\n hideTabs?: boolean\n i18n: I18n\n payload: Payload\n permissions: Permissions\n}> = (props) => {\n const { collectionConfig, customHeader, globalConfig, hideTabs, i18n, payload, permissions } =\n props\n\n return (\n <Gutter className={baseClass}>\n {customHeader && customHeader}\n {!customHeader && (\n <Fragment>\n <RenderTitle className={`${baseClass}__title`} />\n {!hideTabs && (\n <DocumentTabs\n collectionConfig={collectionConfig}\n globalConfig={globalConfig}\n i18n={i18n}\n payload={payload}\n permissions={permissions}\n />\n )}\n </Fragment>\n )}\n </Gutter>\n )\n}\n"],"mappings":";AAQA,SAASA,MAAM,EAAEC,WAAW,QAAQ;AACpC,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAGhC,SAASC,YAAY,QAAQ;AAE7B,MAAMC,SAAA,GAAY,YAAY;AAE9B,OAAO,MAAMC,cAAA,GAQPC,KAAA;EACJ,MAAM;IAAEC,gBAAgB;IAAEC,YAAY;IAAEC,YAAY;IAAEC,QAAQ;IAAEC,IAAI;IAAEC,OAAO;IAAEC;EAAW,CAAE,GAC1FP,KAAA;EAEF,oBACEQ,KAAA,CAACf,MAAA;IAAOgB,SAAA,EAAWX,SAAA;eAChBI,YAAA,IAAgBA,YAAA,EAChB,CAACA,YAAA,iBACAM,KAAA,CAACZ,QAAA;8BACCc,IAAA,CAAChB,WAAA;QAAYe,SAAA,EAAW,GAAGX,SAAA;UAC1B,CAACM,QAAA,iBACAM,IAAA,CAACb,YAAA;QACCI,gBAAA,EAAkBA,gBAAA;QAClBE,YAAA,EAAcA,YAAA;QACdE,IAAA,EAAMA,IAAA;QACNC,OAAA,EAASA,OAAA;QACTC,WAAA,EAAaA;;;;AAO3B","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import type { FieldPermissions, LoginWithUsernameOptions } from 'payload';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
type RenderEmailAndUsernameFieldsProps = {
|
|
4
4
|
className?: string;
|
|
5
|
-
loginWithUsername?:
|
|
5
|
+
loginWithUsername?: false | LoginWithUsernameOptions;
|
|
6
6
|
operation?: 'create' | 'update';
|
|
7
7
|
permissions?: {
|
|
8
8
|
[fieldName: string]: FieldPermissions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/EmailAndUsername/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAIzE,OAAO,KAAK,MAAM,OAAO,CAAA;AAqDzB,KAAK,iCAAiC,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iBAAiB,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/EmailAndUsername/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAIzE,OAAO,KAAK,MAAM,OAAO,CAAA;AAqDzB,KAAK,iCAAiC,GAAG;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,iBAAiB,CAAC,EAAE,KAAK,GAAG,wBAAwB,CAAA;IACpD,SAAS,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;IAC/B,WAAW,CAAC,EAAE;QACZ,CAAC,SAAS,EAAE,MAAM,GAAG,gBAAgB,CAAA;KACtC,CAAA;IACD,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA;AACD,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,iCAAiC,qBA6CpF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","EmailField","RenderFields","TextField","useTranslation","email","username","React","EmailFieldComponent","props","$","loginWithUsername","t","requireEmail","showEmailField","allowEmailLogin","t0","_jsx","autoComplete","field","name","label","required","validate","UsernameFieldComponent","requireUsername","showUsernameField","Boolean","RenderEmailAndUsernameFields","className","operation","permissions","readOnly","fields","type","admin","components","Field","Component","RenderedComponent","localized","forceRender","path","schemaPath"],"sources":["../../../src/elements/EmailAndUsername/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldPermissions, LoginWithUsernameOptions } from 'payload'\n\nimport { EmailField, RenderFields, TextField, useTranslation } from '@payloadcms/ui'\nimport { email, username } from 'payload/shared'\nimport React from 'react'\n\ntype Props = {\n readonly loginWithUsername?:
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","EmailField","RenderFields","TextField","useTranslation","email","username","React","EmailFieldComponent","props","$","loginWithUsername","t","requireEmail","showEmailField","allowEmailLogin","t0","_jsx","autoComplete","field","name","label","required","validate","UsernameFieldComponent","requireUsername","showUsernameField","Boolean","RenderEmailAndUsernameFields","className","operation","permissions","readOnly","fields","type","admin","components","Field","Component","RenderedComponent","localized","forceRender","path","schemaPath"],"sources":["../../../src/elements/EmailAndUsername/index.tsx"],"sourcesContent":["'use client'\n\nimport type { FieldPermissions, LoginWithUsernameOptions } from 'payload'\n\nimport { EmailField, RenderFields, TextField, useTranslation } from '@payloadcms/ui'\nimport { email, username } from 'payload/shared'\nimport React from 'react'\n\ntype Props = {\n readonly loginWithUsername?: false | LoginWithUsernameOptions\n}\nfunction EmailFieldComponent(props: Props) {\n const { loginWithUsername } = props\n const { t } = useTranslation()\n\n const requireEmail = !loginWithUsername || (loginWithUsername && loginWithUsername.requireEmail)\n const showEmailField =\n !loginWithUsername || loginWithUsername?.requireEmail || loginWithUsername?.allowEmailLogin\n\n if (showEmailField) {\n return (\n <EmailField\n autoComplete=\"off\"\n field={{\n name: 'email',\n label: t('general:email'),\n required: requireEmail,\n }}\n validate={email}\n />\n )\n }\n\n return null\n}\n\nfunction UsernameFieldComponent(props: Props) {\n const { loginWithUsername } = props\n const { t } = useTranslation()\n\n const requireUsername = loginWithUsername && loginWithUsername.requireUsername\n const showUsernameField = Boolean(loginWithUsername)\n\n if (showUsernameField) {\n return (\n <TextField\n field={{\n name: 'username',\n label: t('authentication:username'),\n required: requireUsername,\n }}\n validate={username}\n />\n )\n }\n\n return null\n}\n\ntype RenderEmailAndUsernameFieldsProps = {\n className?: string\n loginWithUsername?: false | LoginWithUsernameOptions\n operation?: 'create' | 'update'\n permissions?: {\n [fieldName: string]: FieldPermissions\n }\n readOnly: boolean\n}\nexport function RenderEmailAndUsernameFields(props: RenderEmailAndUsernameFieldsProps) {\n const { className, loginWithUsername, operation, permissions, readOnly } = props\n\n return (\n <RenderFields\n className={className}\n fields={[\n {\n name: 'email',\n type: 'text',\n admin: {\n autoComplete: 'off',\n components: {\n Field: {\n type: 'client',\n Component: null,\n RenderedComponent: <EmailFieldComponent loginWithUsername={loginWithUsername} />,\n },\n },\n },\n localized: false,\n },\n {\n name: 'username',\n type: 'text',\n admin: {\n components: {\n Field: {\n type: 'client',\n Component: null,\n RenderedComponent: <UsernameFieldComponent loginWithUsername={loginWithUsername} />,\n },\n },\n },\n localized: false,\n },\n ]}\n forceRender\n operation={operation}\n path=\"\"\n permissions={permissions}\n readOnly={readOnly}\n schemaPath=\"\"\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,UAAU,EAAEC,YAAY,EAAEC,SAAS,EAAEC,cAAc,QAAQ;AACpE,SAASC,KAAK,EAAEC,QAAQ,QAAQ;AAChC,OAAOC,KAAA,MAAW;AAKlB,SAAAC,oBAAAC,KAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EACE;IAAAW;EAAA,IAA8BF,KAAA;EAC9B;IAAAG;EAAA,IAAcR,cAAA;EAEd,MAAAS,YAAA,GAAqB,CAACF,iBAAA,IAAsBA,iBAAA,IAAqBA,iBAAA,CAAAE,YAA8B;EAC/F,MAAAC,cAAA,GACE,CAACH,iBAAA,IAAqBA,iBAAA,EAAAE,YAAmB,IAAgBF,iBAAA,EAAAI,eAAmB;EAAA,IAE1ED,cAAA;IAAA,IAAAE,EAAA;IAAA,IAAAN,CAAA,QAAAE,CAAA,IAAAF,CAAA,QAAAG,YAAA;MAEAG,EAAA,GAAAC,IAAA,CAAAhB,UAAA;QAAAiB,YAAA,EACe;QAAAC,KAAA;UAAAC,IAAA,EAEL;UAAAC,KAAA,EACCT,CAAA,CAAE;UAAAU,QAAA,EACCT;QAAA;QAAAU,QAAA,EAAAlB;MAAA,C;;;;;;;WALdW,E;;;;AAeN,SAAAQ,uBAAAf,KAAA;EAAA,MAAAC,CAAA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WA,SAAA;IACXY,IAAA,EAAK;IACLX,WAAA,EAAaA,WAAA;IACbC,QAAA,EAAUA,QAAA;IACVW,UAAA,EAAW;;AAGjB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/LeaveWithoutSaving/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAErD,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/LeaveWithoutSaving/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAiC,MAAM,OAAO,CAAA;AAErD,OAAO,cAAc,CAAA;AAkDrB,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EA8BtC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["c","_c","Button","Modal","useAuth","useFormModified","useModal","useTranslation","React","useCallback","useEffect","usePreventLeave","modalSlug","baseClass","Component","t0","$","isActive","onCancel","onConfirm","closeModal","openModal","t","t1","t2","t3","_jsx","className","onClose","slug","children","_jsxs","buttonStyle","onClick","size","LeaveWithoutSaving","modified","user","show","setShow","useState","hasAccepted","setHasAccepted","prevent","Boolean","Symbol","for","onPrevent","handleAccept","onAccept","t4","t5"],"sources":["../../../src/elements/LeaveWithoutSaving/index.tsx"],"sourcesContent":["'use client'\nimport { Button, Modal, useAuth, useFormModified, useModal, useTranslation } from '@payloadcms/ui'\nimport React, { useCallback, useEffect } from 'react'\n\nimport './index.scss'\nimport { usePreventLeave } from './usePreventLeave.js'\n\nconst modalSlug = 'leave-without-saving'\n\nconst baseClass = 'leave-without-saving'\n\nconst Component: React.FC<{\n isActive: boolean\n onCancel: () => void\n onConfirm: () => void\n}> = ({ isActive, onCancel, onConfirm }) => {\n const { closeModal, modalState, openModal } = useModal()\n const { t } = useTranslation()\n\n // Manually check for modal state as 'esc' key will not trigger the nav inactivity\n // useEffect(() => {\n // if (!modalState?.[modalSlug]?.isOpen && isActive) {\n // onCancel()\n // }\n // }, [modalState, isActive, onCancel])\n\n useEffect(() => {\n if (isActive) openModal(modalSlug)\n else closeModal(modalSlug)\n }, [isActive, openModal, closeModal])\n\n return (\n <Modal className={baseClass} onClose={onCancel} slug={modalSlug}>\n <div className={`${baseClass}__wrapper`}>\n <div className={`${baseClass}__content`}>\n <h1>{t('general:leaveWithoutSaving')}</h1>\n <p>{t('general:changesNotSaved')}</p>\n </div>\n <div className={`${baseClass}__controls`}>\n <Button buttonStyle=\"secondary\" onClick={onCancel} size=\"large\">\n {t('general:stayOnThisPage')}\n </Button>\n <Button onClick={onConfirm} size=\"large\">\n {t('general:leaveAnyway')}\n </Button>\n </div>\n </div>\n </Modal>\n )\n}\n\nexport const LeaveWithoutSaving: React.FC = () => {\n const { closeModal } = useModal()\n const modified = useFormModified()\n const { user } = useAuth()\n const [show, setShow] = React.useState(false)\n const [hasAccepted, setHasAccepted] = React.useState(false)\n\n const prevent = Boolean(modified && user)\n\n const onPrevent = useCallback(() => {\n setShow(true)\n }, [])\n\n const handleAccept = useCallback(() => {\n closeModal(modalSlug)\n }, [closeModal])\n\n usePreventLeave({ hasAccepted, onAccept: handleAccept, onPrevent, prevent })\n\n return (\n <Component\n isActive={show}\n onCancel={() => {\n setShow(false)\n }}\n onConfirm={() => {\n setHasAccepted(true)\n }}\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAEC,eAAe,EAAEC,QAAQ,EAAEC,cAAc,QAAQ;AAClF,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,QAAQ;AAG9C,SAASC,eAAe,QAAQ;AAEhC,MAAMC,SAAA,GAAY;AAElB,MAAMC,SAAA,GAAY;AAElB,MAAMC,SAAA,GAIDC,EAAA;EAAA,MAAAC,CAAA,GAAAf,EAAA;EAAC;IAAAgB,QAAA;IAAAC,QAAA;IAAAC;EAAA,IAAAJ,EAAiC;EACrC;IAAAK,UAAA;IAAAC;EAAA,IAA8Cf,QAAA;EAC9C;IAAAgB;EAAA,IAAcf,cAAA;EAAA,IAAAgB,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAR,CAAA,QAAAC,QAAA,IAAAD,CAAA,QAAAK,SAAA,IAAAL,CAAA,QAAAI,UAAA;IASJG,EAAA,GAAAA,CAAA;MAAA,IACJN,QAAA;
|
|
1
|
+
{"version":3,"file":"index.js","names":["c","_c","Button","Modal","useAuth","useFormModified","useModal","useTranslation","React","useCallback","useEffect","usePreventLeave","modalSlug","baseClass","Component","t0","$","isActive","onCancel","onConfirm","closeModal","openModal","t","t1","t2","t3","_jsx","className","onClose","slug","children","_jsxs","buttonStyle","onClick","size","LeaveWithoutSaving","modified","user","show","setShow","useState","hasAccepted","setHasAccepted","prevent","Boolean","Symbol","for","onPrevent","handleAccept","onAccept","t4","t5"],"sources":["../../../src/elements/LeaveWithoutSaving/index.tsx"],"sourcesContent":["'use client'\nimport { Button, Modal, useAuth, useFormModified, useModal, useTranslation } from '@payloadcms/ui'\nimport React, { useCallback, useEffect } from 'react'\n\nimport './index.scss'\nimport { usePreventLeave } from './usePreventLeave.js'\n\nconst modalSlug = 'leave-without-saving'\n\nconst baseClass = 'leave-without-saving'\n\nconst Component: React.FC<{\n isActive: boolean\n onCancel: () => void\n onConfirm: () => void\n}> = ({ isActive, onCancel, onConfirm }) => {\n const { closeModal, modalState, openModal } = useModal()\n const { t } = useTranslation()\n\n // Manually check for modal state as 'esc' key will not trigger the nav inactivity\n // useEffect(() => {\n // if (!modalState?.[modalSlug]?.isOpen && isActive) {\n // onCancel()\n // }\n // }, [modalState, isActive, onCancel])\n\n useEffect(() => {\n if (isActive) {\n openModal(modalSlug)\n } else {\n closeModal(modalSlug)\n }\n }, [isActive, openModal, closeModal])\n\n return (\n <Modal className={baseClass} onClose={onCancel} slug={modalSlug}>\n <div className={`${baseClass}__wrapper`}>\n <div className={`${baseClass}__content`}>\n <h1>{t('general:leaveWithoutSaving')}</h1>\n <p>{t('general:changesNotSaved')}</p>\n </div>\n <div className={`${baseClass}__controls`}>\n <Button buttonStyle=\"secondary\" onClick={onCancel} size=\"large\">\n {t('general:stayOnThisPage')}\n </Button>\n <Button onClick={onConfirm} size=\"large\">\n {t('general:leaveAnyway')}\n </Button>\n </div>\n </div>\n </Modal>\n )\n}\n\nexport const LeaveWithoutSaving: React.FC = () => {\n const { closeModal } = useModal()\n const modified = useFormModified()\n const { user } = useAuth()\n const [show, setShow] = React.useState(false)\n const [hasAccepted, setHasAccepted] = React.useState(false)\n\n const prevent = Boolean(modified && user)\n\n const onPrevent = useCallback(() => {\n setShow(true)\n }, [])\n\n const handleAccept = useCallback(() => {\n closeModal(modalSlug)\n }, [closeModal])\n\n usePreventLeave({ hasAccepted, onAccept: handleAccept, onPrevent, prevent })\n\n return (\n <Component\n isActive={show}\n onCancel={() => {\n setShow(false)\n }}\n onConfirm={() => {\n setHasAccepted(true)\n }}\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AACA,SAASC,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAEC,eAAe,EAAEC,QAAQ,EAAEC,cAAc,QAAQ;AAClF,OAAOC,KAAA,IAASC,WAAW,EAAEC,SAAS,QAAQ;AAG9C,SAASC,eAAe,QAAQ;AAEhC,MAAMC,SAAA,GAAY;AAElB,MAAMC,SAAA,GAAY;AAElB,MAAMC,SAAA,GAIDC,EAAA;EAAA,MAAAC,CAAA,GAAAf,EAAA;EAAC;IAAAgB,QAAA;IAAAC,QAAA;IAAAC;EAAA,IAAAJ,EAAiC;EACrC;IAAAK,UAAA;IAAAC;EAAA,IAA8Cf,QAAA;EAC9C;IAAAgB;EAAA,IAAcf,cAAA;EAAA,IAAAgB,EAAA;EAAA,IAAAC,EAAA;EAAA,IAAAR,CAAA,QAAAC,QAAA,IAAAD,CAAA,Q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AAA,MAAAQ,EAAA;EAAA;IAAAA,EAAA,GAAAR,CAAA;EAAA;EAA1EL,eAAA,CAAgBa,EAA0D;EAAA,IAAAC,EAAA;EAAA,IAAAyB,EAAA;EAAA,IAAAlC,CAAA,QAAA6B,MAAA,CAAAC,GAAA;IAK5DrB,EAAA,GAAAA,CAAA;MACRc,OAAA,MAAQ;IAAA;IAECW,EAAA,GAAAA,CAAA;MACTR,cAAA,KAAe;IAAA;IACjB1B,CAAA,MAAAS,EAAA;IAAAT,CAAA,MAAAkC,EAAA;EAAA;IAAAzB,EAAA,GAAAT,CAAA;IAAAkC,EAAA,GAAAlC,CAAA;EAAA;EAAA,IAAAmC,EAAA;EAAA,IAAAnC,CAAA,QAAAsB,IAAA;IAPFa,EAAA,GAAAzB,IAAA,CAAAZ,SAAA;MAAAG,QAAA,EACYqB,IAAA;MAAApB,QAAA,EACAO,EAEV;MAAAN,SAAA,EACW+B;IAEX,C;;;;;;SAPFC,E;CAUJ","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePreventLeave.d.ts","sourceRoot":"","sources":["../../../src/elements/LeaveWithoutSaving/usePreventLeave.tsx"],"names":[],"mappings":"AA0BA,eAAO,MAAM,eAAe,aAAa,CAAC,MAAM,OAAO,CAAC,GAAG,OAAO,YAAmB,MAAM,SA6B1F,CAAA;AAED,eAAO,MAAM,eAAe,4DAMzB;IACD,WAAW,EAAE,OAAO,CAAA;IAEpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IAErB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;CACjB,
|
|
1
|
+
{"version":3,"file":"usePreventLeave.d.ts","sourceRoot":"","sources":["../../../src/elements/LeaveWithoutSaving/usePreventLeave.tsx"],"names":[],"mappings":"AA0BA,eAAO,MAAM,eAAe,aAAa,CAAC,MAAM,OAAO,CAAC,GAAG,OAAO,YAAmB,MAAM,SA6B1F,CAAA;AAED,eAAO,MAAM,eAAe,4DAMzB;IACD,WAAW,EAAE,OAAO,CAAA;IAEpB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAA;IAErB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;IACtB,OAAO,EAAE,OAAO,CAAA;CACjB,SAkFA,CAAA"}
|
|
@@ -126,7 +126,9 @@ export const usePreventLeave = ({
|
|
|
126
126
|
}, [onPrevent, prevent, message]);
|
|
127
127
|
useEffect(() => {
|
|
128
128
|
if (hasAccepted && cancelledURL.current) {
|
|
129
|
-
if (onAccept)
|
|
129
|
+
if (onAccept) {
|
|
130
|
+
onAccept();
|
|
131
|
+
}
|
|
130
132
|
router.push(cancelledURL.current);
|
|
131
133
|
}
|
|
132
134
|
}, [hasAccepted, onAccept, router]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePreventLeave.js","names":["c","_c","useRouter","useCallback","useEffect","useRef","on","obj","args","addEventListener","off","removeEventListener","useBeforeUnload","t0","message","$","enabled","undefined","t1","event","finalEnabled","preventDefault","returnValue","handler","t2","t3","window","usePreventLeave","hasAccepted","onAccept","onPrevent","prevent","router","cancelledURL","isAnchorOfCurrentUrl","currentUrl","newUrl","currentUrlObj","URL","newUrlObj","hostname","pathname","search","currentHash","hash","newHash","href","replace","findClosestAnchor","element","tagName","toLowerCase","parentElement","handleClick","target","anchor","location","isAnchor","isDownloadLink","download","isPageLeaving","confirm","current","stopPropagation","err","alert","document","push"],"sources":["../../../src/elements/LeaveWithoutSaving/usePreventLeave.tsx"],"sourcesContent":["'use client'\n// Credit: @Taiki92777\n// - Source: https://github.com/vercel/next.js/discussions/32231#discussioncomment-7284386\n// Credit: `react-use` maintainers\n// - Source: https://github.com/streamich/react-use/blob/ade8d3905f544305515d010737b4ae604cc51024/src/useBeforeUnload.ts#L2\nimport { useRouter } from 'next/navigation.js'\nimport { useCallback, useEffect, useRef } from 'react'\n\nfunction on<T extends Document | EventTarget | HTMLElement | Window>(\n obj:
|
|
1
|
+
{"version":3,"file":"usePreventLeave.js","names":["c","_c","useRouter","useCallback","useEffect","useRef","on","obj","args","addEventListener","off","removeEventListener","useBeforeUnload","t0","message","$","enabled","undefined","t1","event","finalEnabled","preventDefault","returnValue","handler","t2","t3","window","usePreventLeave","hasAccepted","onAccept","onPrevent","prevent","router","cancelledURL","isAnchorOfCurrentUrl","currentUrl","newUrl","currentUrlObj","URL","newUrlObj","hostname","pathname","search","currentHash","hash","newHash","href","replace","findClosestAnchor","element","tagName","toLowerCase","parentElement","handleClick","target","anchor","location","isAnchor","isDownloadLink","download","isPageLeaving","confirm","current","stopPropagation","err","alert","document","push"],"sources":["../../../src/elements/LeaveWithoutSaving/usePreventLeave.tsx"],"sourcesContent":["'use client'\n// Credit: @Taiki92777\n// - Source: https://github.com/vercel/next.js/discussions/32231#discussioncomment-7284386\n// Credit: `react-use` maintainers\n// - Source: https://github.com/streamich/react-use/blob/ade8d3905f544305515d010737b4ae604cc51024/src/useBeforeUnload.ts#L2\nimport { useRouter } from 'next/navigation.js'\nimport { useCallback, useEffect, useRef } from 'react'\n\nfunction on<T extends Document | EventTarget | HTMLElement | Window>(\n obj: null | T,\n ...args: [string, Function | null, ...any] | Parameters<T['addEventListener']>\n): void {\n if (obj && obj.addEventListener) {\n obj.addEventListener(...(args as Parameters<HTMLElement['addEventListener']>))\n }\n}\n\nfunction off<T extends Document | EventTarget | HTMLElement | Window>(\n obj: null | T,\n ...args: [string, Function | null, ...any] | Parameters<T['removeEventListener']>\n): void {\n if (obj && obj.removeEventListener) {\n obj.removeEventListener(...(args as Parameters<HTMLElement['removeEventListener']>))\n }\n}\n\nexport const useBeforeUnload = (enabled: (() => boolean) | boolean = true, message?: string) => {\n const handler = useCallback(\n (event: BeforeUnloadEvent) => {\n const finalEnabled = typeof enabled === 'function' ? enabled() : true\n\n if (!finalEnabled) {\n return\n }\n\n event.preventDefault()\n\n if (message) {\n event.returnValue = message\n }\n\n return message\n },\n [enabled, message],\n )\n\n useEffect(() => {\n if (!enabled) {\n return\n }\n\n on(window, 'beforeunload', handler)\n\n return () => off(window, 'beforeunload', handler)\n }, [enabled, handler])\n}\n\nexport const usePreventLeave = ({\n hasAccepted = false,\n message = 'Are you sure want to leave this page?',\n onAccept,\n onPrevent,\n prevent = true,\n}: {\n hasAccepted: boolean\n // if no `onPrevent` is provided, the message will be displayed in a confirm dialog\n message?: string\n onAccept?: () => void\n // to use a custom confirmation dialog, provide a function that returns a boolean\n onPrevent?: () => void\n prevent: boolean\n}) => {\n // check when page is about to be reloaded\n useBeforeUnload(prevent, message)\n\n const router = useRouter()\n const cancelledURL = useRef<string>('')\n\n // check when page is about to be changed\n useEffect(() => {\n function isAnchorOfCurrentUrl(currentUrl: string, newUrl: string) {\n const currentUrlObj = new URL(currentUrl)\n const newUrlObj = new URL(newUrl)\n // Compare hostname, pathname, and search parameters\n if (\n currentUrlObj.hostname === newUrlObj.hostname &&\n currentUrlObj.pathname === newUrlObj.pathname &&\n currentUrlObj.search === newUrlObj.search\n ) {\n // Check if the new URL is just an anchor of the current URL page\n const currentHash = currentUrlObj.hash\n const newHash = newUrlObj.hash\n return (\n currentHash !== newHash &&\n currentUrlObj.href.replace(currentHash, '') === newUrlObj.href.replace(newHash, '')\n )\n }\n return false\n }\n\n function findClosestAnchor(element: HTMLElement | null): HTMLAnchorElement | null {\n while (element && element.tagName.toLowerCase() !== 'a') {\n element = element.parentElement\n }\n return element as HTMLAnchorElement\n }\n function handleClick(event: MouseEvent) {\n try {\n const target = event.target as HTMLElement\n const anchor = findClosestAnchor(target)\n if (anchor) {\n const currentUrl = window.location.href\n const newUrl = anchor.href\n const isAnchor = isAnchorOfCurrentUrl(currentUrl, newUrl)\n const isDownloadLink = anchor.download !== ''\n\n const isPageLeaving = !(newUrl === currentUrl || isAnchor || isDownloadLink)\n\n if (isPageLeaving && prevent && (!onPrevent ? !window.confirm(message) : true)) {\n // Keep a reference of the href\n cancelledURL.current = newUrl\n\n // Cancel the route change\n event.preventDefault()\n event.stopPropagation()\n\n if (typeof onPrevent === 'function') {\n onPrevent()\n }\n }\n }\n } catch (err) {\n alert(err)\n }\n }\n\n // Add the global click event listener\n document.addEventListener('click', handleClick, true)\n\n // Clean up the global click event listener when the component is unmounted\n return () => {\n document.removeEventListener('click', handleClick, true)\n }\n }, [onPrevent, prevent, message])\n\n useEffect(() => {\n if (hasAccepted && cancelledURL.current) {\n if (onAccept) {\n onAccept()\n }\n router.push(cancelledURL.current)\n }\n }, [hasAccepted, onAccept, router])\n}\n"],"mappings":"AAAA;;AACA;AACA;AACA;AACA;AAAA,SAAAA,CAAA,IAAAC,EAAA;AACA,SAASC,SAAS,QAAQ;AAC1B,SAASC,WAAW,EAAEC,SAAS,EAAEC,MAAM,QAAQ;AAE/C,SAASC,GACPC,GAAa,EACb,GAAGC,IAA2E;EAE9E,IAAID,GAAA,IAAOA,GAAA,CAAIE,gBAAgB,EAAE;IAC/BF,GAAA,CAAIE,gBAAgB,IAAKD,IAAA;EAC3B;AACF;AAEA,SAASE,IACPH,GAAa,EACb,GAAGC,IAA8E;EAEjF,IAAID,GAAA,IAAOA,GAAA,CAAII,mBAAmB,EAAE;IAClCJ,GAAA,CAAII,mBAAmB,IAAKH,IAAA;EAC9B;AACF;AAEA,OAAO,MAAMI,eAAA,GAAkBA,CAAAC,EAAA,EAAAC,OAAA;EAAA,MAAAC,CAAA,GAAAd,EAAA;EAAC,MAAAe,OAAA,GAAAH,EAAyC,KAAAI,SAAA,UAAzCJ,EAAyC;EAAA,IAAAK,EAAA;EAAA,IAAAH,CAAA,QAAAC,OAAA,IAAAD,CAAA,QAAAD,OAAA;IAErEI,EAAA,GAAAC,KAAA;MACE,MAAAC,YAAA,GAAqB,OAAOJ,OAAA,KAAY,aAAaA,OAAA,SAAY;MAAA,KAE5DI,YAAA;QAAA;MAAA;MAILD,KAAA,CAAAE,cAAA,CAAoB;MAAA,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;YAEvB;YACAjB,KAAA,CAAME,cAAc;YACpBF,KAAA,CAAM4C,eAAe;YAErB,IAAI,OAAOjC,SAAA,KAAc,YAAY;cACnCA,SAAA;YACF;UACF;QACF;MACF,EAAE,OAAOkC,GAAA,EAAK;QACZC,KAAA,CAAMD,GAAA;MACR;IACF;IAEA;IACAE,QAAA,CAASzD,gBAAgB,CAAC,SAAS4C,WAAA,EAAa;IAEhD;IACA,OAAO;MACLa,QAAA,CAASvD,mBAAmB,CAAC,SAAS0C,WAAA,EAAa;IACrD;EACF,GAAG,CAACvB,SAAA,EAAWC,OAAA,EAASjB,OAAA,CAAQ;EAEhCV,SAAA,CAAU;IACR,IAAIwB,WAAA,IAAeK,YAAA,CAAa6B,OAAO,EAAE;MACvC,IAAIjC,QAAA,EAAU;QACZA,QAAA;MACF;MACAG,MAAA,CAAOmC,IAAI,CAAClC,YAAA,CAAa6B,OAAO;IAClC;EACF,GAAG,CAAClC,WAAA,EAAaC,QAAA,EAAUG,MAAA,CAAO;AACpC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PayloadLogo, RenderComponent
|
|
2
|
+
import { getCreateMappedComponent, PayloadLogo, RenderComponent } from '@payloadcms/ui/shared';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
export const Logo = props => {
|
|
5
5
|
const {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["getCreateMappedComponent","PayloadLogo","RenderComponent","React","Logo","props","i18n","locale","params","payload","permissions","searchParams","user","admin","components","graphics","CustomLogo","undefined","config","createMappedComponent","importMap","serverProps","mappedCustomLogo","_jsx","mappedComponent"],"sources":["../../../src/elements/Logo/index.tsx"],"sourcesContent":["import type { ServerProps } from 'payload'\n\nimport { getCreateMappedComponent, PayloadLogo, RenderComponent } from '@payloadcms/ui/shared'\nimport React from 'react'\n\nexport const Logo: React.FC<ServerProps> = (props) => {\n const { i18n, locale, params, payload, permissions, searchParams, user } = props\n\n const {\n admin: {\n components: {\n graphics: { Logo: CustomLogo } = {\n Logo: undefined,\n },\n } = {},\n } = {},\n } = payload.config\n\n const createMappedComponent = getCreateMappedComponent({\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })\n\n const mappedCustomLogo = createMappedComponent(CustomLogo, undefined, PayloadLogo, 'CustomLogo')\n\n return <RenderComponent mappedComponent={mappedCustomLogo} />\n}\n"],"mappings":";AAEA,SAASA,wBAAwB,EAAEC,WAAW,EAAEC,eAAe,QAAQ;AACvE,OAAOC,KAAA,MAAW;AAElB,OAAO,MAAMC,IAAA,GAA+BC,KAAA;EAC1C,MAAM;IAAEC,IAAI;IAAEC,MAAM;IAAEC,MAAM;IAAEC,OAAO;IAAEC,WAAW;IAAEC,YAAY;IAAEC;EAAI,CAAE,GAAGP,KAAA;EAE3E,MAAM;IACJQ,KAAA,EAAO;MACLC,UAAA,EAAY;QACVC,QAAA,EAAU;UAAEX,IAAA,EAAMY;QAAU,CAAE,GAAG;UAC/BZ,IAAA,EAAMa;QACR;MAAC,CACF,GAAG,CAAC;IAAC,CACP,GAAG,CAAC;EAAC,CACP,GAAGR,OAAA,CAAQS,MAAM;EAElB,MAAMC,qBAAA,GAAwBnB,wBAAA,CAAyB;IACrDoB,SAAA,EAAWX,OAAA,CAAQW,SAAS;IAC5BC,WAAA,EAAa;MACXf,IAAA;MACAC,MAAA;MACAC,MAAA;MACAC,OAAA;MACAC,WAAA;MACAC,YAAA;MACAC;IACF;EACF;EAEA,MAAMU,gBAAA,GAAmBH,qBAAA,CAAsBH,UAAA,EAAYC,SAAA,EAAWhB,WAAA,EAAa;EAEnF,oBAAOsB,IAAA,CAACrB,eAAA;IAAgBsB,eAAA,EAAiBF;;AAC3C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/elements/Nav/index.client.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/elements/Nav/index.client.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EA4FpC,CAAA"}
|
|
@@ -103,7 +103,7 @@ export const DefaultNavClient = () => {
|
|
|
103
103
|
}
|
|
104
104
|
const Link = LinkWithDefault.default || LinkWithDefault;
|
|
105
105
|
const LinkElement = Link || "a";
|
|
106
|
-
const activeCollection = pathname.startsWith(href);
|
|
106
|
+
const activeCollection = pathname.startsWith(href) && ["/", undefined].includes(pathname[href.length]);
|
|
107
107
|
return _jsxs(LinkElement, {
|
|
108
108
|
className: [`${baseClass}__link`, activeCollection && `active`].filter(Boolean).join(" "),
|
|
109
109
|
href,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.js","names":["c","_c","getTranslation","NavGroup","useAuth","useConfig","useEntityVisibility","useNav","useTranslation","EntityType","formatAdminURL","groupNavItems","LinkWithDefault","usePathname","React","Fragment","baseClass","DefaultNavClient","$","permissions","isEntityVisible","pathname","config","t0","collections","globals","routes","t1","admin","adminRoute","i18n","navOpen","t2","t3","t4","slug","collectionSlug","t5","slug_0","globalSlug","groups","filter","map","_temp","_temp2","t6","key","entities","label","_jsx","children","t7","i","type","entity","entityLabel","href","id","collection","labels","plural","global","Link","default","LinkElement","activeCollection","startsWith","_jsxs","className","Boolean","join","tabIndex","
|
|
1
|
+
{"version":3,"file":"index.client.js","names":["c","_c","getTranslation","NavGroup","useAuth","useConfig","useEntityVisibility","useNav","useTranslation","EntityType","formatAdminURL","groupNavItems","LinkWithDefault","usePathname","React","Fragment","baseClass","DefaultNavClient","$","permissions","isEntityVisible","pathname","config","t0","collections","globals","routes","t1","admin","adminRoute","i18n","navOpen","t2","t3","t4","slug","collectionSlug","t5","slug_0","globalSlug","groups","filter","map","_temp","_temp2","t6","key","entities","label","_jsx","children","t7","i","type","entity","entityLabel","href","id","collection","labels","plural","global","Link","default","LinkElement","activeCollection","startsWith","undefined","includes","length","_jsxs","className","Boolean","join","tabIndex","entityToGroup","entityToGroup_0"],"sources":["../../../src/elements/Nav/index.client.tsx"],"sourcesContent":["'use client'\n\nimport type { EntityToGroup } from '@payloadcms/ui/shared'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n ChevronIcon,\n NavGroup,\n useAuth,\n useConfig,\n useEntityVisibility,\n useNav,\n useTranslation,\n} from '@payloadcms/ui'\nimport { EntityType, formatAdminURL, groupNavItems } from '@payloadcms/ui/shared'\nimport LinkWithDefault from 'next/link.js'\nimport { usePathname } from 'next/navigation.js'\nimport React, { Fragment } from 'react'\n\nconst baseClass = 'nav'\n\nexport const DefaultNavClient: React.FC = () => {\n const { permissions } = useAuth()\n const { isEntityVisible } = useEntityVisibility()\n const pathname = usePathname()\n\n const {\n config: {\n collections,\n globals,\n routes: { admin: adminRoute },\n },\n } = useConfig()\n\n const { i18n } = useTranslation()\n const { navOpen } = useNav()\n\n const groups = groupNavItems(\n [\n ...collections\n .filter(({ slug }) => isEntityVisible({ collectionSlug: slug }))\n .map((collection) => {\n const entityToGroup: EntityToGroup = {\n type: EntityType.collection,\n entity: collection,\n }\n\n return entityToGroup\n }),\n ...globals\n .filter(({ slug }) => isEntityVisible({ globalSlug: slug }))\n .map((global) => {\n const entityToGroup: EntityToGroup = {\n type: EntityType.global,\n entity: global,\n }\n\n return entityToGroup\n }),\n ],\n permissions,\n i18n,\n )\n\n return (\n <Fragment>\n {groups.map(({ entities, label }, key) => {\n return (\n <NavGroup key={key} label={label}>\n {entities.map(({ type, entity }, i) => {\n let entityLabel: string\n let href: string\n let id: string\n\n if (type === EntityType.collection) {\n href = formatAdminURL({ adminRoute, path: `/collections/${entity.slug}` })\n entityLabel = getTranslation(entity.labels.plural, i18n)\n id = `nav-${entity.slug}`\n }\n\n if (type === EntityType.global) {\n href = formatAdminURL({ adminRoute, path: `/globals/${entity.slug}` })\n entityLabel = getTranslation(entity.label, i18n)\n id = `nav-global-${entity.slug}`\n }\n\n const Link = (LinkWithDefault.default ||\n LinkWithDefault) as typeof LinkWithDefault.default\n\n const LinkElement = Link || 'a'\n const activeCollection =\n pathname.startsWith(href) && ['/', undefined].includes(pathname[href.length])\n\n return (\n <LinkElement\n className={[`${baseClass}__link`, activeCollection && `active`]\n .filter(Boolean)\n .join(' ')}\n href={href}\n id={id}\n key={i}\n tabIndex={!navOpen ? -1 : undefined}\n >\n {activeCollection && <div className={`${baseClass}__link-indicator`} />}\n <span className={`${baseClass}__link-label`}>{entityLabel}</span>\n </LinkElement>\n )\n })}\n </NavGroup>\n )\n })}\n </Fragment>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAIA,SAASC,cAAc,QAAQ;AAC/B,SAEEC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,cAAc,QACT;AACP,SAASC,UAAU,EAAEC,cAAc,EAAEC,aAAa,QAAQ;AAC1D,OAAOC,eAAA,MAAqB;AAC5B,SAASC,WAAW,QAAQ;AAC5B,OAAOC,KAAA,IAASC,QAAQ,QAAQ;AAEhC,MAAMC,SAAA,GAAY;AAElB,OAAO,MAAMC,gBAAA,GAA6BA,CAAA;EAAA,MAAAC,CAAA,GAAAjB,EAAA;EACxC;IAAAkB;EAAA,IAAwBf,OAAA;EACxB;IAAAgB;EAAA,IAA4Bd,mBAAA;EAC5B,MAAAe,QAAA,GAAiBR,WAAA;EAEjB;IAAAS,MAAA,EAAAC;EAAA,IAMIlB,SAAA;EALM;IAAAmB,WAAA;IAAAC,OAAA;IAAAC,MAAA,EAAAC;EAAA,IAAAJ,EAIP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E,WAAW,EAAE,MAAM,SAAS,CAAA;AAI1C,OAAO,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/Nav/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAI1C,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAQrB,MAAM,MAAM,QAAQ,GAAG,WAAW,CAAA;AAElC,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAwDzC,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Logout } from '@payloadcms/ui';
|
|
3
|
-
import {
|
|
3
|
+
import { getCreateMappedComponent, RenderComponent } from '@payloadcms/ui/shared';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import { NavHamburger } from './NavHamburger/index.js';
|
|
6
6
|
import { NavWrapper } from './NavWrapper/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Logout","
|
|
1
|
+
{"version":3,"file":"index.js","names":["Logout","getCreateMappedComponent","RenderComponent","React","NavHamburger","NavWrapper","baseClass","DefaultNavClient","DefaultNav","props","i18n","locale","params","payload","permissions","searchParams","user","config","admin","components","afterNavLinks","beforeNavLinks","createMappedComponent","importMap","serverProps","mappedBeforeNavLinks","undefined","mappedAfterNavLinks","_jsxs","className","_jsx","mappedComponent"],"sources":["../../../src/elements/Nav/index.tsx"],"sourcesContent":["import type { ServerProps } from 'payload'\n\nimport { Logout } from '@payloadcms/ui'\nimport { getCreateMappedComponent, RenderComponent } from '@payloadcms/ui/shared'\nimport React from 'react'\n\nimport './index.scss'\nimport { NavHamburger } from './NavHamburger/index.js'\nimport { NavWrapper } from './NavWrapper/index.js'\n\nconst baseClass = 'nav'\n\nimport { DefaultNavClient } from './index.client.js'\n\nexport type NavProps = ServerProps\n\nexport const DefaultNav: React.FC<NavProps> = (props) => {\n const { i18n, locale, params, payload, permissions, searchParams, user } = props\n\n if (!payload?.config) {\n return null\n }\n\n const {\n admin: {\n components: { afterNavLinks, beforeNavLinks },\n },\n } = payload.config\n\n const createMappedComponent = getCreateMappedComponent({\n importMap: payload.importMap,\n serverProps: {\n i18n,\n locale,\n params,\n payload,\n permissions,\n searchParams,\n user,\n },\n })\n\n const mappedBeforeNavLinks = createMappedComponent(\n beforeNavLinks,\n undefined,\n undefined,\n 'beforeNavLinks',\n )\n const mappedAfterNavLinks = createMappedComponent(\n afterNavLinks,\n undefined,\n undefined,\n 'afterNavLinks',\n )\n\n return (\n <NavWrapper baseClass={baseClass}>\n <nav className={`${baseClass}__wrap`}>\n <RenderComponent mappedComponent={mappedBeforeNavLinks} />\n <DefaultNavClient />\n <RenderComponent mappedComponent={mappedAfterNavLinks} />\n <div className={`${baseClass}__controls`}>\n <Logout />\n </div>\n </nav>\n <div className={`${baseClass}__header`}>\n <div className={`${baseClass}__header-content`}>\n <NavHamburger baseClass={baseClass} />\n </div>\n </div>\n </NavWrapper>\n )\n}\n"],"mappings":";AAEA,SAASA,MAAM,QAAQ;AACvB,SAASC,wBAAwB,EAAEC,eAAe,QAAQ;AAC1D,OAAOC,KAAA,MAAW;AAGlB,SAASC,YAAY,QAAQ;AAC7B,SAASC,UAAU,QAAQ;AAE3B,MAAMC,SAAA,GAAY;AAElB,SAASC,gBAAgB,QAAQ;AAIjC,OAAO,MAAMC,UAAA,GAAkCC,KAAA;EAC7C,MAAM;IAAEC,IAAI;IAAEC,MAAM;IAAEC,MAAM;IAAEC,OAAO;IAAEC,WAAW;IAAEC,YAAY;IAAEC;EAAI,CAAE,GAAGP,KAAA;EAE3E,IAAI,CAACI,OAAA,EAASI,MAAA,EAAQ;IACpB,OAAO;EACT;EAEA,MAAM;IACJC,KAAA,EAAO;MACLC,UAAA,EAAY;QAAEC,aAAa;QAAEC;MAAc;IAAE;EAC9C,CACF,GAAGR,OAAA,CAAQI,MAAM;EAElB,MAAMK,qBAAA,GAAwBrB,wBAAA,CAAyB;IACrDsB,SAAA,EAAWV,OAAA,CAAQU,SAAS;IAC5BC,WAAA,EAAa;MACXd,IAAA;MACAC,MAAA;MACAC,MAAA;MACAC,OAAA;MACAC,WAAA;MACAC,YAAA;MACAC;IACF;EACF;EAEA,MAAMS,oBAAA,GAAuBH,qBAAA,CAC3BD,cAAA,EACAK,SAAA,EACAA,SAAA,EACA;EAEF,MAAMC,mBAAA,GAAsBL,qBAAA,CAC1BF,aAAA,EACAM,SAAA,EACAA,SAAA,EACA;EAGF,oBACEE,KAAA,CAACvB,UAAA;IAAWC,SAAA,EAAWA,SAAA;4BACrBsB,KAAA,CAAC;MAAIC,SAAA,EAAW,GAAGvB,SAAA,QAAiB;8BAClCwB,IAAA,CAAC5B,eAAA;QAAgB6B,eAAA,EAAiBN;uBAClCK,IAAA,CAACvB,gBAAA,O,aACDuB,IAAA,CAAC5B,eAAA;QAAgB6B,eAAA,EAAiBJ;uBAClCG,IAAA,CAAC;QAAID,SAAA,EAAW,GAAGvB,SAAA,YAAqB;kBACtC,aAAAwB,IAAA,CAAC9B,MAAA;;qBAGL8B,IAAA,CAAC;MAAID,SAAA,EAAW,GAAGvB,SAAA,UAAmB;gBACpC,aAAAwB,IAAA,CAAC;QAAID,SAAA,EAAW,GAAGvB,SAAA,kBAA2B;kBAC5C,aAAAwB,IAAA,CAAC1B,YAAA;UAAaE,SAAA,EAAWA;;;;;AAKnC","ignoreList":[]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { metadata, RootLayout } from '../layouts/Root/index.js';
|
|
2
2
|
//# sourceMappingURL=layouts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layouts.d.ts","sourceRoot":"","sources":["../../src/exports/layouts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"layouts.d.ts","sourceRoot":"","sources":["../../src/exports/layouts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA"}
|
package/dist/exports/layouts.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { metadata, RootLayout } from '../layouts/Root/index.js';
|
|
2
2
|
//# sourceMappingURL=layouts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layouts.js","names":["
|
|
1
|
+
{"version":3,"file":"layouts.js","names":["metadata","RootLayout"],"sources":["../../src/exports/layouts.ts"],"sourcesContent":["export { metadata, RootLayout } from '../layouts/Root/index.js'\n"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,UAAU,QAAQ","ignoreList":[]}
|
package/dist/exports/views.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DefaultEditView as EditView } from '../views/Edit/Default/index.js';
|
|
2
2
|
export { DefaultListView as ListView } from '../views/List/Default/index.js';
|
|
3
3
|
export { NotFoundPage } from '../views/NotFound/index.js';
|
|
4
|
-
export { type GenerateViewMetadata, RootPage
|
|
4
|
+
export { generatePageMetadata, type GenerateViewMetadata, RootPage } from '../views/Root/index.js';
|
|
5
5
|
//# sourceMappingURL=views.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../../src/exports/views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,eAAe,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,KAAK,oBAAoB,EAAE,QAAQ,EAAE,
|
|
1
|
+
{"version":3,"file":"views.d.ts","sourceRoot":"","sources":["../../src/exports/views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,eAAe,IAAI,QAAQ,EAAE,MAAM,gCAAgC,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACzD,OAAO,EAAE,oBAAoB,EAAE,KAAK,oBAAoB,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA"}
|
package/dist/exports/views.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { DefaultEditView as EditView } from '../views/Edit/Default/index.js';
|
|
2
2
|
export { DefaultListView as ListView } from '../views/List/Default/index.js';
|
|
3
3
|
export { NotFoundPage } from '../views/NotFound/index.js';
|
|
4
|
-
export {
|
|
4
|
+
export { generatePageMetadata, RootPage } from '../views/Root/index.js';
|
|
5
5
|
//# sourceMappingURL=views.js.map
|