@payloadcms/next 3.0.0-beta.72 → 3.0.0-beta.73
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../src/elements/Nav/index.client.tsx"],"names":[],"mappings":"AAgBA,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":"AAgBA,OAAO,KAAmB,MAAM,OAAO,CAAA;AAIvC,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAgGpC,CAAA"}
|
|
@@ -58,8 +58,12 @@ export const DefaultNavClient = ()=>{
|
|
|
58
58
|
}
|
|
59
59
|
const Link = LinkWithDefault.default || LinkWithDefault;
|
|
60
60
|
const LinkElement = Link || 'a';
|
|
61
|
+
const activeCollection = window?.location?.pathname?.split('/').find((_, index, arr)=>arr[index - 1] === 'collections' || arr[index - 1] === 'globals');
|
|
61
62
|
return /*#__PURE__*/ _jsxs(LinkElement, {
|
|
62
|
-
className:
|
|
63
|
+
className: [
|
|
64
|
+
`${baseClass}__link`,
|
|
65
|
+
activeCollection === entity?.slug && `active`
|
|
66
|
+
].filter(Boolean).join(' '),
|
|
63
67
|
href: href,
|
|
64
68
|
id: id,
|
|
65
69
|
tabIndex: !navOpen ? -1 : undefined,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"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 React, { Fragment } from 'react'\n\nconst baseClass = 'nav'\n\nexport const DefaultNavClient: React.FC = () => {\n const { permissions } = useAuth()\n const { isEntityVisible } = useEntityVisibility()\n\n const {\n collections,\n globals,\n routes: { admin: adminRoute },\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\n return (\n <LinkElement\n className={`${baseClass}__link`}\n href={href}\n id={id}\n key={i}\n tabIndex={!navOpen ? -1 : undefined}\n >\n <span className={`${baseClass}__link-icon`}>\n <ChevronIcon direction=\"right\" />\n </span>\n <span className={`${baseClass}__link-label`}>{entityLabel}</span>\n </LinkElement>\n )\n })}\n </NavGroup>\n )\n })}\n </Fragment>\n )\n}\n"],"names":["getTranslation","ChevronIcon","NavGroup","useAuth","useConfig","useEntityVisibility","useNav","useTranslation","EntityType","formatAdminURL","groupNavItems","LinkWithDefault","React","Fragment","baseClass","DefaultNavClient","permissions","isEntityVisible","collections","globals","routes","admin","adminRoute","i18n","navOpen","groups","filter","slug","collectionSlug","map","collection","entityToGroup","type","entity","globalSlug","global","entities","label","key","i","entityLabel","href","id","path","labels","plural","Link","default","LinkElement","className","tabIndex","undefined","span","direction"],"mappings":"AAAA;;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SACEC,WAAW,EACXC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,cAAc,QACT,iBAAgB;AACvB,SAASC,UAAU,EAAEC,cAAc,EAAEC,aAAa,QAAQ,wBAAuB;AACjF,OAAOC,qBAAqB,eAAc;AAC1C,OAAOC,SAASC,QAAQ,QAAQ,QAAO;AAEvC,MAAMC,YAAY;AAElB,OAAO,MAAMC,mBAA6B;IACxC,MAAM,EAAEC,WAAW,EAAE,GAAGb;IACxB,MAAM,EAAEc,eAAe,EAAE,GAAGZ;IAE5B,MAAM,EACJa,WAAW,EACXC,OAAO,EACPC,QAAQ,EAAEC,OAAOC,UAAU,EAAE,EAC9B,GAAGlB;IAEJ,MAAM,EAAEmB,IAAI,EAAE,GAAGhB;IACjB,MAAM,EAAEiB,OAAO,EAAE,GAAGlB;IAEpB,MAAMmB,SAASf,cACb;WACKQ,YACAQ,MAAM,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKV,gBAAgB;gBAAEW,gBAAgBD;YAAK,IAC5DE,GAAG,CAAC,CAACC;YACJ,MAAMC,gBAA+B;gBACnCC,MAAMxB,WAAWsB,UAAU;gBAC3BG,QAAQH;YACV;YAEA,OAAOC;QACT;WACCZ,QACAO,MAAM,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKV,gBAAgB;gBAAEiB,YAAYP;YAAK,IACxDE,GAAG,CAAC,CAACM;YACJ,MAAMJ,gBAA+B;gBACnCC,MAAMxB,WAAW2B,MAAM;gBACvBF,QAAQE;YACV;YAEA,OAAOJ;QACT;KACH,EACDf,aACAO;IAGF,qBACE,KAACV;kBACEY,OAAOI,GAAG,CAAC,CAAC,EAAEO,QAAQ,EAAEC,KAAK,EAAE,EAAEC;YAChC,qBACE,KAACpC;gBAAmBmC,OAAOA;0BACxBD,SAASP,GAAG,CAAC,CAAC,EAAEG,IAAI,EAAEC,MAAM,EAAE,EAAEM;oBAC/B,IAAIC;oBACJ,IAAIC;oBACJ,IAAIC;oBAEJ,IAAIV,SAASxB,WAAWsB,UAAU,EAAE;wBAClCW,OAAOhC,eAAe;4BAAEa;4BAAYqB,MAAM,CAAC,aAAa,EAAEV,OAAON,IAAI,CAAC,CAAC;wBAAC;wBACxEa,cAAcxC,eAAeiC,OAAOW,MAAM,CAACC,MAAM,EAAEtB;wBACnDmB,KAAK,CAAC,IAAI,EAAET,OAAON,IAAI,CAAC,CAAC;oBAC3B;oBAEA,IAAIK,SAASxB,WAAW2B,MAAM,EAAE;wBAC9BM,OAAOhC,eAAe;4BAAEa;4BAAYqB,MAAM,CAAC,SAAS,EAAEV,OAAON,IAAI,CAAC,CAAC;wBAAC;wBACpEa,cAAcxC,eAAeiC,OAAOI,KAAK,EAAEd;wBAC3CmB,KAAK,CAAC,WAAW,EAAET,OAAON,IAAI,CAAC,CAAC;oBAClC;oBAEA,MAAMmB,OAAQnC,gBAAgBoC,OAAO,IACnCpC;oBAEF,MAAMqC,cAAcF,QAAQ;oBAE5B,qBACE,
|
|
1
|
+
{"version":3,"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 React, { Fragment } from 'react'\n\nconst baseClass = 'nav'\n\nexport const DefaultNavClient: React.FC = () => {\n const { permissions } = useAuth()\n const { isEntityVisible } = useEntityVisibility()\n\n const {\n collections,\n globals,\n routes: { admin: adminRoute },\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\n const activeCollection = window?.location?.pathname\n ?.split('/')\n .find(\n (_, index, arr) =>\n arr[index - 1] === 'collections' || arr[index - 1] === 'globals',\n )\n\n return (\n <LinkElement\n className={[`${baseClass}__link`, activeCollection === entity?.slug && `active`]\n .filter(Boolean)\n .join(' ')}\n href={href}\n id={id}\n key={i}\n tabIndex={!navOpen ? -1 : undefined}\n >\n <span className={`${baseClass}__link-icon`}>\n <ChevronIcon direction=\"right\" />\n </span>\n <span className={`${baseClass}__link-label`}>{entityLabel}</span>\n </LinkElement>\n )\n })}\n </NavGroup>\n )\n })}\n </Fragment>\n )\n}\n"],"names":["getTranslation","ChevronIcon","NavGroup","useAuth","useConfig","useEntityVisibility","useNav","useTranslation","EntityType","formatAdminURL","groupNavItems","LinkWithDefault","React","Fragment","baseClass","DefaultNavClient","permissions","isEntityVisible","collections","globals","routes","admin","adminRoute","i18n","navOpen","groups","filter","slug","collectionSlug","map","collection","entityToGroup","type","entity","globalSlug","global","entities","label","key","i","entityLabel","href","id","path","labels","plural","Link","default","LinkElement","activeCollection","window","location","pathname","split","find","_","index","arr","className","Boolean","join","tabIndex","undefined","span","direction"],"mappings":"AAAA;;AAIA,SAASA,cAAc,QAAQ,2BAA0B;AACzD,SACEC,WAAW,EACXC,QAAQ,EACRC,OAAO,EACPC,SAAS,EACTC,mBAAmB,EACnBC,MAAM,EACNC,cAAc,QACT,iBAAgB;AACvB,SAASC,UAAU,EAAEC,cAAc,EAAEC,aAAa,QAAQ,wBAAuB;AACjF,OAAOC,qBAAqB,eAAc;AAC1C,OAAOC,SAASC,QAAQ,QAAQ,QAAO;AAEvC,MAAMC,YAAY;AAElB,OAAO,MAAMC,mBAA6B;IACxC,MAAM,EAAEC,WAAW,EAAE,GAAGb;IACxB,MAAM,EAAEc,eAAe,EAAE,GAAGZ;IAE5B,MAAM,EACJa,WAAW,EACXC,OAAO,EACPC,QAAQ,EAAEC,OAAOC,UAAU,EAAE,EAC9B,GAAGlB;IAEJ,MAAM,EAAEmB,IAAI,EAAE,GAAGhB;IACjB,MAAM,EAAEiB,OAAO,EAAE,GAAGlB;IAEpB,MAAMmB,SAASf,cACb;WACKQ,YACAQ,MAAM,CAAC,CAAC,EAAEC,IAAI,EAAE,GAAKV,gBAAgB;gBAAEW,gBAAgBD;YAAK,IAC5DE,GAAG,CAAC,CAACC;YACJ,MAAMC,gBAA+B;gBACnCC,MAAMxB,WAAWsB,UAAU;gBAC3BG,QAAQH;YACV;YAEA,OAAOC;QACT;WACC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7D,qBACE,MAACR;wBACCU,WAAW;4BAAC,CAAC,EAAE5C,UAAU,MAAM,CAAC;4BAAEmC,qBAAqBhB,QAAQN,QAAQ,CAAC,MAAM,CAAC;yBAAC,CAC7ED,MAAM,CAACiC,SACPC,IAAI,CAAC;wBACRnB,MAAMA;wBACNC,IAAIA;wBAEJmB,UAAU,CAACrC,UAAU,CAAC,IAAIsC;;0CAE1B,KAACC;gCAAKL,WAAW,CAAC,EAAE5C,UAAU,WAAW,CAAC;0CACxC,cAAA,KAACb;oCAAY+D,WAAU;;;0CAEzB,KAACD;gCAAKL,WAAW,CAAC,EAAE5C,UAAU,YAAY,CAAC;0CAAG0B;;;uBANzCD;gBASX;eA9CaD;QAiDnB;;AAGN,EAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@payloadcms/next",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.73",
|
|
4
4
|
"homepage": "https://payloadcms.com",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -63,9 +63,9 @@
|
|
|
63
63
|
"sonner": "^1.5.0",
|
|
64
64
|
"uuid": "10.0.0",
|
|
65
65
|
"ws": "^8.16.0",
|
|
66
|
-
"@payloadcms/
|
|
67
|
-
"@payloadcms/
|
|
68
|
-
"@payloadcms/translations": "3.0.0-beta.
|
|
66
|
+
"@payloadcms/graphql": "3.0.0-beta.73",
|
|
67
|
+
"@payloadcms/ui": "3.0.0-beta.73",
|
|
68
|
+
"@payloadcms/translations": "3.0.0-beta.73"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
71
|
"@next/eslint-plugin-next": "^14.1.0",
|
|
@@ -77,13 +77,13 @@
|
|
|
77
77
|
"esbuild": "0.23.0",
|
|
78
78
|
"esbuild-sass-plugin": "3.3.1",
|
|
79
79
|
"swc-plugin-transform-remove-imports": "1.14.0",
|
|
80
|
-
"
|
|
81
|
-
"
|
|
80
|
+
"@payloadcms/eslint-config": "3.0.0-beta.59",
|
|
81
|
+
"payload": "3.0.0-beta.73"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"graphql": "^16.8.1",
|
|
85
85
|
"next": "^15.0.0-canary.53",
|
|
86
|
-
"payload": "3.0.0-beta.
|
|
86
|
+
"payload": "3.0.0-beta.73"
|
|
87
87
|
},
|
|
88
88
|
"engines": {
|
|
89
89
|
"node": "^18.20.2 || >=20.9.0"
|