@payloadcms/next 3.80.0-internal.52ab774 → 3.80.0-internal.82dcece

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/dist/cjs/withPayload.cjs +3 -0
  2. package/dist/cjs/withPayload.cjs.map +3 -3
  3. package/dist/elements/Nav/getNavPrefs.d.ts.map +1 -1
  4. package/dist/elements/Nav/getNavPrefs.js +2 -36
  5. package/dist/elements/Nav/getNavPrefs.js.map +1 -1
  6. package/dist/elements/Nav/index.client.d.ts.map +1 -1
  7. package/dist/elements/Nav/index.client.js +44 -27
  8. package/dist/elements/Nav/index.client.js.map +1 -1
  9. package/dist/elements/Nav/index.d.ts.map +1 -1
  10. package/dist/elements/Nav/index.js +7 -35
  11. package/dist/elements/Nav/index.js.map +1 -1
  12. package/dist/exports/client.d.ts +1 -2
  13. package/dist/exports/client.d.ts.map +1 -1
  14. package/dist/exports/client.js +1 -2
  15. package/dist/exports/client.js.map +1 -1
  16. package/dist/exports/rsc.d.ts +1 -2
  17. package/dist/exports/rsc.d.ts.map +1 -1
  18. package/dist/exports/rsc.js +1 -2
  19. package/dist/exports/rsc.js.map +1 -1
  20. package/dist/exports/utilities.d.ts +0 -2
  21. package/dist/exports/utilities.d.ts.map +1 -1
  22. package/dist/exports/utilities.js +0 -1
  23. package/dist/exports/utilities.js.map +1 -1
  24. package/dist/layouts/Root/index.d.ts +4 -2
  25. package/dist/layouts/Root/index.d.ts.map +1 -1
  26. package/dist/layouts/Root/index.js +25 -3
  27. package/dist/layouts/Root/index.js.map +1 -1
  28. package/dist/prod/styles.css +1 -1
  29. package/dist/utilities/handleServerFunctions.js +2 -2
  30. package/dist/utilities/handleServerFunctions.js.map +1 -1
  31. package/dist/views/BrowseByFolder/buildView.d.ts +13 -0
  32. package/dist/views/BrowseByFolder/buildView.d.ts.map +1 -0
  33. package/dist/views/BrowseByFolder/buildView.js +170 -0
  34. package/dist/views/BrowseByFolder/buildView.js.map +1 -0
  35. package/dist/views/BrowseByFolder/index.d.ts +4 -0
  36. package/dist/views/BrowseByFolder/index.d.ts.map +1 -0
  37. package/dist/views/BrowseByFolder/index.js +20 -0
  38. package/dist/views/BrowseByFolder/index.js.map +1 -0
  39. package/dist/views/BrowseByFolder/metadata.d.ts +4 -0
  40. package/dist/views/BrowseByFolder/metadata.d.ts.map +1 -0
  41. package/dist/views/BrowseByFolder/metadata.js +18 -0
  42. package/dist/views/BrowseByFolder/metadata.js.map +1 -0
  43. package/dist/views/CollectionFolders/buildView.d.ts +15 -0
  44. package/dist/views/CollectionFolders/buildView.d.ts.map +1 -0
  45. package/dist/views/CollectionFolders/buildView.js +156 -0
  46. package/dist/views/CollectionFolders/buildView.js.map +1 -0
  47. package/dist/views/CollectionFolders/index.d.ts +4 -0
  48. package/dist/views/CollectionFolders/index.d.ts.map +1 -0
  49. package/dist/views/CollectionFolders/index.js +20 -0
  50. package/dist/views/CollectionFolders/index.js.map +1 -0
  51. package/dist/views/CollectionFolders/metadata.d.ts +7 -0
  52. package/dist/views/CollectionFolders/metadata.d.ts.map +1 -0
  53. package/dist/views/CollectionFolders/metadata.js +25 -0
  54. package/dist/views/CollectionFolders/metadata.js.map +1 -0
  55. package/dist/views/CollectionFolders/renderFolderViewSlots.d.ts +11 -0
  56. package/dist/views/CollectionFolders/renderFolderViewSlots.d.ts.map +1 -0
  57. package/dist/views/CollectionFolders/renderFolderViewSlots.js +64 -0
  58. package/dist/views/CollectionFolders/renderFolderViewSlots.js.map +1 -0
  59. package/dist/views/Document/renderDocumentSlots.d.ts.map +1 -1
  60. package/dist/views/Document/renderDocumentSlots.js +0 -8
  61. package/dist/views/Document/renderDocumentSlots.js.map +1 -1
  62. package/dist/views/List/index.d.ts.map +1 -1
  63. package/dist/views/List/index.js +28 -84
  64. package/dist/views/List/index.js.map +1 -1
  65. package/dist/views/Root/getRouteData.d.ts +4 -1
  66. package/dist/views/Root/getRouteData.d.ts.map +1 -1
  67. package/dist/views/Root/getRouteData.js +91 -27
  68. package/dist/views/Root/getRouteData.js.map +1 -1
  69. package/dist/views/Root/index.d.ts.map +1 -1
  70. package/dist/views/Root/index.js +11 -5
  71. package/dist/views/Root/index.js.map +1 -1
  72. package/dist/views/Root/metadata.d.ts.map +1 -1
  73. package/dist/views/Root/metadata.js +37 -1
  74. package/dist/views/Root/metadata.js.map +1 -1
  75. package/dist/withPayload/withPayload.d.ts.map +1 -1
  76. package/dist/withPayload/withPayload.js +3 -0
  77. package/dist/withPayload/withPayload.js.map +1 -1
  78. package/package.json +7 -7
  79. package/dist/elements/HierarchyTypeField/index.d.ts +0 -9
  80. package/dist/elements/HierarchyTypeField/index.d.ts.map +0 -1
  81. package/dist/elements/HierarchyTypeField/index.js +0 -114
  82. package/dist/elements/HierarchyTypeField/index.js.map +0 -1
  83. package/dist/elements/HierarchyTypeField/index.server.d.ts +0 -9
  84. package/dist/elements/HierarchyTypeField/index.server.d.ts.map +0 -1
  85. package/dist/elements/HierarchyTypeField/index.server.js +0 -32
  86. package/dist/elements/HierarchyTypeField/index.server.js.map +0 -1
  87. package/dist/elements/Nav/SidebarTabs/TabError/index.d.ts +0 -8
  88. package/dist/elements/Nav/SidebarTabs/TabError/index.d.ts.map +0 -1
  89. package/dist/elements/Nav/SidebarTabs/TabError/index.js +0 -42
  90. package/dist/elements/Nav/SidebarTabs/TabError/index.js.map +0 -1
  91. package/dist/elements/Nav/SidebarTabs/constants.d.ts +0 -2
  92. package/dist/elements/Nav/SidebarTabs/constants.d.ts.map +0 -1
  93. package/dist/elements/Nav/SidebarTabs/constants.js +0 -2
  94. package/dist/elements/Nav/SidebarTabs/constants.js.map +0 -1
  95. package/dist/elements/Nav/SidebarTabs/index.client.d.ts +0 -22
  96. package/dist/elements/Nav/SidebarTabs/index.client.d.ts.map +0 -1
  97. package/dist/elements/Nav/SidebarTabs/index.client.js +0 -194
  98. package/dist/elements/Nav/SidebarTabs/index.client.js.map +0 -1
  99. package/dist/elements/Nav/SidebarTabs/index.d.ts +0 -17
  100. package/dist/elements/Nav/SidebarTabs/index.d.ts.map +0 -1
  101. package/dist/elements/Nav/SidebarTabs/index.js +0 -85
  102. package/dist/elements/Nav/SidebarTabs/index.js.map +0 -1
  103. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.d.ts +0 -10
  104. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.d.ts.map +0 -1
  105. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js +0 -54
  106. package/dist/elements/Nav/SidebarTabs/renderTabServerFn.js.map +0 -1
  107. package/dist/utilities/getHierarchyAncestry.d.ts +0 -24
  108. package/dist/utilities/getHierarchyAncestry.d.ts.map +0 -1
  109. package/dist/utilities/getHierarchyAncestry.js +0 -103
  110. package/dist/utilities/getHierarchyAncestry.js.map +0 -1
  111. package/dist/views/List/handleHierarchy.d.ts +0 -18
  112. package/dist/views/List/handleHierarchy.d.ts.map +0 -1
  113. package/dist/views/List/handleHierarchy.js +0 -258
  114. package/dist/views/List/handleHierarchy.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"withPayload.js","names":["getNextjsVersion","supportsTurbopackExternalizeTransitiveDependencies","withPayloadLegacy","poweredByHeader","key","value","withPayload","nextConfig","options","nextjsVersion","supportsTurbopackBuild","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","consoleWarn","sassWarningTexts","args","some","text","includes","baseConfig","sassOptions","silenceDeprecations","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH"],"sources":["../../src/withPayload/withPayload.js"],"sourcesContent":["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n const consoleWarn = console.warn\n\n const sassWarningTexts = [\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n 'Future import deprecation is not yet active, so silencing it is unnecessary',\n // Sometimes happens despite silenceDeprecations\n 'The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0',\n ]\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && sassWarningTexts.some((text) => args[1].includes(text))) ||\n (typeof args[0] === 'string' && sassWarningTexts.some((text) => args[0].includes(text)))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n env,\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./test/admin/components/views/CustomMinimal/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:\n * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * 8 | @import 'queries';\n *\n *\n * packages/ui/src/scss/styles.scss 9:9 @import\n * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet\n *\n * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n"],"mappings":"AAAA;;;;;GAMA,SACEA,gBAAgB,EAChBC,kDAAkD,QAC7C;AACP,SAASC,iBAAiB,QAAQ;AAElC,MAAMC,eAAA,GAAkB;EACtBC,GAAA,EAAK;EACLC,KAAA,EAAO;AACT;AAEA;;;;;AAKA,OAAO,MAAMC,WAAA,GAAcA,CAACC,UAAA,GAAa,CAAC,CAAC,EAAEC,OAAA,GAAU,CAAC,CAAC;EACvD,MAAMC,aAAA,GAAgBT,gBAAA;EAEtB,MAAMU,sBAAA,GAAyBT,kDAAA,CAAmDQ,aAAA;EAElF,MAAME,GAAA,GAAMJ,UAAA,CAAWI,GAAG,IAAI,CAAC;EAE/B,IAAIJ,UAAA,CAAWK,YAAY,EAAEC,UAAA,EAAYC,OAAA,EAAS;IAChDC,OAAA,CAAQC,IAAI,CACV;IAEFL,GAAA,CAAIM,uCAAuC,GAAG;EAChD;EAEA,MAAMC,WAAA,GAAcH,OAAA,CAAQC,IAAI;EAEhC,MAAMG,gBAAA,GAAmB;EACvB;EACA;EACA;EACA,yEACD;EACDJ,OAAA,CAAQC,I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jD;UACAC,QAAA,EAAU;YACR,IAAIP,qBAAA,EAAuBK,OAAA,EAASE,QAAA,IAAY,CAAC,CAAC;YAClD;;;;;;;;;;;;;;;;;;;YAmBAC,IAAA,EAAM;UACR;QACF;MACF;IACF;EACF;EAEA,IAAIzC,UAAA,CAAW0C,QAAQ,EAAE;IACvBf,OAAA,CAAQvB,GAAG,CAACuC,cAAc,GAAG3C,UAAA,CAAW0C,QAAQ;IAChDzB,UAAA,CAAWb,GAAG,CAACuC,cAAc,GAAG3C,UAAA,CAAW0C,QAAQ;EACrD;EAEA,IAAI,CAACvC,sBAAA,EAAwB;IAC3B,OAAOR,iBAAA,CAAkBsB,UAAA;EAC3B,OAAO;IACL,OAAO;MACL,GAAGA,UAAU;MACbS,sBAAA,EAAwB,C,IAClBT,UAAA,CAAWS,sBAAsB,IAAI,EAAE,GAC3C,eACA,mBACA,SACA,UACA,yBACA;MACA;MACA;IAEJ;EACF;AACF;AAEA,eAAe3B,WAAA","ignoreList":[]}
1
+ {"version":3,"file":"withPayload.js","names":["getNextjsVersion","supportsTurbopackExternalizeTransitiveDependencies","withPayloadLegacy","poweredByHeader","key","value","withPayload","nextConfig","options","nextjsVersion","supportsTurbopackBuild","env","experimental","staleTimes","dynamic","console","warn","NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH","cacheComponents","PAYLOAD_CACHE_COMPONENTS_ENABLED","consoleWarn","sassWarningTexts","args","some","text","includes","baseConfig","sassOptions","silenceDeprecations","outputFileTracingExcludes","outputFileTracingIncludes","turbopack","headers","headersFromConfig","source","serverExternalPackages","process","NODE_ENV","devBundleServerPackages","webpack","webpackConfig","webpackOptions","incomingWebpackConfig","externals","plugins","IgnorePlugin","resourceRegExp","resolve","alias","fallback","aws4","basePath","NEXT_BASE_PATH"],"sources":["../../src/withPayload/withPayload.js"],"sourcesContent":["/**\n * These files must remain as plain JavaScript (.js) rather than TypeScript (.ts) because they are\n * imported directly in next.config.mjs files. Since next.config files run before the build process,\n * TypeScript compilation is not available. This ensures compatibility with all templates and\n * user projects regardless of their TypeScript setup.\n */\nimport {\n getNextjsVersion,\n supportsTurbopackExternalizeTransitiveDependencies,\n} from './withPayload.utils.js'\nimport { withPayloadLegacy } from './withPayloadLegacy.js'\n\nconst poweredByHeader = {\n key: 'X-Powered-By',\n value: 'Next.js, Payload',\n}\n\n/**\n * @param {import('next').NextConfig} nextConfig\n * @param {Object} [options] - Optional configuration options\n * @param {boolean} [options.devBundleServerPackages] - Whether to bundle server packages in development mode. @default false\n * */\nexport const withPayload = (nextConfig = {}, options = {}) => {\n const nextjsVersion = getNextjsVersion()\n\n const supportsTurbopackBuild = supportsTurbopackExternalizeTransitiveDependencies(nextjsVersion)\n\n const env = nextConfig.env || {}\n\n if (nextConfig.experimental?.staleTimes?.dynamic) {\n console.warn(\n 'Payload detected a non-zero value for the `staleTimes.dynamic` option in your Next.js config. This will slow down page transitions and may cause stale data to load within the Admin panel. To clear this warning, remove the `staleTimes.dynamic` option from your Next.js config or set it to 0. In the future, Next.js may support scoping this option to specific routes.',\n )\n env.NEXT_PUBLIC_ENABLE_ROUTER_CACHE_REFRESH = 'true'\n }\n\n if (nextConfig.cacheComponents) {\n env.PAYLOAD_CACHE_COMPONENTS_ENABLED = 'true'\n }\n\n const consoleWarn = console.warn\n\n const sassWarningTexts = [\n // This warning is a lie - without silencing import deprecation warnings, sass will spam the console with deprecation warnings\n 'Future import deprecation is not yet active, so silencing it is unnecessary',\n // Sometimes happens despite silenceDeprecations\n 'The legacy JS API is deprecated and will be removed in Dart Sass 2.0.0',\n ]\n console.warn = (...args) => {\n if (\n (typeof args[1] === 'string' && sassWarningTexts.some((text) => args[1].includes(text))) ||\n (typeof args[0] === 'string' && sassWarningTexts.some((text) => args[0].includes(text)))\n ) {\n return\n }\n\n consoleWarn(...args)\n }\n\n /** @type {import('next').NextConfig} */\n const baseConfig = {\n ...nextConfig,\n env,\n sassOptions: {\n ...(nextConfig.sassOptions || {}),\n /**\n * This prevents scss warning spam during pnpm dev that looks like this:\n * ⚠ ./test/admin/components/views/CustomMinimal/index.scss\n * Issue while running loader\n * SassWarning: Deprecation Warning on line 8, column 8 of file:///Users/alessio/Documents/GitHub/ payload/packages/ui/src/scss/styles.scss:8:8:\n * Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.\n *\n * More info and automated migrator: https://sass-lang.com/d/import\n *\n * 8 | @import 'queries';\n *\n *\n * packages/ui/src/scss/styles.scss 9:9 @import\n * test/admin/components/views/CustomMinimal/index.scss 1:9 root stylesheet\n *\n * @todo: update all outdated scss imports to use @use instead of @import. Then, we can remove this.\n */\n silenceDeprecations: [...(nextConfig.sassOptions?.silenceDeprecations || []), 'import'],\n },\n outputFileTracingExcludes: {\n ...(nextConfig.outputFileTracingExcludes || {}),\n '**/*': [\n ...(nextConfig.outputFileTracingExcludes?.['**/*'] || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n ],\n },\n outputFileTracingIncludes: {\n ...(nextConfig.outputFileTracingIncludes || {}),\n '**/*': [...(nextConfig.outputFileTracingIncludes?.['**/*'] || []), '@libsql/client'],\n },\n turbopack: {\n ...(nextConfig.turbopack || {}),\n },\n // We disable the poweredByHeader here because we add it manually in the headers function below\n ...(nextConfig.poweredByHeader !== false ? { poweredByHeader: false } : {}),\n headers: async () => {\n const headersFromConfig = 'headers' in nextConfig ? await nextConfig.headers() : []\n\n return [\n ...(headersFromConfig || []),\n {\n headers: [\n {\n key: 'Accept-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Vary',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n {\n key: 'Critical-CH',\n value: 'Sec-CH-Prefers-Color-Scheme',\n },\n ...(nextConfig.poweredByHeader !== false ? [poweredByHeader] : []),\n ],\n source: '/:path*',\n },\n ]\n },\n serverExternalPackages: [\n ...(nextConfig.serverExternalPackages || []),\n // WHY: without externalizing graphql, a graphql version error will be thrown\n // during runtime (\"Ensure that there is only one instance of \\\"graphql\\\" in the node_modules\\ndirectory.\")\n 'graphql',\n ...(process.env.NODE_ENV === 'development' && options.devBundleServerPackages !== true\n ? /**\n * Unless explicitly disabled by the user, by passing `devBundleServerPackages: true` to withPayload, we\n * do not bundle server-only packages during dev for two reasons:\n *\n * 1. Performance: Fewer files to compile means faster compilation speeds.\n * 2. Turbopack support: Webpack's externals are not supported by Turbopack.\n *\n * Regarding Turbopack support: Unlike webpack.externals, we cannot use serverExternalPackages to\n * externalized packages that are not resolvable from the project root. So including a package like\n * \"drizzle-kit\" in here would do nothing - Next.js will ignore the rule and still bundle the package -\n * because it detects that the package is not resolvable from the project root (= not directly installed\n * by the user in their own package.json).\n *\n * Instead, we can use serverExternalPackages for the entry-point packages that *are* installed directly\n * by the user (e.g. db-postgres, which then installs drizzle-kit as a dependency).\n *\n *\n *\n * We should only do this during development, not build, because externalizing these packages can hurt\n * the bundle size. Not only does it disable tree-shaking, it also risks installing duplicate copies of the\n * same package.\n *\n * Example:\n * - @payloadcms/richtext-lexical (in bundle) -> installs qs-esm (bundled because of importer)\n * - payload (not in bundle, external) -> installs qs-esm (external because of importer)\n * Result: we have two copies of qs-esm installed - one in the bundle, and one in node_modules.\n *\n * During development, these bundle size difference do not matter much, and development speed /\n * turbopack support are more important.\n */\n [\n 'payload',\n '@payloadcms/db-mongodb',\n '@payloadcms/db-postgres',\n '@payloadcms/db-sqlite',\n '@payloadcms/db-vercel-postgres',\n '@payloadcms/db-d1-sqlite',\n '@payloadcms/drizzle',\n '@payloadcms/email-nodemailer',\n '@payloadcms/email-resend',\n '@payloadcms/graphql',\n '@payloadcms/payload-cloud',\n '@payloadcms/plugin-redirects',\n // TODO: Add the following packages, excluding their /client subpath exports, once Next.js supports it\n // see: https://github.com/vercel/next.js/discussions/76991\n //'@payloadcms/plugin-cloud-storage',\n //'@payloadcms/plugin-sentry',\n //'@payloadcms/plugin-stripe',\n // @payloadcms/richtext-lexical\n //'@payloadcms/storage-azure',\n //'@payloadcms/storage-gcs',\n //'@payloadcms/storage-s3',\n //'@payloadcms/storage-uploadthing',\n //'@payloadcms/storage-vercel-blob',\n ]\n : []),\n ],\n webpack: (webpackConfig, webpackOptions) => {\n const incomingWebpackConfig =\n typeof nextConfig.webpack === 'function'\n ? nextConfig.webpack(webpackConfig, webpackOptions)\n : webpackConfig\n\n return {\n ...incomingWebpackConfig,\n externals: [\n ...(incomingWebpackConfig?.externals || []),\n /**\n * See the explanation in the serverExternalPackages section above.\n * We need to force Webpack to emit require() calls for these packages, even though they are not\n * resolvable from the project root. You would expect this to error during runtime, but Next.js seems to be able to require these just fine.\n *\n * This is the only way to get Webpack Build to work, without the bundle size caveats of externalizing the\n * entry point packages, as explained in the serverExternalPackages section above.\n */\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n ],\n plugins: [\n ...(incomingWebpackConfig?.plugins || []),\n // Fix cloudflare:sockets error: https://github.com/vercel/next.js/discussions/50177\n new webpackOptions.webpack.IgnorePlugin({\n resourceRegExp: /^pg-native$|^cloudflare:sockets$/,\n }),\n ],\n resolve: {\n ...(incomingWebpackConfig?.resolve || {}),\n alias: {\n ...(incomingWebpackConfig?.resolve?.alias || {}),\n },\n fallback: {\n ...(incomingWebpackConfig?.resolve?.fallback || {}),\n /*\n * This fixes the following warning when running next build with webpack (tested on Next.js 16.0.3 with Payload 3.64.0):\n *\n * ⚠ Compiled with warnings in 8.7s\n *\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * Module not found: Can't resolve 'aws4' in '/Users/alessio/Documents/temp/next16p/node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib'\n *\n * Import trace for requested module:\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/deps.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/client-side-encryption/client_encryption.js\n * ./node_modules/.pnpm/mongodb@6.16.0/node_modules/mongodb/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/lib/index.js\n * ./node_modules/.pnpm/mongoose@8.15.1/node_modules/mongoose/index.js\n * ./node_modules/.pnpm/@payloadcms+db-mongodb@3.64.0_payload@3.64.0_graphql@16.12.0_typescript@5.7.3_/node_modules/@payloadcms/db-mongodb/dist/index.js\n * ./src/payload.config.ts\n * ./src/app/my-route/route.ts\n *\n **/\n aws4: false,\n },\n },\n }\n },\n }\n\n if (nextConfig.basePath) {\n process.env.NEXT_BASE_PATH = nextConfig.basePath\n baseConfig.env.NEXT_BASE_PATH = nextConfig.basePath\n }\n\n if (!supportsTurbopackBuild) {\n return withPayloadLegacy(baseConfig)\n } else {\n return {\n ...baseConfig,\n serverExternalPackages: [\n ...(baseConfig.serverExternalPackages || []),\n 'drizzle-kit',\n 'drizzle-kit/api',\n 'sharp',\n 'libsql',\n 'require-in-the-middle',\n 'json-schema-to-typescript',\n // Prevents turbopack build errors by the thread-stream package which is installed by pino\n 'pino',\n ],\n }\n }\n}\n\nexport default withPayload\n"],"mappings":"AAAA;;;;;GAMA,SACEA,gBAAgB,EAChBC,kDAAkD,QAC7C;AACP,SAASC,iBAAiB,QAAQ;AAElC,MAAMC,eAAA,GAAkB;EACtBC,GAAA,EAAK;EACLC,KAAA,EAAO;AACT;AAEA;;;;;AAKA,OAAO,MAAMC,WAAA,GAAcA,CAACC,UAAA,GAAa,CAAC,CAAC,EAAEC,OAAA,GAAU,CAAC,CAAC;EACvD,MAAMC,aAAA,GAAgBT,gBAAA;EAEtB,MAAMU,sBAAA,GAAyBT,kDAAA,CAAmDQ,aAAA;EAElF,MAAME,GAAA,GAAMJ,UAAA,CAAWI,GAAG,IAAI,CAAC;EAE/B,IAAIJ,UAAA,CAAWK,YAAY,EAAEC,UAAA,EAAYC,OAAA,EAAS;IAChDC,OAAA,CAAQC,IAAI,CACV;IAEFL,GAAA,CAAIM,uCAAuC,GAAG;EAChD;EAEA,IAAIV,UAAA,CAAWW,eAAe,EAAE;IAC9BP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,GACD;QACDC,OAAA,EAAS;UACP,IAAIL,qBAAA,EAAuBK,OAAA,IAAW,CAAC,CAAC;UACxCC,KAAA,EAAO;YACL,IAAIN,qBAAA,EAAuBK,OAAA,EAASC,KAAA,IAAS,CAAC,CAAC;UACjD;UACAC,QAAA,EAAU;YACR,IAAIP,qBAAA,EAAuBK,OAAA,EAASE,QAAA,IAAY,CAAC,CAAC;YAClD;;;;;;;;;;;;;;;;;;;YAmBAC,IAAA,EAAM;UACR;QACF;MACF;IACF;EACF;EAEA,IAAI3C,UAAA,CAAW4C,QAAQ,EAAE;IACvBf,OAAA,CAAQzB,GAAG,CAACyC,cAAc,GAAG7C,UAAA,CAAW4C,QAAQ;IAChDzB,UAAA,CAAWf,GAAG,CAACyC,cAAc,GAAG7C,UAAA,CAAW4C,QAAQ;EACrD;EAEA,IAAI,CAACzC,sBAAA,EAAwB;IAC3B,OAAOR,iBAAA,CAAkBwB,UAAA;EAC3B,OAAO;IACL,OAAO;MACL,GAAGA,UAAU;MACbS,sBAAA,EAAwB,C,IAClBT,UAAA,CAAWS,sBAAsB,IAAI,EAAE,GAC3C,eACA,mBACA,SACA,UACA,yBACA;MACA;MACA;IAEJ;EACF;AACF;AAEA,eAAe7B,WAAA","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/next",
3
- "version": "3.80.0-internal.52ab774",
3
+ "version": "3.80.0-internal.82dcece",
4
4
  "homepage": "https://payloadcms.com",
5
5
  "repository": {
6
6
  "type": "git",
@@ -99,9 +99,9 @@
99
99
  "qs-esm": "7.0.2",
100
100
  "sass": "1.77.4",
101
101
  "uuid": "10.0.0",
102
- "@payloadcms/translations": "3.80.0-internal.52ab774",
103
- "@payloadcms/ui": "3.80.0-internal.52ab774",
104
- "@payloadcms/graphql": "3.80.0-internal.52ab774"
102
+ "@payloadcms/translations": "3.80.0-internal.82dcece",
103
+ "@payloadcms/graphql": "3.80.0-internal.82dcece",
104
+ "@payloadcms/ui": "3.80.0-internal.82dcece"
105
105
  },
106
106
  "devDependencies": {
107
107
  "@babel/cli": "7.27.2",
@@ -109,7 +109,7 @@
109
109
  "@babel/preset-env": "7.27.2",
110
110
  "@babel/preset-react": "7.27.1",
111
111
  "@babel/preset-typescript": "7.27.1",
112
- "@next/eslint-plugin-next": "16.2.0-canary.90",
112
+ "@next/eslint-plugin-next": "16.2.0",
113
113
  "@types/busboy": "1.5.4",
114
114
  "@types/react": "19.2.9",
115
115
  "@types/react-dom": "19.2.3",
@@ -119,12 +119,12 @@
119
119
  "esbuild-sass-plugin": "3.3.1",
120
120
  "swc-plugin-transform-remove-imports": "8.3.0",
121
121
  "@payloadcms/eslint-config": "3.28.0",
122
- "payload": "3.80.0-internal.52ab774"
122
+ "payload": "3.80.0-internal.82dcece"
123
123
  },
124
124
  "peerDependencies": {
125
125
  "graphql": "^16.8.1",
126
126
  "next": ">=15.2.9 <15.3.0 || >=15.3.9 <15.4.0 || >=15.4.11 <15.5.0 || >=16.2.0-canary.10 <17.0.0",
127
- "payload": "3.80.0-internal.52ab774"
127
+ "payload": "3.80.0-internal.82dcece"
128
128
  },
129
129
  "engines": {
130
130
  "node": "^18.20.2 || >=20.9.0"
@@ -1,9 +0,0 @@
1
- import type { Option, SelectFieldClientProps } from 'payload';
2
- import React from 'react';
3
- type HierarchyTypeFieldProps = {
4
- options: Option[];
5
- parentFieldName: string;
6
- } & SelectFieldClientProps;
7
- export declare const HierarchyTypeField: React.FC<HierarchyTypeFieldProps>;
8
- export {};
9
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/elements/HierarchyTypeField/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,EAAgB,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAS3E,OAAO,KAA+B,MAAM,OAAO,CAAA;AAEnD,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;CACxB,GAAG,sBAAsB,CAAA;AAE1B,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAyHhE,CAAA"}
@@ -1,114 +0,0 @@
1
- 'use client';
2
-
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- import { formatOptions, mergeFieldStyles, SelectInput, useField, useHierarchy } from '@payloadcms/ui';
5
- import React, { useCallback, useMemo } from 'react';
6
- export const HierarchyTypeField = ({
7
- options: allSelectOptions,
8
- parentFieldName,
9
- ...props
10
- }) => {
11
- const {
12
- field,
13
- field: {
14
- name,
15
- admin: {
16
- className,
17
- isClearable = true,
18
- isSortable = true,
19
- placeholder
20
- } = {},
21
- hasMany = false,
22
- label,
23
- localized,
24
- required
25
- },
26
- onChange: onChangeFromProps,
27
- path: pathFromProps,
28
- readOnly,
29
- validate
30
- } = props;
31
- const {
32
- allowedCollections
33
- } = useHierarchy();
34
- const options = useMemo(() => {
35
- if (!allowedCollections || allowedCollections.length === 0) {
36
- return formatOptions(allSelectOptions);
37
- }
38
- return formatOptions(allSelectOptions.filter(option => {
39
- if (typeof option === 'object' && 'value' in option && option.value) {
40
- return allowedCollections.some(c => c.slug === option.value);
41
- }
42
- return true;
43
- }));
44
- }, [allSelectOptions, allowedCollections]);
45
- const {
46
- customComponents: {
47
- AfterInput,
48
- BeforeInput,
49
- Description,
50
- Error,
51
- Label
52
- } = {},
53
- disabled,
54
- path,
55
- selectFilterOptions,
56
- setValue,
57
- showError,
58
- value
59
- } = useField({
60
- potentiallyStalePath: pathFromProps,
61
- validate
62
- });
63
- const onChange = useCallback(selectedOption => {
64
- if (readOnly || disabled) {
65
- return;
66
- }
67
- let newValue = null;
68
- if (selectedOption && hasMany) {
69
- if (Array.isArray(selectedOption)) {
70
- newValue = selectedOption.map(option_0 => option_0.value);
71
- } else {
72
- newValue = [];
73
- }
74
- } else if (selectedOption && !Array.isArray(selectedOption)) {
75
- newValue = selectedOption.value;
76
- }
77
- if (typeof onChangeFromProps === 'function') {
78
- onChangeFromProps(newValue);
79
- }
80
- setValue(newValue);
81
- }, [readOnly, disabled, hasMany, setValue, onChangeFromProps]);
82
- const styles = useMemo(() => mergeFieldStyles(field), [field]);
83
- const isRequired = required || Array.isArray(allowedCollections) && allowedCollections.length > 0;
84
- return /*#__PURE__*/_jsx("div", {
85
- children: /*#__PURE__*/_jsx(SelectInput, {
86
- AfterInput: AfterInput,
87
- BeforeInput: BeforeInput,
88
- className: className,
89
- Description: Description,
90
- description: "Select the collection types this item can contain",
91
- Error: Error,
92
- filterOption: selectFilterOptions ? ({
93
- value: optionValue
94
- }) => selectFilterOptions?.some(option_1 => (typeof option_1 === 'string' ? option_1 : option_1.value) === optionValue) : undefined,
95
- hasMany: hasMany,
96
- isClearable: isClearable,
97
- isSortable: isSortable,
98
- Label: Label,
99
- label: label,
100
- localized: localized,
101
- name: name,
102
- onChange: onChange,
103
- options: options,
104
- path: path,
105
- placeholder: placeholder,
106
- readOnly: readOnly || disabled,
107
- required: isRequired,
108
- showError: showError,
109
- style: styles,
110
- value: value
111
- })
112
- });
113
- };
114
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["formatOptions","mergeFieldStyles","SelectInput","useField","useHierarchy","React","useCallback","useMemo","HierarchyTypeField","options","allSelectOptions","parentFieldName","props","field","name","admin","className","isClearable","isSortable","placeholder","hasMany","label","localized","required","onChange","onChangeFromProps","path","pathFromProps","readOnly","validate","allowedCollections","length","filter","option","value","some","c","slug","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","selectFilterOptions","setValue","showError","potentiallyStalePath","selectedOption","newValue","Array","isArray","map","styles","isRequired","_jsx","description","filterOption","optionValue","undefined","style"],"sources":["../../../src/elements/HierarchyTypeField/index.tsx"],"sourcesContent":["'use client'\nimport type { ReactSelectAdapterProps } from '@payloadcms/ui'\nimport type { Option, OptionObject, SelectFieldClientProps } from 'payload'\n\nimport {\n formatOptions,\n mergeFieldStyles,\n SelectInput,\n useField,\n useHierarchy,\n} from '@payloadcms/ui'\nimport React, { useCallback, useMemo } from 'react'\n\ntype HierarchyTypeFieldProps = {\n options: Option[]\n parentFieldName: string\n} & SelectFieldClientProps\n\nexport const HierarchyTypeField: React.FC<HierarchyTypeFieldProps> = ({\n options: allSelectOptions,\n parentFieldName,\n ...props\n}) => {\n const {\n field,\n field: {\n name,\n admin: { className, isClearable = true, isSortable = true, placeholder } = {} as NonNullable<\n SelectFieldClientProps['field']['admin']\n >,\n hasMany = false,\n label,\n localized,\n required,\n },\n onChange: onChangeFromProps,\n path: pathFromProps,\n readOnly,\n validate,\n } = props\n\n const { allowedCollections } = useHierarchy()\n\n const options = useMemo(() => {\n if (!allowedCollections || allowedCollections.length === 0) {\n return formatOptions(allSelectOptions)\n }\n\n return formatOptions(\n allSelectOptions.filter((option) => {\n if (typeof option === 'object' && 'value' in option && option.value) {\n return allowedCollections.some((c) => c.slug === option.value)\n }\n return true\n }),\n )\n }, [allSelectOptions, allowedCollections])\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled,\n path,\n selectFilterOptions,\n setValue,\n showError,\n value,\n } = useField({\n potentiallyStalePath: pathFromProps,\n validate,\n })\n\n const onChange: ReactSelectAdapterProps['onChange'] = useCallback(\n (selectedOption: OptionObject | OptionObject[]) => {\n if (readOnly || disabled) {\n return\n }\n\n let newValue: null | string | string[] = null\n\n if (selectedOption && hasMany) {\n if (Array.isArray(selectedOption)) {\n newValue = selectedOption.map((option) => option.value)\n } else {\n newValue = []\n }\n } else if (selectedOption && !Array.isArray(selectedOption)) {\n newValue = selectedOption.value\n }\n\n if (typeof onChangeFromProps === 'function') {\n onChangeFromProps(newValue)\n }\n\n setValue(newValue)\n },\n [readOnly, disabled, hasMany, setValue, onChangeFromProps],\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const isRequired =\n required || (Array.isArray(allowedCollections) && allowedCollections.length > 0)\n\n return (\n <div>\n <SelectInput\n AfterInput={AfterInput}\n BeforeInput={BeforeInput}\n className={className}\n Description={Description}\n description=\"Select the collection types this item can contain\"\n Error={Error}\n filterOption={\n selectFilterOptions\n ? ({ value: optionValue }) =>\n selectFilterOptions?.some(\n (option) => (typeof option === 'string' ? option : option.value) === optionValue,\n )\n : undefined\n }\n hasMany={hasMany}\n isClearable={isClearable}\n isSortable={isSortable}\n Label={Label}\n label={label}\n localized={localized}\n name={name}\n onChange={onChange}\n options={options}\n path={path}\n placeholder={placeholder}\n readOnly={readOnly || disabled}\n required={isRequired}\n showError={showError}\n style={styles}\n value={value as string | string[]}\n />\n </div>\n )\n}\n"],"mappings":"AAAA;;;AAIA,SACEA,aAAa,EACbC,gBAAgB,EAChBC,WAAW,EACXC,QAAQ,EACRC,YAAY,QACP;AACP,OAAOC,KAAA,IAASC,WAAW,EAAEC,OAAO,QAAQ;AAO5C,OAAO,MAAMC,kBAAA,GAAwDA,CAAC;EACpEC,OAAA,EAASC,gBAAgB;EACzBC,eAAe;EACf,GAAGC;AAAA,CACJ;EACC,MAAM;IACJC,KAAK;IACLA,KAAA,EAAO;MACLC,IAAI;MACJC,KAAA,EAAO;QAAEC,SAAS;QAAEC,WAAA,GAAc,IAAI;QAAEC,UAAA,GAAa,IAAI;QAAEC;MAAW,CAAE,GAAG,CAAC,CAE3E;MACDC,OAAA,GAAU,KAAK;MACfC,KAAK;MACLC,SAAS;MACTC;IAAQ,CACT;IACDC,QAAA,EAAUC,iBAAiB;IAC3BC,IAAA,EAAMC,aAAa;IACnBC,QAAQ;IACRC;EAAQ,CACT,GAAGjB,KAAA;EAEJ,MAAM;IAAEkB;EAAkB,CAAE,GAAG1B,YAAA;EAE/B,MAAMK,OAAA,GAAUF,OAAA,CAAQ;IACtB,IAAI,CAACuB,kBAAA,IAAsBA,kBAAA,CAAmBC,MAAM,KAAK,GAAG;MAC1D,OAAO/B,aAAA,CAAcU,gBAAA;IACvB;IAEA,OAAOV,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CAAkB;EAG5D,MAAM6B,MAAA,GAAS/C,OAAA,CAAQ,MAAMN,gBAAA,CAAiBY,KAAA,GAAQ,CAACA,KAAA,CAAM;EAE7D,MAAM0C,UAAA,GACJhC,QAAA,IAAa4B,KAAA,CAAMC,OAAO,CAACtB,kBAAA,KAAuBA,kBAAA,CAAmBC,MAAM,GAAG;EAEhF,oBACEyB,IAAA,CAAC;cACC,aAAAA,IAAA,CAACtD,WAAA;MACCqC,UAAA,EAAYA,UAAA;MACZC,WAAA,EAAaA,WAAA;MACbxB,SAAA,EAAWA,SAAA;MACXyB,WAAA,EAAaA,WAAA;MACbgB,WAAA,EAAY;MACZf,KAAA,EAAOA,KAAA;MACPgB,YAAA,EACEb,mBAAA,GACI,CAAC;QAAEX,KAAA,EAAOyB;MAAW,CAAE,KACrBd,mBAAA,EAAqBV,IAAA,CAClBF,QAAA,IAAW,CAAC,OAAOA,QAAA,KAAW,WAAWA,QAAA,GAASA,QAAA,CAAOC,KAAK,MAAMyB,WAAA,IAEzEC,SAAA;MAENxC,OAAA,EAASA,OAAA;MACTH,WAAA,EAAaA,WAAA;MACbC,UAAA,EAAYA,UAAA;MACZyB,KAAA,EAAOA,KAAA;MACPtB,KAAA,EAAOA,KAAA;MACPC,SAAA,EAAWA,SAAA;MACXR,IAAA,EAAMA,IAAA;MACNU,QAAA,EAAUA,QAAA;MACVf,OAAA,EAASA,OAAA;MACTiB,IAAA,EAAMA,IAAA;MACNP,WAAA,EAAaA,WAAA;MACbS,QAAA,EAAUA,QAAA,IAAYgB,QAAA;MACtBrB,QAAA,EAAUgC,UAAA;MACVR,SAAA,EAAWA,SAAA;MACXc,KAAA,EAAOP,MAAA;MACPpB,KAAA,EAAOA;;;AAIf","ignoreList":[]}
@@ -1,9 +0,0 @@
1
- import type { Option, SelectFieldServerProps } from 'payload';
2
- import React from 'react';
3
- type HierarchyTypeFieldServerProps = {
4
- collectionOptions: Option[];
5
- parentFieldName: string;
6
- } & SelectFieldServerProps;
7
- export declare const HierarchyTypeFieldServer: React.FC<HierarchyTypeFieldServerProps>;
8
- export {};
9
- //# sourceMappingURL=index.server.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.server.d.ts","sourceRoot":"","sources":["../../../src/elements/HierarchyTypeField/index.server.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AAG7D,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,KAAK,6BAA6B,GAAG;IACnC,iBAAiB,EAAE,MAAM,EAAE,CAAA;IAC3B,eAAe,EAAE,MAAM,CAAA;CACxB,GAAG,sBAAsB,CAAA;AAE1B,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC,6BAA6B,CA6B5E,CAAA"}
@@ -1,32 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { getTranslation } from '@payloadcms/translations';
3
- import React from 'react';
4
- import { HierarchyTypeField } from './index.js';
5
- export const HierarchyTypeFieldServer = ({
6
- clientField,
7
- collectionOptions,
8
- i18n,
9
- parentFieldName,
10
- path,
11
- permissions,
12
- readOnly
13
- }) => {
14
- const translatedOptions = collectionOptions.map(option => {
15
- if (typeof option === 'object' && 'label' in option) {
16
- return {
17
- ...option,
18
- label: getTranslation(option.label, i18n)
19
- };
20
- }
21
- return option;
22
- });
23
- return /*#__PURE__*/_jsx(HierarchyTypeField, {
24
- field: clientField,
25
- options: translatedOptions,
26
- parentFieldName: parentFieldName,
27
- path: path,
28
- permissions: permissions,
29
- readOnly: readOnly
30
- });
31
- };
32
- //# sourceMappingURL=index.server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.server.js","names":["getTranslation","React","HierarchyTypeField","HierarchyTypeFieldServer","clientField","collectionOptions","i18n","parentFieldName","path","permissions","readOnly","translatedOptions","map","option","label","_jsx","field","options"],"sources":["../../../src/elements/HierarchyTypeField/index.server.tsx"],"sourcesContent":["import type { Option, SelectFieldServerProps } from 'payload'\n\nimport { getTranslation } from '@payloadcms/translations'\nimport React from 'react'\n\nimport { HierarchyTypeField } from './index.js'\n\ntype HierarchyTypeFieldServerProps = {\n collectionOptions: Option[]\n parentFieldName: string\n} & SelectFieldServerProps\n\nexport const HierarchyTypeFieldServer: React.FC<HierarchyTypeFieldServerProps> = ({\n clientField,\n collectionOptions,\n i18n,\n parentFieldName,\n path,\n permissions,\n readOnly,\n}) => {\n const translatedOptions: Option[] = collectionOptions.map((option) => {\n if (typeof option === 'object' && 'label' in option) {\n return {\n ...option,\n label: getTranslation(option.label, i18n),\n }\n }\n return option\n })\n\n return (\n <HierarchyTypeField\n field={clientField}\n options={translatedOptions}\n parentFieldName={parentFieldName}\n path={path}\n permissions={permissions}\n readOnly={readOnly}\n />\n )\n}\n"],"mappings":";AAEA,SAASA,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAElB,SAASC,kBAAkB,QAAQ;AAOnC,OAAO,MAAMC,wBAAA,GAAoEA,CAAC;EAChFC,WAAW;EACXC,iBAAiB;EACjBC,IAAI;EACJC,eAAe;EACfC,IAAI;EACJC,WAAW;EACXC;AAAQ,CACT;EACC,MAAMC,iBAAA,GAA8BN,iBAAA,CAAkBO,GAAG,CAAEC,MAAA;IACzD,IAAI,OAAOA,MAAA,KAAW,YAAY,WAAWA,MAAA,EAAQ;MACnD,OAAO;QACL,GAAGA,MAAM;QACTC,KAAA,EAAOd,cAAA,CAAea,MAAA,CAAOC,KAAK,EAAER,IAAA;MACtC;IACF;IACA,OAAOO,MAAA;EACT;EAEA,oBACEE,IAAA,CAACb,kBAAA;IACCc,KAAA,EAAOZ,WAAA;IACPa,OAAA,EAASN,iBAAA;IACTJ,eAAA,EAAiBA,eAAA;IACjBC,IAAA,EAAMA,IAAA;IACNC,WAAA,EAAaA,WAAA;IACbC,QAAA,EAAUA;;AAGhB","ignoreList":[]}
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- import './index.scss';
3
- export type TabErrorProps = {
4
- message: string;
5
- onRetry: () => void;
6
- };
7
- export declare const TabError: React.FC<TabErrorProps>;
8
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/elements/Nav/SidebarTabs/TabError/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,cAAc,CAAA;AAIrB,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,CAY5C,CAAA"}
@@ -1,42 +0,0 @@
1
- 'use client';
2
-
3
- import { c as _c } from "react/compiler-runtime";
4
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- import { useTranslation } from '@payloadcms/ui';
6
- import React from 'react';
7
- const baseClass = 'sidebar-tab-error';
8
- export const TabError = t0 => {
9
- const $ = _c(4);
10
- const {
11
- message,
12
- onRetry
13
- } = t0;
14
- const {
15
- t
16
- } = useTranslation();
17
- let t1;
18
- if ($[0] !== message || $[1] !== onRetry || $[2] !== t) {
19
- t1 = _jsx("div", {
20
- className: baseClass,
21
- children: _jsxs("div", {
22
- className: `${baseClass}__content`,
23
- children: [_jsx("span", {
24
- children: message
25
- }), _jsx("button", {
26
- className: `${baseClass}__retry`,
27
- onClick: onRetry,
28
- type: "button",
29
- children: t("general:retry")
30
- })]
31
- })
32
- });
33
- $[0] = message;
34
- $[1] = onRetry;
35
- $[2] = t;
36
- $[3] = t1;
37
- } else {
38
- t1 = $[3];
39
- }
40
- return t1;
41
- };
42
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["c","_c","useTranslation","React","baseClass","TabError","t0","$","message","onRetry","t","t1","_jsx","className","children","_jsxs","onClick","type"],"sources":["../../../../../src/elements/Nav/SidebarTabs/TabError/index.tsx"],"sourcesContent":["'use client'\n\nimport { useTranslation } from '@payloadcms/ui'\nimport React from 'react'\n\nimport './index.scss'\n\nconst baseClass = 'sidebar-tab-error'\n\nexport type TabErrorProps = {\n message: string\n onRetry: () => void\n}\n\nexport const TabError: React.FC<TabErrorProps> = ({ message, onRetry }) => {\n const { t } = useTranslation()\n return (\n <div className={baseClass}>\n <div className={`${baseClass}__content`}>\n <span>{message}</span>\n <button className={`${baseClass}__retry`} onClick={onRetry} type=\"button\">\n {t('general:retry')}\n </button>\n </div>\n </div>\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAEA,SAASC,cAAc,QAAQ;AAC/B,OAAOC,KAAA,MAAW;AAIlB,MAAMC,SAAA,GAAY;AAOlB,OAAO,MAAMC,QAAA,GAAoCC,EAAA;EAAA,MAAAC,CAAA,GAAAN,EAAA;EAAC;IAAAO,OAAA;IAAAC;EAAA,IAAAH,EAAoB;EACpE;IAAAI;EAAA,IAAcR,cAAA;EAAA,IAAAS,EAAA;EAAA,IAAAJ,CAAA,QAAAC,OAAA,IAAAD,CAAA,QAAAE,OAAA,IAAAF,CAAA,QAAAG,CAAA;IAEZC,EAAA,GAAAC,IAAA,CAAC;MAAAC,SAAA,EAAAT,SAAA;MAAAU,QAAA,EACCC,KAAA,CAAC;QAAAF,SAAA,EAAe,GAAAT,SAAA,WAAuB;QAAAU,QAAA,GACrCF,IAAA,CAAC;UAAAE,QAAA,EAAMN;QAAA,C,GACPI,IAAA,CAAC;UAAAC,SAAA,EAAkB,GAAAT,SAAA,SAAqB;UAAAY,OAAA,EAAWP,OAAA;UAAAQ,IAAA,EAAc;UAAAH,QAAA,EAC9DJ,CAAA,CAAE;QAAA,C;;;;;;;;;;SAJTC,E;CASJ","ignoreList":[]}
@@ -1,2 +0,0 @@
1
- export declare const DEFAULT_NAV_TAB_SLUG = "nav";
2
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/elements/Nav/SidebarTabs/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,QAAQ,CAAA"}
@@ -1,2 +0,0 @@
1
- export const DEFAULT_NAV_TAB_SLUG = 'nav';
2
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","names":["DEFAULT_NAV_TAB_SLUG"],"sources":["../../../../src/elements/Nav/SidebarTabs/constants.ts"],"sourcesContent":["export const DEFAULT_NAV_TAB_SLUG = 'nav'\n"],"mappings":"AAAA,OAAO,MAAMA,oBAAA,GAAuB","ignoreList":[]}
@@ -1,22 +0,0 @@
1
- import React from 'react';
2
- export type TabMetadata = {
3
- icon: React.ReactNode;
4
- isDefaultActive?: boolean;
5
- label: string;
6
- /** Whether this tab can be loaded/revalidated via serverFunction */
7
- lazyLoadable?: boolean;
8
- slug: string;
9
- };
10
- export type SidebarTabsClientProps = {
11
- baseClass: string;
12
- initialActiveTabID: string;
13
- initialTabContents: Record<string, React.ReactNode>;
14
- /**
15
- * Delay before showing loading spinner (in ms), prevents flashing on fast loads
16
- * @default 200
17
- */
18
- loadingDelay?: number;
19
- tabs: TabMetadata[];
20
- };
21
- export declare const SidebarTabsClient: React.FC<SidebarTabsClientProps>;
22
- //# sourceMappingURL=index.client.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.client.d.ts","sourceRoot":"","sources":["../../../../src/elements/Nav/SidebarTabs/index.client.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAwC,MAAM,OAAO,CAAA;AAM5D,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,KAAK,CAAC,SAAS,CAAA;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,oEAAoE;IACpE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,MAAM,MAAM,sBAAsB,GAAG;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC,CAAA;IACnD;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,EAAE,WAAW,EAAE,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA4L9D,CAAA"}
@@ -1,194 +0,0 @@
1
- 'use client';
2
-
3
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
4
- import { DelayedSpinner, SidebarTabsProvider, Tooltip, usePreferences, useServerFunctions } from '@payloadcms/ui';
5
- import { PREFERENCE_KEYS } from 'payload/shared';
6
- import React, { useCallback, useRef, useState } from 'react';
7
- import { TabError } from './TabError/index.js';
8
- export const SidebarTabsClient = ({
9
- baseClass,
10
- initialActiveTabID,
11
- initialTabContents,
12
- loadingDelay = 200,
13
- tabs
14
- }) => {
15
- const {
16
- setPreference
17
- } = usePreferences();
18
- const {
19
- serverFunction
20
- } = useServerFunctions();
21
- const [activeTabID, setActiveTabID] = useState(initialActiveTabID);
22
- const [tabContent, setTabContent] = useState(initialTabContents);
23
- const [loadingTab, setLoadingTab] = useState(null);
24
- const [hoveredTab, setHoveredTab] = useState(null);
25
- const loadingTabsRef = useRef(new Set());
26
- const tabContentRef = useRef(initialTabContents);
27
- // Update cached content when server provides new initialTabContents
28
- // This is needed because useState only uses initialValue on first mount
29
- React.useEffect(() => {
30
- tabContentRef.current = {
31
- ...tabContentRef.current,
32
- ...initialTabContents
33
- };
34
- setTabContent(prev => ({
35
- ...prev,
36
- ...initialTabContents
37
- }));
38
- }, [initialTabContents]);
39
- const loadTabContent = useCallback(async (tabSlug, {
40
- revalidate = false
41
- } = {}) => {
42
- const hasCachedContent = Boolean(tabContentRef.current[tabSlug]);
43
- // Skip if already loaded (unless revalidating) or currently loading
44
- if (hasCachedContent && !revalidate || loadingTabsRef.current.has(tabSlug)) {
45
- return;
46
- }
47
- // Mark as loading - only show spinner if no cached content
48
- loadingTabsRef.current.add(tabSlug);
49
- if (!hasCachedContent) {
50
- setLoadingTab(tabSlug);
51
- }
52
- try {
53
- const result = await serverFunction({
54
- name: 'render-tab',
55
- args: {
56
- tabSlug
57
- }
58
- });
59
- const newContent_0 = {
60
- ...tabContentRef.current,
61
- [tabSlug]: result.component
62
- };
63
- tabContentRef.current = newContent_0;
64
- setTabContent(newContent_0);
65
- } catch (error) {
66
- // On revalidate failure, keep showing cached content
67
- if (hasCachedContent && revalidate) {
68
- return;
69
- }
70
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
71
- const handleRetry = () => {
72
- // Clear the error and retry loading
73
- const clearedContent = {
74
- ...tabContentRef.current
75
- };
76
- delete clearedContent[tabSlug];
77
- tabContentRef.current = clearedContent;
78
- setTabContent(clearedContent);
79
- void loadTabContent(tabSlug);
80
- };
81
- const newContent = {
82
- ...tabContentRef.current,
83
- [tabSlug]: /*#__PURE__*/_jsx(TabError, {
84
- message: errorMessage,
85
- onRetry: handleRetry
86
- })
87
- };
88
- tabContentRef.current = newContent;
89
- setTabContent(newContent);
90
- } finally {
91
- loadingTabsRef.current.delete(tabSlug);
92
- setLoadingTab(null);
93
- }
94
- }, [serverFunction]);
95
- const reloadTabContent = useCallback(tabSlug_0 => {
96
- // Clear cached content to force reload
97
- const clearedContent_0 = {
98
- ...tabContentRef.current
99
- };
100
- delete clearedContent_0[tabSlug_0];
101
- tabContentRef.current = clearedContent_0;
102
- setTabContent(clearedContent_0);
103
- void loadTabContent(tabSlug_0);
104
- }, [loadTabContent]);
105
- const handleTabChange = useCallback(slug => {
106
- setActiveTabID(slug);
107
- void setPreference(PREFERENCE_KEYS.NAV_SIDEBAR_ACTIVE_TAB, {
108
- activeTab: slug
109
- });
110
- // Only revalidate tabs that can be loaded via serverFunction
111
- // Pre-rendered React elements (like default nav) can't be revalidated
112
- const tab = tabs.find(t => t.slug === slug);
113
- void loadTabContent(slug, {
114
- revalidate: tab?.lazyLoadable ?? false
115
- });
116
- }, [setPreference, loadTabContent, tabs]);
117
- const handleTabKeyDown = useCallback((e, currentIndex) => {
118
- if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
119
- e.preventDefault();
120
- const direction = e.key === 'ArrowLeft' ? -1 : 1;
121
- const newIndex = (currentIndex + direction + tabs.length) % tabs.length;
122
- const newTab = tabs[newIndex];
123
- handleTabChange(newTab.slug);
124
- // Focus will be handled by the tabIndex change
125
- setTimeout(() => {
126
- document.querySelector(`.${baseClass}__tab--active`)?.focus();
127
- }, 0);
128
- }
129
- }, [baseClass, handleTabChange, tabs]);
130
- const activeContent = tabContent[activeTabID];
131
- // If there's only one tab (the default nav), render it without tab UI
132
- if (tabs.length === 1) {
133
- return /*#__PURE__*/_jsx(_Fragment, {
134
- children: activeContent
135
- });
136
- }
137
- return /*#__PURE__*/_jsx(SidebarTabsProvider, {
138
- reloadTabContent: reloadTabContent,
139
- children: /*#__PURE__*/_jsxs("div", {
140
- className: baseClass,
141
- children: [/*#__PURE__*/_jsx("div", {
142
- className: `${baseClass}__tabs`,
143
- role: "tablist",
144
- children: tabs.map((tab_0, index) => {
145
- const isActive = tab_0.slug === activeTabID;
146
- return /*#__PURE__*/_jsxs("button", {
147
- "aria-selected": isActive,
148
- className: `${baseClass}__tab ${isActive ? `${baseClass}__tab--active` : ''}`,
149
- onClick: () => handleTabChange(tab_0.slug),
150
- onKeyDown: e_0 => handleTabKeyDown(e_0, index),
151
- onMouseEnter: () => setHoveredTab(tab_0.slug),
152
- onMouseLeave: () => setHoveredTab(null),
153
- role: "tab",
154
- tabIndex: isActive ? 0 : -1,
155
- type: "button",
156
- children: [/*#__PURE__*/_jsx(Tooltip, {
157
- className: `${baseClass}__tooltip`,
158
- position: index === 0 ? 'bottom' : 'top',
159
- show: hoveredTab === tab_0.slug,
160
- children: tab_0.label
161
- }), /*#__PURE__*/_jsx("span", {
162
- className: `${baseClass}__tab-icon`,
163
- children: tab_0.icon
164
- }), /*#__PURE__*/_jsx("span", {
165
- className: `${baseClass}__tab-label`,
166
- children: tab_0.label
167
- })]
168
- }, tab_0.slug);
169
- })
170
- }), /*#__PURE__*/_jsxs("div", {
171
- className: `${baseClass}__content`,
172
- role: "tabpanel",
173
- children: [/*#__PURE__*/_jsx(DelayedSpinner, {
174
- baseClass: baseClass,
175
- delay: loadingDelay,
176
- isLoading: loadingTab === activeTabID
177
- }), tabs.map(tab_1 => {
178
- const content = tabContent[tab_1.slug];
179
- if (!content) {
180
- return null;
181
- }
182
- const isActive_0 = tab_1.slug === activeTabID && loadingTab !== activeTabID;
183
- return /*#__PURE__*/_jsx("div", {
184
- style: isActive_0 ? undefined : {
185
- display: 'none'
186
- },
187
- children: content
188
- }, tab_1.slug);
189
- })]
190
- })]
191
- })
192
- });
193
- };
194
- //# sourceMappingURL=index.client.js.map