@donotdev/ui 0.3.2 → 0.3.4

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 (232) hide show
  1. package/README.md +2 -3
  2. package/dist/crud/components/EntityCardList.d.ts +4 -1
  3. package/dist/crud/components/EntityCardList.d.ts.map +1 -1
  4. package/dist/crud/components/EntityCardList.js +1 -1
  5. package/dist/crud/components/useRecordBreadcrumb.d.ts +3 -1
  6. package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -1
  7. package/dist/crud/components/useRecordBreadcrumb.js +1 -1
  8. package/dist/dndev.css +205 -865
  9. package/dist/index.js +1 -1
  10. package/dist/internal/devtools/components/LayoutReset.js +1 -1
  11. package/dist/internal/layout/components/AutoMetaTags.d.ts +3 -0
  12. package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
  13. package/dist/internal/layout/components/AutoMetaTags.js +1 -1
  14. package/dist/internal/layout/components/FaviconHead.d.ts +18 -14
  15. package/dist/internal/layout/components/FaviconHead.d.ts.map +1 -1
  16. package/dist/internal/layout/components/FaviconHead.js +1 -1
  17. package/dist/internal/layout/components/FontHead.d.ts +30 -0
  18. package/dist/internal/layout/components/FontHead.d.ts.map +1 -0
  19. package/dist/internal/layout/components/FontHead.js +1 -0
  20. package/dist/internal/layout/components/headTagElement.d.ts +16 -0
  21. package/dist/internal/layout/components/headTagElement.d.ts.map +1 -0
  22. package/dist/internal/layout/components/headTagElement.js +1 -0
  23. package/dist/internal/layout/components/prerenderedHead.d.ts +15 -0
  24. package/dist/internal/layout/components/prerenderedHead.d.ts.map +1 -0
  25. package/dist/internal/layout/components/prerenderedHead.js +1 -0
  26. package/dist/internal/layout/components/trailingSlash.d.ts +13 -0
  27. package/dist/internal/layout/components/trailingSlash.d.ts.map +1 -0
  28. package/dist/internal/layout/components/trailingSlash.js +1 -0
  29. package/dist/internal/layout/zones/DnDevMergedBar.d.ts.map +1 -1
  30. package/dist/internal/layout/zones/DnDevMergedBar.js +1 -1
  31. package/dist/next.d.ts +2 -1
  32. package/dist/next.d.ts.map +1 -1
  33. package/dist/next.js +1 -1
  34. package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
  35. package/dist/providers/ViteAppProviders.d.ts +11 -9
  36. package/dist/providers/ViteAppProviders.d.ts.map +1 -1
  37. package/dist/providers/ViteAppProviders.js +1 -1
  38. package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
  39. package/dist/routing/DnDevNavigationMenu.js +1 -1
  40. package/dist/routing/hooks/hooks.next.js +1 -1
  41. package/dist/routing/hooks/useRoutePath.next.d.ts +5 -3
  42. package/dist/routing/hooks/useRoutePath.next.d.ts.map +1 -1
  43. package/dist/routing/hooks/useRoutePath.next.js +1 -1
  44. package/dist/routing/useRouteDiscovery.d.ts +3 -0
  45. package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
  46. package/dist/styles/index.css +202 -59
  47. package/dist/symbol-index.json +1 -1
  48. package/dist/utils/assetResolver.d.ts +19 -19
  49. package/dist/utils/assetResolver.d.ts.map +1 -1
  50. package/dist/utils/assetResolver.js +1 -1
  51. package/dist/utils/index.d.ts +0 -1
  52. package/dist/utils/index.d.ts.map +1 -1
  53. package/dist/utils/index.js +1 -1
  54. package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
  55. package/dist/vite-routing/AppRoutes.js +1 -1
  56. package/guidelines/ROUTING.md +1 -0
  57. package/guidelines/SEO.md +160 -145
  58. package/package.json +9 -10
  59. package/dist/dndev-next.css +0 -13702
  60. package/dist/files/inter-cyrillic-300-normal.woff +0 -0
  61. package/dist/files/inter-cyrillic-300-normal.woff2 +0 -0
  62. package/dist/files/inter-cyrillic-400-normal.woff +0 -0
  63. package/dist/files/inter-cyrillic-400-normal.woff2 +0 -0
  64. package/dist/files/inter-cyrillic-600-normal.woff +0 -0
  65. package/dist/files/inter-cyrillic-600-normal.woff2 +0 -0
  66. package/dist/files/inter-cyrillic-700-normal.woff +0 -0
  67. package/dist/files/inter-cyrillic-700-normal.woff2 +0 -0
  68. package/dist/files/inter-cyrillic-ext-300-normal.woff +0 -0
  69. package/dist/files/inter-cyrillic-ext-300-normal.woff2 +0 -0
  70. package/dist/files/inter-cyrillic-ext-400-normal.woff +0 -0
  71. package/dist/files/inter-cyrillic-ext-400-normal.woff2 +0 -0
  72. package/dist/files/inter-cyrillic-ext-600-normal.woff +0 -0
  73. package/dist/files/inter-cyrillic-ext-600-normal.woff2 +0 -0
  74. package/dist/files/inter-cyrillic-ext-700-normal.woff +0 -0
  75. package/dist/files/inter-cyrillic-ext-700-normal.woff2 +0 -0
  76. package/dist/files/inter-greek-300-normal.woff +0 -0
  77. package/dist/files/inter-greek-300-normal.woff2 +0 -0
  78. package/dist/files/inter-greek-400-normal.woff +0 -0
  79. package/dist/files/inter-greek-400-normal.woff2 +0 -0
  80. package/dist/files/inter-greek-600-normal.woff +0 -0
  81. package/dist/files/inter-greek-600-normal.woff2 +0 -0
  82. package/dist/files/inter-greek-700-normal.woff +0 -0
  83. package/dist/files/inter-greek-700-normal.woff2 +0 -0
  84. package/dist/files/inter-greek-ext-300-normal.woff +0 -0
  85. package/dist/files/inter-greek-ext-300-normal.woff2 +0 -0
  86. package/dist/files/inter-greek-ext-400-normal.woff +0 -0
  87. package/dist/files/inter-greek-ext-400-normal.woff2 +0 -0
  88. package/dist/files/inter-greek-ext-600-normal.woff +0 -0
  89. package/dist/files/inter-greek-ext-600-normal.woff2 +0 -0
  90. package/dist/files/inter-greek-ext-700-normal.woff +0 -0
  91. package/dist/files/inter-greek-ext-700-normal.woff2 +0 -0
  92. package/dist/files/inter-latin-300-normal.woff +0 -0
  93. package/dist/files/inter-latin-300-normal.woff2 +0 -0
  94. package/dist/files/inter-latin-400-normal.woff +0 -0
  95. package/dist/files/inter-latin-400-normal.woff2 +0 -0
  96. package/dist/files/inter-latin-600-normal.woff +0 -0
  97. package/dist/files/inter-latin-600-normal.woff2 +0 -0
  98. package/dist/files/inter-latin-700-normal.woff +0 -0
  99. package/dist/files/inter-latin-700-normal.woff2 +0 -0
  100. package/dist/files/inter-latin-ext-300-normal.woff +0 -0
  101. package/dist/files/inter-latin-ext-300-normal.woff2 +0 -0
  102. package/dist/files/inter-latin-ext-400-normal.woff +0 -0
  103. package/dist/files/inter-latin-ext-400-normal.woff2 +0 -0
  104. package/dist/files/inter-latin-ext-600-normal.woff +0 -0
  105. package/dist/files/inter-latin-ext-600-normal.woff2 +0 -0
  106. package/dist/files/inter-latin-ext-700-normal.woff +0 -0
  107. package/dist/files/inter-latin-ext-700-normal.woff2 +0 -0
  108. package/dist/files/inter-vietnamese-300-normal.woff +0 -0
  109. package/dist/files/inter-vietnamese-300-normal.woff2 +0 -0
  110. package/dist/files/inter-vietnamese-400-normal.woff +0 -0
  111. package/dist/files/inter-vietnamese-400-normal.woff2 +0 -0
  112. package/dist/files/inter-vietnamese-600-normal.woff +0 -0
  113. package/dist/files/inter-vietnamese-600-normal.woff2 +0 -0
  114. package/dist/files/inter-vietnamese-700-normal.woff +0 -0
  115. package/dist/files/inter-vietnamese-700-normal.woff2 +0 -0
  116. package/dist/files/playfair-display-cyrillic-400-normal.woff +0 -0
  117. package/dist/files/playfair-display-cyrillic-400-normal.woff2 +0 -0
  118. package/dist/files/playfair-display-cyrillic-500-normal.woff +0 -0
  119. package/dist/files/playfair-display-cyrillic-500-normal.woff2 +0 -0
  120. package/dist/files/playfair-display-cyrillic-600-normal.woff +0 -0
  121. package/dist/files/playfair-display-cyrillic-600-normal.woff2 +0 -0
  122. package/dist/files/playfair-display-cyrillic-700-normal.woff +0 -0
  123. package/dist/files/playfair-display-cyrillic-700-normal.woff2 +0 -0
  124. package/dist/files/playfair-display-latin-400-normal.woff +0 -0
  125. package/dist/files/playfair-display-latin-400-normal.woff2 +0 -0
  126. package/dist/files/playfair-display-latin-500-normal.woff +0 -0
  127. package/dist/files/playfair-display-latin-500-normal.woff2 +0 -0
  128. package/dist/files/playfair-display-latin-600-normal.woff +0 -0
  129. package/dist/files/playfair-display-latin-600-normal.woff2 +0 -0
  130. package/dist/files/playfair-display-latin-700-normal.woff +0 -0
  131. package/dist/files/playfair-display-latin-700-normal.woff2 +0 -0
  132. package/dist/files/playfair-display-latin-ext-400-normal.woff +0 -0
  133. package/dist/files/playfair-display-latin-ext-400-normal.woff2 +0 -0
  134. package/dist/files/playfair-display-latin-ext-500-normal.woff +0 -0
  135. package/dist/files/playfair-display-latin-ext-500-normal.woff2 +0 -0
  136. package/dist/files/playfair-display-latin-ext-600-normal.woff +0 -0
  137. package/dist/files/playfair-display-latin-ext-600-normal.woff2 +0 -0
  138. package/dist/files/playfair-display-latin-ext-700-normal.woff +0 -0
  139. package/dist/files/playfair-display-latin-ext-700-normal.woff2 +0 -0
  140. package/dist/files/playfair-display-vietnamese-400-normal.woff +0 -0
  141. package/dist/files/playfair-display-vietnamese-400-normal.woff2 +0 -0
  142. package/dist/files/playfair-display-vietnamese-500-normal.woff +0 -0
  143. package/dist/files/playfair-display-vietnamese-500-normal.woff2 +0 -0
  144. package/dist/files/playfair-display-vietnamese-600-normal.woff +0 -0
  145. package/dist/files/playfair-display-vietnamese-600-normal.woff2 +0 -0
  146. package/dist/files/playfair-display-vietnamese-700-normal.woff +0 -0
  147. package/dist/files/playfair-display-vietnamese-700-normal.woff2 +0 -0
  148. package/dist/files/press-start-2p-cyrillic-400-normal.woff +0 -0
  149. package/dist/files/press-start-2p-cyrillic-400-normal.woff2 +0 -0
  150. package/dist/files/press-start-2p-cyrillic-ext-400-normal.woff +0 -0
  151. package/dist/files/press-start-2p-cyrillic-ext-400-normal.woff2 +0 -0
  152. package/dist/files/press-start-2p-greek-400-normal.woff +0 -0
  153. package/dist/files/press-start-2p-greek-400-normal.woff2 +0 -0
  154. package/dist/files/press-start-2p-latin-400-normal.woff +0 -0
  155. package/dist/files/press-start-2p-latin-400-normal.woff2 +0 -0
  156. package/dist/files/press-start-2p-latin-ext-400-normal.woff +0 -0
  157. package/dist/files/press-start-2p-latin-ext-400-normal.woff2 +0 -0
  158. package/dist/files/roboto-cyrillic-400-normal.woff +0 -0
  159. package/dist/files/roboto-cyrillic-400-normal.woff2 +0 -0
  160. package/dist/files/roboto-cyrillic-700-normal.woff +0 -0
  161. package/dist/files/roboto-cyrillic-700-normal.woff2 +0 -0
  162. package/dist/files/roboto-cyrillic-ext-400-normal.woff +0 -0
  163. package/dist/files/roboto-cyrillic-ext-400-normal.woff2 +0 -0
  164. package/dist/files/roboto-cyrillic-ext-700-normal.woff +0 -0
  165. package/dist/files/roboto-cyrillic-ext-700-normal.woff2 +0 -0
  166. package/dist/files/roboto-greek-400-normal.woff +0 -0
  167. package/dist/files/roboto-greek-400-normal.woff2 +0 -0
  168. package/dist/files/roboto-greek-700-normal.woff +0 -0
  169. package/dist/files/roboto-greek-700-normal.woff2 +0 -0
  170. package/dist/files/roboto-greek-ext-400-normal.woff +0 -0
  171. package/dist/files/roboto-greek-ext-400-normal.woff2 +0 -0
  172. package/dist/files/roboto-greek-ext-700-normal.woff +0 -0
  173. package/dist/files/roboto-greek-ext-700-normal.woff2 +0 -0
  174. package/dist/files/roboto-latin-400-normal.woff +0 -0
  175. package/dist/files/roboto-latin-400-normal.woff2 +0 -0
  176. package/dist/files/roboto-latin-700-normal.woff +0 -0
  177. package/dist/files/roboto-latin-700-normal.woff2 +0 -0
  178. package/dist/files/roboto-latin-ext-400-normal.woff +0 -0
  179. package/dist/files/roboto-latin-ext-400-normal.woff2 +0 -0
  180. package/dist/files/roboto-latin-ext-700-normal.woff +0 -0
  181. package/dist/files/roboto-latin-ext-700-normal.woff2 +0 -0
  182. package/dist/files/roboto-math-400-normal.woff +0 -0
  183. package/dist/files/roboto-math-400-normal.woff2 +0 -0
  184. package/dist/files/roboto-math-700-normal.woff +0 -0
  185. package/dist/files/roboto-math-700-normal.woff2 +0 -0
  186. package/dist/files/roboto-symbols-400-normal.woff +0 -0
  187. package/dist/files/roboto-symbols-400-normal.woff2 +0 -0
  188. package/dist/files/roboto-symbols-700-normal.woff +0 -0
  189. package/dist/files/roboto-symbols-700-normal.woff2 +0 -0
  190. package/dist/files/roboto-vietnamese-400-normal.woff +0 -0
  191. package/dist/files/roboto-vietnamese-400-normal.woff2 +0 -0
  192. package/dist/files/roboto-vietnamese-700-normal.woff +0 -0
  193. package/dist/files/roboto-vietnamese-700-normal.woff2 +0 -0
  194. package/dist/files/space-grotesk-latin-300-normal.woff +0 -0
  195. package/dist/files/space-grotesk-latin-300-normal.woff2 +0 -0
  196. package/dist/files/space-grotesk-latin-400-normal.woff +0 -0
  197. package/dist/files/space-grotesk-latin-400-normal.woff2 +0 -0
  198. package/dist/files/space-grotesk-latin-500-normal.woff +0 -0
  199. package/dist/files/space-grotesk-latin-500-normal.woff2 +0 -0
  200. package/dist/files/space-grotesk-latin-600-normal.woff +0 -0
  201. package/dist/files/space-grotesk-latin-600-normal.woff2 +0 -0
  202. package/dist/files/space-grotesk-latin-700-normal.woff +0 -0
  203. package/dist/files/space-grotesk-latin-700-normal.woff2 +0 -0
  204. package/dist/files/space-grotesk-latin-ext-300-normal.woff +0 -0
  205. package/dist/files/space-grotesk-latin-ext-300-normal.woff2 +0 -0
  206. package/dist/files/space-grotesk-latin-ext-400-normal.woff +0 -0
  207. package/dist/files/space-grotesk-latin-ext-400-normal.woff2 +0 -0
  208. package/dist/files/space-grotesk-latin-ext-500-normal.woff +0 -0
  209. package/dist/files/space-grotesk-latin-ext-500-normal.woff2 +0 -0
  210. package/dist/files/space-grotesk-latin-ext-600-normal.woff +0 -0
  211. package/dist/files/space-grotesk-latin-ext-600-normal.woff2 +0 -0
  212. package/dist/files/space-grotesk-latin-ext-700-normal.woff +0 -0
  213. package/dist/files/space-grotesk-latin-ext-700-normal.woff2 +0 -0
  214. package/dist/files/space-grotesk-vietnamese-300-normal.woff +0 -0
  215. package/dist/files/space-grotesk-vietnamese-300-normal.woff2 +0 -0
  216. package/dist/files/space-grotesk-vietnamese-400-normal.woff +0 -0
  217. package/dist/files/space-grotesk-vietnamese-400-normal.woff2 +0 -0
  218. package/dist/files/space-grotesk-vietnamese-500-normal.woff +0 -0
  219. package/dist/files/space-grotesk-vietnamese-500-normal.woff2 +0 -0
  220. package/dist/files/space-grotesk-vietnamese-600-normal.woff +0 -0
  221. package/dist/files/space-grotesk-vietnamese-600-normal.woff2 +0 -0
  222. package/dist/files/space-grotesk-vietnamese-700-normal.woff +0 -0
  223. package/dist/files/space-grotesk-vietnamese-700-normal.woff2 +0 -0
  224. package/dist/internal/layout/components/FontPreloadLinks.d.ts +0 -19
  225. package/dist/internal/layout/components/FontPreloadLinks.d.ts.map +0 -1
  226. package/dist/internal/layout/components/FontPreloadLinks.js +0 -1
  227. package/dist/internal/layout/components/i18nSeoMeta.d.ts +0 -54
  228. package/dist/internal/layout/components/i18nSeoMeta.d.ts.map +0 -1
  229. package/dist/internal/layout/components/i18nSeoMeta.js +0 -1
  230. package/dist/utils/useSeo.d.ts +0 -129
  231. package/dist/utils/useSeo.d.ts.map +0 -1
  232. package/dist/utils/useSeo.js +0 -1
package/README.md CHANGED
@@ -213,11 +213,10 @@ Automatic SEO meta tags:
213
213
 
214
214
  ### Favicon System
215
215
 
216
- Automatic PWA-compliant favicons:
216
+ Automatic favicon tags (icons, apple-touch-icon, theme-color, color-scheme), in the server HTML on Next (`FaviconHead`) and written into `index.html` by the Vite build. Declare none in `AppDocument` / `index.html`.
217
217
 
218
218
  ```tsx
219
- // Favicon is automatic - uses useFaviconConfig() internally
220
- // Configure via config.favicon
219
+ // Favicon is automatic - configure via config.favicon (false disables it)
221
220
  ```
222
221
 
223
222
  ## Provider Hierarchy
@@ -10,7 +10,10 @@ export type { EntityCardListProps };
10
10
  * - Simple formatted text display (labels + values)
11
11
  * - Empty state handling
12
12
  * - Auto-routing when handler not provided
13
+ * - Opt-in feed rendering (`pageSize`): the first `pageSize` cards render (server HTML
14
+ * included), `pageSize` more are added as the end of the grid nears the viewport,
15
+ * until every card is shown. Without `pageSize`, every card renders at once.
13
16
  */
14
- export declare function EntityCardList({ entity, basePath, onClick, cols, staleTime, // 30 minutes default cache
17
+ export declare function EntityCardList({ entity, basePath, onClick, cols, pageSize, staleTime, // 30 minutes default cache
15
18
  queryOptions, filter, hideFilters, resultLabel, tone, renderCardOverlay, clientSort, collapsible, defaultOpen, preview, }: EntityCardListProps): import("react").JSX.Element | null;
16
19
  //# sourceMappingURL=EntityCardList.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EntityCardList.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityCardList.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,mBAAmB,EAAgB,MAAM,gBAAgB,CAAC;AAaxE,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAwGpC;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAmB,EACnB,SAA0B,EAAE,2BAA2B;AACvD,YAAY,EACZ,MAAM,EACN,WAAmB,EACnB,WAAW,EACX,IAAI,EACJ,iBAAiB,EACjB,UAAU,EACV,WAAmB,EACnB,WAAW,EACX,OAAO,GACR,EAAE,mBAAmB,sCA6NrB"}
1
+ {"version":3,"file":"EntityCardList.d.ts","sourceRoot":"","sources":["../../../src/crud/components/EntityCardList.tsx"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAAE,mBAAmB,EAAgB,MAAM,gBAAgB,CAAC;AAaxE,YAAY,EAAE,mBAAmB,EAAE,CAAC;AA2GpC;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,QAAQ,EACR,OAAO,EACP,IAAmB,EACnB,QAAQ,EACR,SAA0B,EAAE,2BAA2B;AACvD,YAAY,EACZ,MAAM,EACN,WAAmB,EACnB,WAAW,EACX,IAAI,EACJ,iBAAiB,EACjB,UAAU,EACV,WAAmB,EACnB,WAAW,EACX,OAAO,GACR,EAAE,mBAAmB,sCAwPrB"}
@@ -1 +1 @@
1
- "use client";import{Heart as O}from"lucide-react";import{useMemo as U,useCallback as W}from"react";import{Card as $,Grid as B,Stack as k,Text as f,Skeleton as m,Section as I,Button as Y}from"@donotdev/components";import{useTranslation as N,getListCardFieldNames as D,useBreakpoint as Z}from"@donotdev/core";import{isCrudModuleAvailable as tt,useCrudCardList as et,EntityFilters as rt,useEntityFavorites as ot,useCrudFilters as it}from"../crudImports.js";import{CrudCard as nt}from"./CrudCardLink.js";import{useNavigate as st}from"../../routing/index.js";import{useAuthSafe as lt}from"../../utils/useAuthSafe.js";import{Fragment as ft,jsx as t,jsxs as F}from"react/jsx-runtime";function at(e){let d=e.listCardFields;if(d&&!Array.isArray(d)){let i=d;return{titleFields:i.title??[],subtitleFields:i.subtitle??[],contentFields:i.content??[],footerFields:i.footer??[]}}let o=D(e),c=i=>{let g=e.fields[i]?.type;return g==="image"||g==="images"},u=o.filter(i=>!c(i)),v=o.filter(c);return{titleFields:u.length>0?[u[0]]:[],subtitleFields:[],contentFields:[...u.slice(1,4),...v],footerFields:[]}}var dt={mobile:0,tablet:1,laptop:2,desktop:3};function ct({cols:e,entity:d}){let o=at(d),c=Z("current"),v=((Array.isArray(e)?e[dt[c]??3]:e)??1)*3,i=a=>{let p=d.fields[a]?.type;return p==="image"||p==="images"},g=o.contentFields.length>0?t(k,{direction:"column",gap:"tight",children:o.contentFields.map(a=>i(a)?t(m,{height:120},a):F("div",{children:[t(f,{level:"small",variant:"muted",children:t(m,{})}),t(f,{children:t(m,{})})]},a))}):void 0,h=o.footerFields.length>0?t(f,{level:"small",children:t(m,{})}):void 0;return t(B,{cols:e,children:Array.from({length:v},(a,p)=>t($,{title:t(m,{}),subtitle:o.subtitleFields.length>0?t(m,{}):void 0,content:g,footer:h,elevated:!0},p))})}function Et({entity:e,basePath:d,onClick:o,cols:c=[1,2,3,4],staleTime:u=1e3*60*30,queryOptions:v,filter:i,hideFilters:g=!1,resultLabel:h,tone:a,renderCardOverlay:p,clientSort:G,collapsible:b=!1,defaultOpen:H,preview:x}){if(!tt)return null;let r=!!x,w=st(),M=lt("userRole"),T=d??`/${e.collection}`,{items:V,processed:_,loading:j,error:C}=et(e,{enabled:!r,staleTime:u,queryOptions:v,clientSort:G}),P=r?!1:j,{isFavorite:A,toggleFavorite:z,favoritesFilter:K}=ot({collection:e.collection}),{showFavoritesOnly:S,setShowFavoritesOnly:X,filters:ut,setFilters:gt}=it({collection:e.collection}),s=r?x:_;r||(S&&(s=s.filter(K)),i&&(s=s.filter(i)),s=s.toSorted((n,y)=>{let L=A(String(n.id))?0:1,E=A(String(y.id))?0:1;return L-E}));let{t:q}=N([e.namespace,"crud"]),{t:l}=N("crud"),J=W(n=>{r||(o?o(n):w(`${T}/${n}`))},[T,w,o,r]),Q=U(()=>D(e),[e]),R=q("name",{defaultValue:e.name});return F(ft,{children:[!g&&t(I,{title:l("filters.title",{entity:R}),collapsible:b,defaultOpen:H,tone:a,children:t($,{children:F(k,{direction:"column",children:[t(Y,{variant:!r&&S?"primary":"outline",icon:t(O,{size:18}),onClick:()=>X(!S),disabled:r,children:l(S?"favorites.showAll":"favorites.showFavorites")}),!r&&t(rt,{entity:e,data:V,fieldsToFilter:Q,viewerRole:M})]})})}),t(I,{title:P?l("results.title.fetching"):h?h(s.length):l("results.title.count",{count:s.length}),collapsible:b,defaultOpen:b?!0:void 0,tone:a,children:P?t(ct,{cols:c,entity:e}):C?F(k,{align:"center",justify:"center",style:{padding:"var(--gap-lg)",textAlign:"center"},children:[t(f,{level:"h3",style:{color:"var(--destructive)"},children:l("errors.fetchFailed",{entity:R})}),t(f,{level:"small",style:{color:"var(--destructive)"},children:C instanceof Error?C.message:String(C)})]}):s.length===0?F(k,{align:"center",justify:"center",style:{padding:"var(--gap-lg)",textAlign:"center"},children:[t(f,{level:"h3",style:{color:"var(--muted-foreground)"},children:l("emptyState.title")}),t(f,{style:{color:"var(--muted-foreground)"},children:l("emptyState.description")})]}):t(B,{cols:c,children:s.map(n=>{let y=A(n.id),L=r||o?void 0:`${T}/${n.id}`;return t(nt,{item:n,entity:e,detailHref:L,onClick:r?void 0:o?()=>J(n.id):void 0,renderOverlay:p?.(n),renderActions:t(O,{fill:y?"#ef4444":"#ffffff",stroke:y?"#ef4444":"var(--muted-foreground)",onClick:E=>{E.preventDefault(),E.stopPropagation(),r||z(n.id)},style:{cursor:r?"default":"pointer",width:"var(--icon-md)",height:"var(--icon-md)",transition:"fill 0.2s, stroke 0.2s",opacity:r?.5:1},"aria-label":l(y?"favorites.remove":"favorites.add")})},n.id)})})})]})}export{Et as EntityCardList};
1
+ "use client";import{Heart as O}from"lucide-react";import{useMemo as rt,useCallback as ot,useEffect as it,useRef as nt,useState as st}from"react";import{Card as G,Grid as H,Stack as b,Text as v,Skeleton as p,Section as $,Button as lt,observeElement as at}from"@donotdev/components";import{useTranslation as B,getListCardFieldNames as V,useBreakpoint as dt}from"@donotdev/core";import{isCrudModuleAvailable as ct,useCrudCardList as ut,EntityFilters as ft,useEntityFavorites as gt,useCrudFilters as mt}from"../crudImports.js";import{CrudCard as vt}from"./CrudCardLink.js";import{useNavigate as pt}from"../../routing/index.js";import{useAuthSafe as yt}from"../../utils/useAuthSafe.js";import{Fragment as D,jsx as t,jsxs as y}from"react/jsx-runtime";function ht(e){let c=e.listCardFields;if(c&&!Array.isArray(c)){let n=c;return{titleFields:n.title??[],subtitleFields:n.subtitle??[],contentFields:n.content??[],footerFields:n.footer??[]}}let i=V(e),u=n=>{let f=e.fields[n]?.type;return f==="image"||f==="images"},l=i.filter(n=>!u(n)),h=i.filter(u);return{titleFields:l.length>0?[l[0]]:[],subtitleFields:[],contentFields:[...l.slice(1,4),...h],footerFields:[]}}var Ft="600px 0px",Ct={mobile:0,tablet:1,laptop:2,desktop:3};function Et({cols:e,entity:c}){let i=ht(c),u=dt("current"),h=((Array.isArray(e)?e[Ct[u]??3]:e)??1)*3,n=d=>{let g=c.fields[d]?.type;return g==="image"||g==="images"},f=i.contentFields.length>0?t(b,{direction:"column",gap:"tight",children:i.contentFields.map(d=>n(d)?t(p,{height:120},d):y("div",{children:[t(v,{level:"small",variant:"muted",children:t(p,{})}),t(v,{children:t(p,{})})]},d))}):void 0,k=i.footerFields.length>0?t(v,{level:"small",children:t(p,{})}):void 0;return t(H,{cols:e,children:Array.from({length:h},(d,g)=>t(G,{title:t(p,{}),subtitle:i.subtitleFields.length>0?t(p,{}):void 0,content:f,footer:k,elevated:!0},g))})}function It({entity:e,basePath:c,onClick:i,cols:u=[1,2,3,4],pageSize:l,staleTime:h=1e3*60*30,queryOptions:n,filter:f,hideFilters:k=!1,resultLabel:d,tone:g,renderCardOverlay:_,clientSort:j,collapsible:A=!1,defaultOpen:K,preview:P}){if(!ct)return null;let o=!!P,I=pt(),X=yt("userRole"),L=c??`/${e.collection}`,{items:q,processed:J,loading:Q,error:F}=ut(e,{enabled:!o,staleTime:h,queryOptions:n,clientSort:j}),T=o?!1:Q,{isFavorite:x,toggleFavorite:U,favoritesFilter:W}=gt({collection:e.collection}),{showFavoritesOnly:E,setShowFavoritesOnly:Y,filters:St,setFilters:bt}=mt({collection:e.collection}),s=o?P:J;o||(E&&(s=s.filter(W)),f&&(s=s.filter(f)),s=s.toSorted((r,m)=>{let C=x(String(r.id))?0:1,S=x(String(m.id))?0:1;return C-S}));let[R,Z]=st(l??1/0),M=nt(null),w=l!=null&&!T&&!F&&R<s.length;it(()=>{let r=M.current;if(!(!r||!w||l==null))return at(r,m=>{m.isIntersecting&&Z(C=>C+l)},{rootMargin:Ft})},[w,R,l]);let{t:z}=B([e.namespace,"crud"]),{t:a}=B("crud"),tt=ot(r=>{o||(i?i(r):I(`${L}/${r}`))},[L,I,i,o]),et=rt(()=>V(e),[e]),N=z("name",{defaultValue:e.name});return y(D,{children:[!k&&t($,{title:a("filters.title",{entity:N}),collapsible:A,defaultOpen:K,tone:g,children:t(G,{children:y(b,{direction:"column",children:[t(lt,{variant:!o&&E?"primary":"outline",icon:t(O,{size:18}),onClick:()=>Y(!E),disabled:o,children:a(E?"favorites.showAll":"favorites.showFavorites")}),!o&&t(ft,{entity:e,data:q,fieldsToFilter:et,viewerRole:X})]})})}),t($,{title:T?a("results.title.fetching"):d?d(s.length):a("results.title.count",{count:s.length}),collapsible:A,defaultOpen:A?!0:void 0,tone:g,children:T?t(Et,{cols:u,entity:e}):F?y(b,{align:"center",justify:"center",style:{padding:"var(--gap-lg)",textAlign:"center"},children:[t(v,{level:"h3",style:{color:"var(--destructive)"},children:a("errors.fetchFailed",{entity:N})}),t(v,{level:"small",style:{color:"var(--destructive)"},children:F instanceof Error?F.message:String(F)})]}):s.length===0?y(b,{align:"center",justify:"center",style:{padding:"var(--gap-lg)",textAlign:"center"},children:[t(v,{level:"h3",style:{color:"var(--muted-foreground)"},children:a("emptyState.title")}),t(v,{style:{color:"var(--muted-foreground)"},children:a("emptyState.description")})]}):y(D,{children:[t(H,{cols:u,children:s.slice(0,R).map(r=>{let m=x(r.id),C=o||i?void 0:`${L}/${r.id}`;return t(vt,{item:r,entity:e,detailHref:C,onClick:o?void 0:i?()=>tt(r.id):void 0,renderOverlay:_?.(r),renderActions:t(O,{fill:m?"#ef4444":"#ffffff",stroke:m?"#ef4444":"var(--muted-foreground)",onClick:S=>{S.preventDefault(),S.stopPropagation(),o||U(r.id)},style:{cursor:o?"default":"pointer",width:"var(--icon-md)",height:"var(--icon-md)",transition:"fill 0.2s, stroke 0.2s",opacity:o?.5:1},"aria-label":a(m?"favorites.remove":"favorites.add")})},r.id)})}),w&&t("div",{ref:M,"aria-hidden":"true"})]})})]})}export{It as EntityCardList};
@@ -1,7 +1,9 @@
1
1
  import type { AnyEntity } from '@donotdev/core';
2
2
  /**
3
3
  * Names the shown record in the breadcrumbs: the entity's card title, formatted like
4
- * the card (the same title `<Seo entity>` uses). Cleared when the page unmounts or the record
4
+ * the card (the same title `deriveEntitySeo` gives the entity page's metadata and the last
5
+ * BreadcrumbList item), on the segment naming the record ({@link recordSegment}: its slug
6
+ * on `/produits/:slug`, its id on `/products/:id`). Cleared when the page unmounts or the record
5
7
  * has no title, unless another component replaced it meanwhile (its label stays). Client effect: the server render keeps the URL segment.
6
8
  *
7
9
  * @param entity - Entity of the record
@@ -1 +1 @@
1
- {"version":3,"file":"useRecordBreadcrumb.d.ts","sourceRoot":"","sources":["../../../src/crud/components/useRecordBreadcrumb.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GACjD,IAAI,CAqBN"}
1
+ {"version":3,"file":"useRecordBreadcrumb.d.ts","sourceRoot":"","sources":["../../../src/crud/components/useRecordBreadcrumb.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAoChD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GACjD,IAAI,CAuBN"}
@@ -1 +1 @@
1
- "use client";import{useEffect as a,useRef as f}from"react";import{deriveEntitySeo as m,useLayout as c,useTranslation as R}from"@donotdev/core";function b(r,e){let o=c("setRouteRecordLabel"),u=c("routeRecordLabel"),i=f(u);i.current=u;let n=typeof e?.id=="string"?e.id:void 0,{t:d,language:l}=R([r.namespace,"crud"]),t=e?m(r,e,{t:d,locale:l}).title:void 0;a(()=>{if(!(!n||!t))return o({id:n,label:t}),()=>{let s=i.current;s?.id===n&&s.label===t&&o(null)}},[n,t,o])}export{b as useRecordBreadcrumb};
1
+ "use client";import{useEffect as l,useRef as g}from"react";import{deriveEntitySeo as m,useLayout as c,useTranslation as p}from"@donotdev/core";import{useParams as y}from"@donotdev/ui/routing/hooks";function R(n){try{return decodeURIComponent(n)}catch{return n}}function b(n,t){for(let[o,r]of Object.entries(t)){let e=n[o];if(typeof r=="string"&&!(typeof e!="string"&&typeof e!="number")&&(String(e)===r||String(e)===R(r)))return String(e)}return typeof n.id=="string"?n.id:void 0}function L(n,t){let o=c("setRouteRecordLabel"),r=c("routeRecordLabel"),e=g(r);e.current=r;let d=y(),i=t?b(t,d):void 0,{t:f,language:a}=p([n.namespace,"crud"]),u=t?m(n,t,{t:f,locale:a}).title:void 0;l(()=>{if(!(!i||!u))return o({id:i,label:u}),()=>{let s=e.current;s?.id===i&&s.label===u&&o(null)}},[i,u,o])}export{L as useRecordBreadcrumb};