@donotdev/ui 0.3.1 → 0.3.2

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 (299) hide show
  1. package/dist/components/auth/AuthHeader.js +1 -93
  2. package/dist/components/auth/AuthMenu.d.ts.map +1 -1
  3. package/dist/components/auth/AuthMenu.js +3 -286
  4. package/dist/components/auth/index.js +1 -9
  5. package/dist/components/common/FeatureCard.d.ts.map +1 -1
  6. package/dist/components/common/FeatureCard.js +1 -86
  7. package/dist/components/common/FeatureDisabled.js +1 -67
  8. package/dist/components/common/IconPlaceholder.d.ts +24 -0
  9. package/dist/components/common/IconPlaceholder.d.ts.map +1 -0
  10. package/dist/components/common/IconPlaceholder.js +1 -0
  11. package/dist/components/common/LazyLucideIcon.d.ts +39 -0
  12. package/dist/components/common/LazyLucideIcon.d.ts.map +1 -0
  13. package/dist/components/common/LazyLucideIcon.js +1 -0
  14. package/dist/components/common/ProgressBar.js +1 -84
  15. package/dist/components/common/RedirectOverlay.js +1 -243
  16. package/dist/components/common/Skeleton.js +1 -144
  17. package/dist/components/common/TechBento.d.ts.map +1 -1
  18. package/dist/components/common/TechBento.js +1 -53
  19. package/dist/components/common/icon.d.ts +1 -1
  20. package/dist/components/common/icon.d.ts.map +1 -1
  21. package/dist/components/common/icon.js +1 -84
  22. package/dist/components/common/iconByName.d.ts +33 -0
  23. package/dist/components/common/iconByName.d.ts.map +1 -0
  24. package/dist/components/common/iconByName.js +1 -0
  25. package/dist/components/common/index.js +1 -16
  26. package/dist/components/cookie-consent/ConsentBanner.d.ts +3 -1
  27. package/dist/components/cookie-consent/ConsentBanner.d.ts.map +1 -1
  28. package/dist/components/cookie-consent/ConsentBanner.js +1 -31
  29. package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
  30. package/dist/components/cookie-consent/CookieConsent.js +1 -183
  31. package/dist/components/cookie-consent/index.js +1 -11
  32. package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts +7 -0
  33. package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts.map +1 -0
  34. package/dist/components/cookie-consent/useCookieNoticeRequired.js +1 -0
  35. package/dist/components/index.js +1 -13
  36. package/dist/components/layout/GameContainer.d.ts.map +1 -1
  37. package/dist/components/layout/GameContainer.js +1 -72
  38. package/dist/components/layout/GameFlow.d.ts.map +1 -1
  39. package/dist/components/layout/GameFlow.js +1 -93
  40. package/dist/components/layout/PageConfig.d.ts.map +1 -1
  41. package/dist/components/layout/PageConfig.js +1 -47
  42. package/dist/components/layout/PageContainer.d.ts.map +1 -1
  43. package/dist/components/layout/PageContainer.js +1 -38
  44. package/dist/components/layout/components/Breadcrumbs.d.ts +2 -1
  45. package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
  46. package/dist/components/layout/components/Breadcrumbs.js +1 -89
  47. package/dist/components/layout/components/DropdownNavigation.d.ts.map +1 -1
  48. package/dist/components/layout/components/DropdownNavigation.js +1 -30
  49. package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
  50. package/dist/components/layout/components/FloatingLanguageSwitcher.js +1 -26
  51. package/dist/components/layout/components/Notifications.js +1 -182
  52. package/dist/components/layout/components/header/AppBranding.d.ts.map +1 -1
  53. package/dist/components/layout/components/header/AppBranding.js +1 -54
  54. package/dist/components/layout/components/header/AppIcon.d.ts.map +1 -1
  55. package/dist/components/layout/components/header/AppIcon.js +1 -59
  56. package/dist/components/layout/components/header/AppTitle.d.ts.map +1 -1
  57. package/dist/components/layout/components/header/AppTitle.js +1 -40
  58. package/dist/components/layout/components/header/CacheSettings.js +1 -225
  59. package/dist/components/layout/components/header/GameTitle.d.ts.map +1 -1
  60. package/dist/components/layout/components/header/GameTitle.js +1 -66
  61. package/dist/components/layout/components/header/HeaderMenu.js +1 -75
  62. package/dist/components/layout/components/header/HeaderNavigation.d.ts.map +1 -1
  63. package/dist/components/layout/components/header/HeaderNavigation.js +1 -66
  64. package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
  65. package/dist/components/layout/components/header/SettingsMenu.js +1 -85
  66. package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
  67. package/dist/components/layout/components/header/ThemeToggle.js +1 -93
  68. package/dist/components/layout/components/index.js +1 -25
  69. package/dist/components/layout/index.js +1 -14
  70. package/dist/crud/components/ChildRowsPicker.js +1 -68
  71. package/dist/crud/components/CrudCardLink.js +1 -14
  72. package/dist/crud/components/EntityCardList.js +1 -184
  73. package/dist/crud/components/EntityDisplayRenderer.js +1 -130
  74. package/dist/crud/components/EntityFormRenderer.js +1 -433
  75. package/dist/crud/components/EntityList.js +1 -521
  76. package/dist/crud/components/EntityRecommendations.js +1 -87
  77. package/dist/crud/components/EntityWorkflow.js +1 -55
  78. package/dist/crud/components/Form.d.ts.map +1 -1
  79. package/dist/crud/components/Form.js +1 -198
  80. package/dist/crud/components/cellEditFor.js +1 -74
  81. package/dist/crud/components/entityParent.js +1 -76
  82. package/dist/crud/components/index.js +1 -16
  83. package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -1
  84. package/dist/crud/components/useRecordBreadcrumb.js +1 -43
  85. package/dist/crud/crudImports.js +1 -51
  86. package/dist/crud/index.js +1 -11
  87. package/dist/data/techLogos.js +1 -99
  88. package/dist/dndev-next.css +25 -4
  89. package/dist/dndev.css +25 -4
  90. package/dist/index.js +1 -5
  91. package/dist/internal/common/DnDevErrorBoundary.js +1 -55
  92. package/dist/internal/common/ErrorFallback.js +3 -214
  93. package/dist/internal/common/GlobalErrorFallback.js +1 -45
  94. package/dist/internal/common/RouteErrorFallback.js +3 -140
  95. package/dist/internal/devtools/DebugTools.js +1 -131
  96. package/dist/internal/devtools/components/AuthDebugButton.js +1 -72
  97. package/dist/internal/devtools/components/ConfigTab.js +1 -61
  98. package/dist/internal/devtools/components/CookieTab.js +1 -156
  99. package/dist/internal/devtools/components/DebugDialog.js +1 -48
  100. package/dist/internal/devtools/components/DesignTab.js +1 -469
  101. package/dist/internal/devtools/components/LayoutReset.js +1 -214
  102. package/dist/internal/devtools/components/MaskedValue.js +1 -39
  103. package/dist/internal/devtools/components/StoresTab.js +1 -90
  104. package/dist/internal/devtools/components/index.js +1 -16
  105. package/dist/internal/devtools/index.js +1 -13
  106. package/dist/internal/devtools/types.js +0 -2
  107. package/dist/internal/devtools/utils/envVarDiscovery.js +1 -106
  108. package/dist/internal/devtools/utils/index.js +1 -12
  109. package/dist/internal/devtools/utils/maskSensitive.js +1 -59
  110. package/dist/internal/devtools/utils/virtualModuleInspector.js +1 -309
  111. package/dist/internal/initializers/BaseStoresInitializer.js +1 -367
  112. package/dist/internal/initializers/NextJsStoresInitializer.js +1 -78
  113. package/dist/internal/initializers/ViteStoresInitializer.js +1 -20
  114. package/dist/internal/initializers/index.js +1 -11
  115. package/dist/internal/layout/DnDevLayout.js +1 -321
  116. package/dist/internal/layout/components/AutoMetaTags.d.ts +2 -0
  117. package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
  118. package/dist/internal/layout/components/AutoMetaTags.js +1 -338
  119. package/dist/internal/layout/components/FaviconHead.js +1 -60
  120. package/dist/internal/layout/components/FontPreloadLinks.js +1 -31
  121. package/dist/internal/layout/components/HeadTags.js +1 -20
  122. package/dist/internal/layout/components/PWAUpdateNotification.js +1 -131
  123. package/dist/internal/layout/components/footer/FooterBranding.d.ts.map +1 -1
  124. package/dist/internal/layout/components/footer/FooterBranding.js +1 -35
  125. package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
  126. package/dist/internal/layout/components/footer/FooterCopyright.js +1 -37
  127. package/dist/internal/layout/components/footer/FooterLegalLinks.d.ts.map +1 -1
  128. package/dist/internal/layout/components/footer/FooterLegalLinks.js +1 -44
  129. package/dist/internal/layout/components/footer/useLegalLinks.d.ts +4 -2
  130. package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
  131. package/dist/internal/layout/components/footer/useLegalLinks.js +1 -21
  132. package/dist/internal/layout/components/i18nSeoMeta.js +1 -53
  133. package/dist/internal/layout/components/index.js +1 -13
  134. package/dist/internal/layout/config/defaults.js +1 -47
  135. package/dist/internal/layout/config/index.js +1 -11
  136. package/dist/internal/layout/config/presets/admin.js +1 -35
  137. package/dist/internal/layout/config/presets/blog.js +1 -31
  138. package/dist/internal/layout/config/presets/docs.js +1 -51
  139. package/dist/internal/layout/config/presets/game.js +1 -53
  140. package/dist/internal/layout/config/presets/index.js +1 -24
  141. package/dist/internal/layout/config/presets/landing.js +1 -42
  142. package/dist/internal/layout/config/presets/moolti.js +1 -52
  143. package/dist/internal/layout/config/presets/plain.js +1 -25
  144. package/dist/internal/layout/renderers/index.js +0 -10
  145. package/dist/internal/layout/zones/DnDevFooter.d.ts.map +1 -1
  146. package/dist/internal/layout/zones/DnDevFooter.js +1 -67
  147. package/dist/internal/layout/zones/DnDevHeader.js +1 -41
  148. package/dist/internal/layout/zones/DnDevMergedBar.d.ts.map +1 -1
  149. package/dist/internal/layout/zones/DnDevMergedBar.js +1 -52
  150. package/dist/internal/layout/zones/DnDevSidebar.d.ts.map +1 -1
  151. package/dist/internal/layout/zones/DnDevSidebar.js +1 -181
  152. package/dist/internal/layout/zones/index.js +1 -14
  153. package/dist/internal/providers/NavigationProvider.d.ts.map +1 -1
  154. package/dist/internal/providers/NavigationProvider.js +1 -71
  155. package/dist/internal/providers/SentryInitializer.d.ts.map +1 -1
  156. package/dist/internal/providers/SentryInitializer.js +1 -36
  157. package/dist/internal/providers/UIProviders.js +1 -79
  158. package/dist/internal/providers/index.js +1 -12
  159. package/dist/next.js +1 -11
  160. package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
  161. package/dist/providers/NextJsAppProviders.js +1 -107
  162. package/dist/providers/ViteAppProviders.d.ts.map +1 -1
  163. package/dist/providers/ViteAppProviders.js +1 -117
  164. package/dist/providers/index.js +1 -11
  165. package/dist/routing/404.js +1 -108
  166. package/dist/routing/AuthGuard.js +1 -178
  167. package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
  168. package/dist/routing/AuthGuardFallback.js +1 -67
  169. package/dist/routing/AuthReturnTo.js +1 -68
  170. package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
  171. package/dist/routing/DnDevNavigationMenu.js +1 -138
  172. package/dist/routing/GoTo.d.ts.map +1 -1
  173. package/dist/routing/GoTo.js +1 -38
  174. package/dist/routing/GoToDialog.d.ts.map +1 -1
  175. package/dist/routing/GoToDialog.js +1 -97
  176. package/dist/routing/GoToInput.d.ts.map +1 -1
  177. package/dist/routing/GoToInput.js +1 -49
  178. package/dist/routing/GoToWrapper.d.ts.map +1 -1
  179. package/dist/routing/GoToWrapper.js +1 -59
  180. package/dist/routing/Link.d.ts +10 -2
  181. package/dist/routing/Link.d.ts.map +1 -1
  182. package/dist/routing/Link.js +1 -109
  183. package/dist/routing/NavigationItem.d.ts.map +1 -1
  184. package/dist/routing/NavigationItem.js +1 -44
  185. package/dist/routing/NotFoundDocument.d.ts +33 -0
  186. package/dist/routing/NotFoundDocument.d.ts.map +1 -0
  187. package/dist/routing/NotFoundDocument.js +1 -0
  188. package/dist/routing/SignedInRedirect.js +1 -47
  189. package/dist/routing/hooks/hooks.vite.js +1 -1
  190. package/dist/routing/hooks/index.js +1 -26
  191. package/dist/routing/hooks/types.js +0 -2
  192. package/dist/routing/hooks/useLocation.next.js +1 -35
  193. package/dist/routing/hooks/useLocation.vite.js +1 -13
  194. package/dist/routing/hooks/useMatch.next.js +1 -31
  195. package/dist/routing/hooks/useMatch.vite.js +1 -6
  196. package/dist/routing/hooks/useNavigate.next.js +1 -64
  197. package/dist/routing/hooks/useNavigate.vite.js +1 -61
  198. package/dist/routing/hooks/useParams.next.js +1 -9
  199. package/dist/routing/hooks/useParams.vite.js +1 -6
  200. package/dist/routing/hooks/useQueryParams.next.js +1 -66
  201. package/dist/routing/hooks/useQueryParams.vite.js +1 -66
  202. package/dist/routing/hooks/useRedirectGuard.next.js +1 -119
  203. package/dist/routing/hooks/useRedirectGuard.vite.js +1 -117
  204. package/dist/routing/hooks/useRouteParam.next.js +1 -38
  205. package/dist/routing/hooks/useRouteParam.vite.js +1 -38
  206. package/dist/routing/hooks/useRoutePath.next.js +1 -36
  207. package/dist/routing/hooks/useRoutePath.vite.js +1 -25
  208. package/dist/routing/hooks/useSearchParams.next.js +1 -22
  209. package/dist/routing/hooks/useSearchParams.vite.js +1 -22
  210. package/dist/routing/hooks/useUrlLanguage.next.js +1 -50
  211. package/dist/routing/hooks/useUrlLanguage.vite.js +1 -41
  212. package/dist/routing/index.d.ts +1 -0
  213. package/dist/routing/index.d.ts.map +1 -1
  214. package/dist/routing/index.js +1 -32
  215. package/dist/routing/link/InternalLink.next.d.ts +23 -0
  216. package/dist/routing/link/InternalLink.next.d.ts.map +1 -0
  217. package/dist/routing/link/InternalLink.next.js +1 -0
  218. package/dist/routing/link/InternalLink.vite.d.ts +22 -0
  219. package/dist/routing/link/InternalLink.vite.d.ts.map +1 -0
  220. package/dist/routing/link/InternalLink.vite.js +1 -0
  221. package/dist/routing/link/absolutePath.d.ts +17 -0
  222. package/dist/routing/link/absolutePath.d.ts.map +1 -0
  223. package/dist/routing/link/absolutePath.js +1 -0
  224. package/dist/routing/link/link.next.d.ts +12 -0
  225. package/dist/routing/link/link.next.d.ts.map +1 -0
  226. package/dist/routing/link/link.next.js +1 -0
  227. package/dist/routing/link/link.vite.d.ts +12 -0
  228. package/dist/routing/link/link.vite.d.ts.map +1 -0
  229. package/dist/routing/link/link.vite.js +1 -0
  230. package/dist/routing/link/types.d.ts +30 -0
  231. package/dist/routing/link/types.d.ts.map +1 -0
  232. package/dist/routing/link/types.js +0 -0
  233. package/dist/routing/parentRoute.js +1 -43
  234. package/dist/routing/useGoTo.d.ts.map +1 -1
  235. package/dist/routing/useGoTo.js +1 -59
  236. package/dist/routing/useNavigation.d.ts.map +1 -1
  237. package/dist/routing/useNavigation.js +1 -114
  238. package/dist/routing/useRouteDiscovery.d.ts +1 -0
  239. package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
  240. package/dist/routing/useRouteDiscovery.js +1 -313
  241. package/dist/rsc.d.ts +28 -0
  242. package/dist/rsc.d.ts.map +1 -0
  243. package/dist/rsc.js +1 -0
  244. package/dist/styles/index.css +25 -4
  245. package/dist/styles/index.js +1 -10
  246. package/dist/styles/layoutConstants.js +1 -134
  247. package/dist/symbol-index.json +1 -1
  248. package/dist/utils/assetResolver.d.ts.map +1 -1
  249. package/dist/utils/assetResolver.js +1 -297
  250. package/dist/utils/index.js +1 -23
  251. package/dist/utils/sanitizeSvg.js +1 -51
  252. package/dist/utils/tList.js +1 -42
  253. package/dist/utils/useAISafe.d.ts.map +1 -1
  254. package/dist/utils/useAISafe.js +1 -53
  255. package/dist/utils/useAuthSafe.d.ts.map +1 -1
  256. package/dist/utils/useAuthSafe.js +1 -78
  257. package/dist/utils/useAuthVisibility.d.ts.map +1 -1
  258. package/dist/utils/useAuthVisibility.js +1 -63
  259. package/dist/utils/useBillingVisibility.d.ts.map +1 -1
  260. package/dist/utils/useBillingVisibility.js +1 -57
  261. package/dist/utils/useCrudSafe.d.ts.map +1 -1
  262. package/dist/utils/useCrudSafe.js +1 -75
  263. package/dist/utils/useDeleteAccountSafe.js +1 -52
  264. package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
  265. package/dist/utils/useFormStoreSafe.js +1 -85
  266. package/dist/utils/useOAuthSafe.d.ts.map +1 -1
  267. package/dist/utils/useOAuthSafe.js +1 -38
  268. package/dist/utils/useSeo.js +1 -151
  269. package/dist/utils/useStripeBillingSafe.d.ts.map +1 -1
  270. package/dist/utils/useStripeBillingSafe.js +1 -81
  271. package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
  272. package/dist/vite-routing/AppRoutes.js +1 -235
  273. package/dist/vite-routing/RootLayout.d.ts.map +1 -1
  274. package/dist/vite-routing/RootLayout.js +1 -205
  275. package/dist/vite-routing/index.js +1 -11
  276. package/dist/vite.js +1 -10
  277. package/guidelines/COMPONENTS.md +3 -3
  278. package/guidelines/PAGES.md +3 -0
  279. package/guidelines/ROUTING.md +15 -0
  280. package/guidelines/SEO.md +4 -1
  281. package/package.json +18 -8
  282. package/dist/ChildRowsPicker-63M4EQUQ.js +0 -1
  283. package/dist/ChildRowsPicker-ISP365ON.js +0 -1
  284. package/dist/ChildRowsPicker-PQFE6NCR.js +0 -1
  285. package/dist/ChildRowsPicker-XXFFSMWY.js +0 -1
  286. package/dist/CookieConsent-QOUAY6B4.js +0 -1
  287. package/dist/GoToDialog-KSBGOIWO.js +0 -1
  288. package/dist/GoToDialog-XBK5EZF4.js +0 -1
  289. package/dist/chunk-3CIZFGST.js +0 -1
  290. package/dist/chunk-LHMKU342.js +0 -1
  291. package/dist/chunk-MS7ZIW5Z.js +0 -1
  292. package/dist/chunk-O2XFH626.js +0 -1
  293. package/dist/chunk-P2DHZWPY.js +0 -1
  294. package/dist/components/common/lucideIconByName.d.ts +0 -9
  295. package/dist/components/common/lucideIconByName.d.ts.map +0 -1
  296. package/dist/components/common/lucideIconByName.js +0 -32
  297. package/dist/internal/layout/components/PerformanceHints.d.ts +0 -71
  298. package/dist/internal/layout/components/PerformanceHints.d.ts.map +0 -1
  299. package/dist/internal/layout/components/PerformanceHints.js +0 -71
@@ -1,84 +1 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- // packages/ui/src/components/common/icon.tsx
3
- /**
4
- * @fileoverview Icon component for UI package
5
- * @description Unified icon rendering for Lucide icons, emojis, and custom ReactNode content
6
- *
7
- * @version 0.1.0
8
- * @since 0.0.1
9
- * @author AMBROISE PARK Consulting
10
- */
11
- import * as LucideIcons from 'lucide-react';
12
- import { isValidElement } from 'react';
13
- import { cn } from '@donotdev/components';
14
- import { findLucideIcon } from './lucideIconByName';
15
- function getLucideIcon(name) {
16
- if (!name)
17
- return LucideIcons.Palette;
18
- const cleanIconName = name.replace(/['"]/g, '');
19
- return findLucideIcon(cleanIconName) || LucideIcons.Palette;
20
- }
21
- /**
22
- * Icon - Unified icon component (FLEXIBLE RUNTIME COMPONENT)
23
- *
24
- * **This is the flexible runtime component** - supports Lucide components, emojis, strings, and custom ReactNode.
25
- *
26
- * **For PageMeta.icon:** Only lucide-react JSX components are supported (extracted at build time).
27
- * **For Icon component:** All formats are supported (resolved at runtime).
28
- *
29
- * @example
30
- * ```tsx
31
- * // Runtime usage - all formats work
32
- * <Icon icon="🚀" /> // Emoji
33
- * <Icon icon="Rocket" /> // Lucide name string
34
- * <Icon icon={<Rocket />} /> // Lucide component
35
- * <Icon icon={<CustomIcon />} /> // Custom component
36
- * ```
37
- *
38
- * @version 0.1.0
39
- * @since 0.0.1
40
- * @author AMBROISE PARK Consulting
41
- */
42
- const Icon = ({ icon, fallback, className, ariaHidden = false, }) => {
43
- const iconToRender = icon || fallback;
44
- if (!iconToRender)
45
- return null;
46
- const sizeClass = 'dndev-size-md';
47
- if (typeof iconToRender === 'function' ||
48
- (typeof iconToRender === 'object' &&
49
- iconToRender !== null &&
50
- 'render' in iconToRender)) {
51
- const IconComponent = iconToRender;
52
- return (_jsx(IconComponent, { className: cn(sizeClass, className), style: { flexShrink: 0 }, "aria-hidden": ariaHidden }));
53
- }
54
- if (typeof iconToRender === 'string') {
55
- // Check if string is an emoji (not a valid identifier)
56
- // Valid identifiers: alphanumeric, underscore, hyphen (Lucide icon names)
57
- // Emojis: anything else (Unicode symbols, emojis, etc.)
58
- const isValidIdentifier = /^[a-zA-Z0-9_-]+$/.test(iconToRender);
59
- const isEmoji = !isValidIdentifier;
60
- if (isEmoji) {
61
- return (_jsx("span", { className: cn(sizeClass, className), style: {
62
- display: 'inline-flex',
63
- alignItems: 'center',
64
- justifyContent: 'center',
65
- }, "aria-hidden": ariaHidden, children: iconToRender }));
66
- }
67
- const LucideIcon = getLucideIcon(iconToRender);
68
- return (_jsx(LucideIcon, { className: cn(sizeClass, className), style: { flexShrink: 0 }, "aria-hidden": ariaHidden }));
69
- }
70
- if (isValidElement(iconToRender)) {
71
- return (_jsx("span", { className: className, style: {
72
- display: 'inline-flex',
73
- alignItems: 'center',
74
- justifyContent: 'center',
75
- }, "aria-hidden": ariaHidden, children: iconToRender }));
76
- }
77
- return (_jsx("span", { className: className, style: {
78
- display: 'inline-flex',
79
- alignItems: 'center',
80
- justifyContent: 'center',
81
- }, "aria-hidden": ariaHidden, children: iconToRender }));
82
- };
83
- export default Icon;
84
- export { Icon };
1
+ "use client";import{Palette as l}from"lucide-react";import{isValidElement as f}from"react";import{cn as r}from"@donotdev/components";import{iconByName as m}from"./iconByName.js";import{jsx as o}from"react/jsx-runtime";var d=({icon:s,fallback:p,className:n,ariaHidden:t=!1})=>{let e=s||p;if(!e)return null;let i="dndev-size-md";if(typeof e=="function"||typeof e=="object"&&e!==null&&"render"in e)return o(e,{className:r(i,n),style:{flexShrink:0},"aria-hidden":t});if(typeof e=="string"){if(!/^[a-zA-Z0-9_-]+$/.test(e))return o("span",{className:r(i,n),style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":t,children:e});let a=m(e,l);return o(a,{className:r(i,n),style:{flexShrink:0},"aria-hidden":t})}return f(e)?o("span",{className:n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":t,children:e}):o("span",{className:n,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":t,children:e})},h=d;export{d as Icon,h as default};
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @fileoverview Lucide icon component from an icon name string
3
+ * @description Resolves `"Sun"` / `"Rocket"` to a renderable icon component without the
4
+ * lucide-react namespace (which would put all ~1,600 icons in every bundle):
5
+ * 1. Theme icons (`--theme-icon` in the app's CSS) come from the build-time registry
6
+ * `_DNDEV_CONFIG_.themes.icons` (named imports in the generated theme module): static,
7
+ * server-rendered.
8
+ * 2. Any other name is loaded per icon (`DynamicIcon`, one async chunk per icon), with a
9
+ * same-size placeholder until it arrives.
10
+ * Internal to @donotdev/ui (not re-exported).
11
+ *
12
+ * @version 0.1.0
13
+ * @since 0.3.2
14
+ * @author AMBROISE PARK Consulting
15
+ */
16
+ import type { LucideProps } from 'lucide-react';
17
+ import type { ComponentType } from 'react';
18
+ /** A renderable Lucide-style icon component. */
19
+ export type NamedIconComponent = ComponentType<LucideProps>;
20
+ /**
21
+ * Icon component for a Lucide icon name (`"Sun"`, `"SunIcon"`, `"LucideSun"`; quotes from
22
+ * a CSS value are ignored).
23
+ *
24
+ * @param name - Lucide export name
25
+ * @param fallback - Icon shown when lucide has no icon of that name
26
+ * @returns The registered theme icon, else a lazily loaded icon
27
+ *
28
+ * @version 0.1.0
29
+ * @since 0.3.2
30
+ * @author AMBROISE PARK Consulting
31
+ */
32
+ export declare function iconByName(name: string, fallback: NamedIconComponent): NamedIconComponent;
33
+ //# sourceMappingURL=iconByName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"iconByName.d.ts","sourceRoot":"","sources":["../../../src/components/common/iconByName.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,OAAO,CAAC;AAMzD,gDAAgD;AAChD,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AA0C5D;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kBAAkB,GAC3B,kBAAkB,CAKpB"}
@@ -0,0 +1 @@
1
+ "use client";import{lazy as p,Suspense as s}from"react";import{getDndevConfig as i}from"@donotdev/core";import{IconPlaceholder as d}from"./IconPlaceholder.js";import{jsx as r}from"react/jsx-runtime";var l=p(()=>import("./LazyLucideIcon.js")),a=new Map;function u(n,o){let e=a.get(o);e||(e=new Map,a.set(o,e));let t=e.get(n);if(t)return t;function c(m){return r(s,{fallback:r(d,{className:m.className,style:m.style}),children:r(l,{name:n,fallback:o,...m})})}return c.displayName=`NamedIcon(${n})`,e.set(n,c),c}function f(n,o){let e=n.replace(/['"]/g,""),t=i()?.themes?.icons?.[e];return t||u(e,o)}export{f as iconByName};
@@ -1,16 +1 @@
1
- // packages/ui/src/components/common/index.ts
2
- /**
3
- * @fileoverview Common UI components
4
- * @description Shared UI components for DoNotDev framework
5
- *
6
- * @version 0.1.0
7
- * @since 0.0.1
8
- * @author AMBROISE PARK Consulting
9
- */
10
- export { default as FeatureDisabled } from './FeatureDisabled';
11
- export { default as Icon } from './icon';
12
- export { RedirectOverlay } from './RedirectOverlay';
13
- export { default as ProgressBar } from './ProgressBar';
14
- export { default as Skeleton } from './Skeleton';
15
- export { default as FeatureCard } from './FeatureCard';
16
- export { default as TechBento } from './TechBento';
1
+ import{default as o}from"./FeatureDisabled.js";import{default as a}from"./icon.js";import{RedirectOverlay as p}from"./RedirectOverlay.js";import{default as s}from"./ProgressBar.js";import{default as l}from"./Skeleton.js";import{default as x}from"./FeatureCard.js";import{default as n}from"./TechBento.js";export{x as FeatureCard,o as FeatureDisabled,a as Icon,s as ProgressBar,p as RedirectOverlay,l as Skeleton,n as TechBento};
@@ -1,6 +1,8 @@
1
1
  /**
2
2
  * ConsentBanner - Lazy loaded consent component
3
- * Shows if user hasn't consented yet OR if showBanner flag is set
3
+ * Shows if user hasn't consented yet OR if showBanner flag is set.
4
+ * Renders nothing (and never loads the banner chunk) when the app sets only strictly
5
+ * necessary cookies.
4
6
  *
5
7
  * @version 0.1.0
6
8
  * @since 0.0.1
@@ -1 +1 @@
1
- {"version":3,"file":"ConsentBanner.d.ts","sourceRoot":"","sources":["../../../src/components/cookie-consent/ConsentBanner.tsx"],"names":[],"mappings":"AAmBA;;;;;;;GAOG;AACH,wBAAgB,aAAa,uCAW5B;AACD,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ConsentBanner.d.ts","sourceRoot":"","sources":["../../../src/components/cookie-consent/ConsentBanner.tsx"],"names":[],"mappings":"AAqBA;;;;;;;;;GASG;AACH,wBAAgB,aAAa,uCAa5B;AACD,eAAe,aAAa,CAAC"}
@@ -1,31 +1 @@
1
- 'use client';
2
- import { jsx as _jsx } from "react/jsx-runtime";
3
- // packages/ui/src/components/cookie-consent/ConsentBanner.tsx
4
- /**
5
- * @fileoverview ConsentBanner component
6
- * @description Lazy loaded consent banner component
7
- *
8
- * @version 0.1.0
9
- * @since 0.0.1
10
- * @author AMBROISE PARK Consulting
11
- */
12
- import { Suspense, lazy } from 'react';
13
- import { useConsent } from '@donotdev/core';
14
- // Lazy load the actual consent component
15
- const CookieConsent = lazy(() => import('./CookieConsent'));
16
- /**
17
- * ConsentBanner - Lazy loaded consent component
18
- * Shows if user hasn't consented yet OR if showBanner flag is set
19
- *
20
- * @version 0.1.0
21
- * @since 0.0.1
22
- * @author AMBROISE PARK Consulting
23
- */
24
- export function ConsentBanner() {
25
- const hasConsented = useConsent('hasConsented');
26
- const showBanner = useConsent('showBanner');
27
- if (hasConsented && !showBanner)
28
- return null;
29
- return (_jsx(Suspense, { fallback: null, children: _jsx(CookieConsent, {}) }));
30
- }
31
- export default ConsentBanner;
1
+ "use client";import{Suspense as r,lazy as s}from"react";import{useConsent as e}from"@donotdev/core";import{useCookieNoticeRequired as i}from"./useCookieNoticeRequired.js";import{jsx as n}from"react/jsx-runtime";var u=s(()=>import("./CookieConsent.js"));function l(){let o=e("hasConsented"),t=e("showBanner");return!i()||o&&!t?null:n(r,{fallback:null,children:n(u,{})})}var C=l;export{l as ConsentBanner,C as default};
@@ -1 +1 @@
1
- {"version":3,"file":"CookieConsent.d.ts","sourceRoot":"","sources":["../../../src/components/cookie-consent/CookieConsent.tsx"],"names":[],"mappings":"AA6BA,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,iBAAS,aAAa,CAAC,EACrB,QAAmB,EACnB,SAAc,GACf,EAAE,kBAAkB,sCAgVpB;AAED,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"CookieConsent.d.ts","sourceRoot":"","sources":["../../../src/components/cookie-consent/CookieConsent.tsx"],"names":[],"mappings":"AA8BA,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,iBAAS,aAAa,CAAC,EACrB,QAAmB,EACnB,SAAc,GACf,EAAE,kBAAkB,sCAgVpB;AAED,eAAe,aAAa,CAAC"}
@@ -1,183 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- // packages/ui/src/components/cookie-consent/CookieConsent.tsx
3
- import { Cookie, Settings, Shield, BarChart3, Target } from 'lucide-react';
4
- import { useState, useEffect, useRef } from 'react';
5
- import { Accordion, Button, BUTTON_VARIANT, Card, Switch, Text, cn, Stack, } from '@donotdev/components';
6
- import { handleError, useConsent, getCookieExamples, hasOptionalCookies as checkHasOptionalCookies, } from '@donotdev/core';
7
- import { CONSENT_CATEGORY, } from '@donotdev/core';
8
- import { useTranslation } from '@donotdev/core';
9
- import { isClient } from '@donotdev/core';
10
- const MAX_WIDTH = 480;
11
- function CookieConsent({ position = 'bottom', className = '', }) {
12
- const hasConsented = useConsent('hasConsented');
13
- const categories = useConsent('categories');
14
- const acceptAll = useConsent('acceptAll');
15
- const declineAll = useConsent('declineAll');
16
- const updateCategory = useConsent('updateCategory');
17
- const storeShowBanner = useConsent('showBanner');
18
- const { t } = useTranslation('cookies');
19
- const [showPreferences, setShowPreferences] = useState(false);
20
- const [showBanner, setShowBanner] = useState(!hasConsented || storeShowBanner);
21
- const [preferenceCategories, setPreferenceCategories] = useState(categories);
22
- const bannerRef = useRef(null);
23
- /**
24
- * Consent lives in localStorage, so the server cannot know whether the banner
25
- * is needed: it always rendered it, and the client removed it on mount. For an
26
- * app whose categories are all necessary, that auto-accept path below made the
27
- * banner unconditional — every single load flashed a banner nobody could ever
28
- * act on, in whatever locale had not loaded yet. Rendering nothing until mount
29
- * makes the first client render match the server's, so there is no flash and no
30
- * hydration mismatch.
31
- */
32
- const [mounted, setMounted] = useState(false);
33
- useEffect(() => setMounted(true), []);
34
- useEffect(() => {
35
- if (storeShowBanner) {
36
- setShowBanner(true);
37
- }
38
- }, [storeShowBanner]);
39
- // Get categories actually required by the app's features
40
- const requiredCategories = Object.keys(categories);
41
- const categoryDefs = [
42
- {
43
- id: CONSENT_CATEGORY.NECESSARY,
44
- icon: Shield,
45
- title: t('essentialCookies'),
46
- description: t('essentialDescription'),
47
- examples: getCookieExamples('necessary') || t('essentialExamples'),
48
- locked: true,
49
- },
50
- {
51
- id: CONSENT_CATEGORY.FUNCTIONAL,
52
- icon: Cookie,
53
- title: t('functionalCookies'),
54
- description: t('functionalDescription'),
55
- examples: getCookieExamples('functional') || t('functionalExamples'),
56
- legalNotice: t('functionalLegalNotice'),
57
- locked: false,
58
- },
59
- {
60
- id: CONSENT_CATEGORY.ANALYTICS,
61
- icon: BarChart3,
62
- title: t('analyticsCookies'),
63
- description: t('analyticsDescription'),
64
- examples: getCookieExamples('analytics') || t('analyticsExamples'),
65
- locked: false,
66
- },
67
- {
68
- id: CONSENT_CATEGORY.MARKETING,
69
- icon: Target,
70
- title: t('marketingCookies'),
71
- description: t('marketingDescription'),
72
- examples: getCookieExamples('marketing') || t('marketingExamples'),
73
- locked: false,
74
- },
75
- ].filter((cat) => requiredCategories.includes(cat.id));
76
- const hasOptionalCategories = checkHasOptionalCookies();
77
- // Functional cookies only (sign-in, language, consent): nothing to consent to, but the
78
- // visitor is told once — an information bar with a single OK that records it.
79
- const informationOnly = !hasOptionalCategories;
80
- // Sync local draft state when accordion opens — default optional ON for easier UX
81
- useEffect(() => {
82
- const defaulted = { ...categories };
83
- if (showPreferences) {
84
- const mutable = defaulted;
85
- Object.keys(mutable).forEach((cat) => {
86
- if (cat !== CONSENT_CATEGORY.NECESSARY && mutable[cat] === false) {
87
- mutable[cat] = true;
88
- }
89
- });
90
- }
91
- setPreferenceCategories(defaulted);
92
- }, [categories, showPreferences]);
93
- // Dismiss on outside click when banner is showing pre-consent
94
- useEffect(() => {
95
- // The information bar stays until acknowledged (OK), no dismiss by outside click.
96
- if (!isClient() || hasConsented || !showBanner || informationOnly)
97
- return;
98
- const handleClickOutside = (event) => {
99
- if (bannerRef.current &&
100
- !bannerRef.current.contains(event.target)) {
101
- setShowBanner(false);
102
- }
103
- };
104
- const timeoutId = setTimeout(() => {
105
- document.addEventListener('mousedown', handleClickOutside);
106
- }, 100);
107
- return () => {
108
- clearTimeout(timeoutId);
109
- document.removeEventListener('mousedown', handleClickOutside);
110
- };
111
- }, [hasConsented, showBanner, informationOnly]);
112
- if (!mounted)
113
- return null;
114
- if (hasConsented && !storeShowBanner)
115
- return null;
116
- const handleSave = () => {
117
- try {
118
- Object.entries(preferenceCategories).forEach(([cat, val]) => {
119
- if (cat !== CONSENT_CATEGORY.NECESSARY && val !== undefined) {
120
- const categoryKey = cat;
121
- if (Object.values(CONSENT_CATEGORY).includes(categoryKey)) {
122
- updateCategory(categoryKey, Boolean(val));
123
- }
124
- }
125
- });
126
- setShowPreferences(false);
127
- setShowBanner(false);
128
- }
129
- catch (error) {
130
- handleError(error, {
131
- userMessage: 'Error saving preferences',
132
- context: { operation: 'save_preferences' },
133
- severity: 'warning',
134
- log: true,
135
- reportToSentry: false,
136
- showNotification: false,
137
- });
138
- }
139
- };
140
- const handleAcceptAll = () => {
141
- acceptAll();
142
- setShowBanner(false);
143
- };
144
- const handleDeclineAll = () => {
145
- declineAll();
146
- setShowBanner(false);
147
- };
148
- const bannerContent = (_jsxs(Stack, { gap: "medium", children: [_jsx(Text, { as: "p", variant: "muted", level: "small", style: { lineHeight: 1.55 }, children: informationOnly
149
- ? t('necessaryOnlyDescription')
150
- : t('cookieBannerDescription') }), hasOptionalCategories && (_jsx(Accordion, { type: "single", collapsible: true, value: showPreferences ? 'preferences' : '', onValueChange: (value) => setShowPreferences(value === 'preferences'), items: [
151
- {
152
- value: 'preferences',
153
- trigger: (_jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [_jsx(Settings, { className: "dndev-size-sm" }), _jsx(Text, { as: "span", level: "small", weight: "medium", children: t('customize') })] })),
154
- content: (_jsx(Stack, { gap: "tight", children: categoryDefs.map((cat) => {
155
- const Icon = cat.icon;
156
- const enabled = preferenceCategories[cat.id] ?? false;
157
- return (_jsxs(Stack, { direction: "row", align: "start", justify: "between", gap: "medium", style: {
158
- padding: '0.75rem',
159
- borderRadius: 'var(--radius-surface, 0.5rem)',
160
- background: 'var(--muted)',
161
- }, children: [_jsxs(Stack, { direction: "row", align: "start", gap: "tight", style: { flex: 1, minWidth: 0 }, children: [_jsx(Icon, { className: "dndev-size-sm", style: {
162
- color: 'var(--primary)',
163
- marginTop: '0.15rem',
164
- flexShrink: 0,
165
- } }), _jsxs(Stack, { gap: "none", style: { minWidth: 0 }, children: [_jsx(Text, { as: "span", level: "small", weight: "semibold", children: cat.title }), _jsx(Text, { as: "span", variant: "muted", level: "caption", style: { lineHeight: 1.45 }, children: cat.description })] })] }), cat.locked ? (_jsx(Text, { as: "span", variant: "muted", level: "caption", weight: "medium", style: { flexShrink: 0 }, children: t('alwaysOn') })) : (_jsx(Switch, { checked: enabled, onCheckedChange: (val) => setPreferenceCategories((prev) => ({
166
- ...prev,
167
- [cat.id]: val,
168
- })) }))] }, cat.id));
169
- }) })),
170
- },
171
- ] }))] }));
172
- const bannerFooter = showPreferences ? (_jsxs(Stack, { direction: "row", gap: "tight", style: { width: '100%' }, children: [_jsx(Button, { onClick: () => setShowPreferences(false), variant: BUTTON_VARIANT.OUTLINE, style: { flex: 1 }, children: t('form.cancel', 'Cancel') }), _jsx(Button, { onClick: handleSave, variant: BUTTON_VARIANT.DEFAULT, style: { flex: 1 }, children: t('savePreferences', 'Save Preferences') })] })) : (_jsxs(Stack, { direction: "row", gap: "tight", style: { width: '100%' }, children: [hasOptionalCategories && (_jsx(Button, { onClick: handleDeclineAll, variant: BUTTON_VARIANT.OUTLINE, style: { flex: 1 }, children: t('declineOptional') })), _jsx(Button, { onClick: handleAcceptAll, variant: BUTTON_VARIANT.DEFAULT, style: { flex: 1 }, children: informationOnly ? t('acknowledge') : t('acceptAll') })] }));
173
- return (_jsxs(_Fragment, { children: [showBanner && (_jsx(Card, { ref: bannerRef, elevated: true, icon: Cookie, title: informationOnly ? t('necessaryOnlyTitle') : t('cookiePreferences'), content: bannerContent, footer: bannerFooter, className: cn('dndev-fixed dndev-z-modal', className), style: {
174
- [position === 'top' ? 'top' : 'bottom']: 'var(--gap-md)',
175
- insetInlineStart: 'var(--gap-md)',
176
- width: `min(${MAX_WIDTH}px, calc(100vw - var(--gap-md) * 2))`,
177
- height: 'auto',
178
- } })), !showBanner && !hasConsented && !informationOnly && (_jsx(Button, { onClick: () => setShowBanner(true), variant: BUTTON_VARIANT.OUTLINE, floating: true, icon: Cookie, display: "compact", tooltip: t('cookiePreferences'), "aria-label": t('cookiePreferences'), className: "dndev-fixed dndev-z-toast", style: {
179
- [position === 'top' ? 'top' : 'bottom']: 'var(--gap-md)',
180
- insetInlineStart: 'var(--gap-md)',
181
- } }))] }));
182
- }
183
- export default CookieConsent;
1
+ "use client";import{Cookie as w,Settings as W,Shield as G,BarChart3 as K,Target as V}from"lucide-react";import{useState as v,useEffect as y,useRef as q}from"react";import{Accordion as X,Button as m,BUTTON_VARIANT as f,Card as $,Switch as J,Text as u,cn as Q,Stack as s}from"@donotdev/components";import{handleError as Z,useConsent as d,getCookieExamples as S,hasOptionalCookies as ee}from"@donotdev/core";import{CONSENT_CATEGORY as r}from"@donotdev/core";import{useTranslation as te}from"@donotdev/core";import{isClient as ne}from"@donotdev/core";import{Fragment as se,jsx as n,jsxs as a}from"react/jsx-runtime";var oe=480;function ie({position:N="bottom",className:O=""}){let p=d("hasConsented"),g=d("categories"),D=d("acceptAll"),B=d("declineAll"),I=d("updateCategory"),k=d("showBanner"),{t:e}=te("cookies"),[C,E]=v(!1),[h,l]=v(!p||k),[A,b]=v(g),T=q(null),[L,P]=v(!1);y(()=>P(!0),[]),y(()=>{k&&l(!0)},[k]);let R=Object.keys(g),U=[{id:r.NECESSARY,icon:G,title:e("essentialCookies"),description:e("essentialDescription"),examples:S("necessary")||e("essentialExamples"),locked:!0},{id:r.FUNCTIONAL,icon:w,title:e("functionalCookies"),description:e("functionalDescription"),examples:S("functional")||e("functionalExamples"),legalNotice:e("functionalLegalNotice"),locked:!1},{id:r.ANALYTICS,icon:K,title:e("analyticsCookies"),description:e("analyticsDescription"),examples:S("analytics")||e("analyticsExamples"),locked:!1},{id:r.MARKETING,icon:V,title:e("marketingCookies"),description:e("marketingDescription"),examples:S("marketing")||e("marketingExamples"),locked:!1}].filter(t=>R.includes(t.id)),x=ee(),c=!x;if(y(()=>{let t={...g};if(C){let o=t;Object.keys(o).forEach(i=>{i!==r.NECESSARY&&o[i]===!1&&(o[i]=!0)})}b(t)},[g,C]),y(()=>{if(!ne()||p||!h||c)return;let t=i=>{T.current&&!T.current.contains(i.target)&&l(!1)},o=setTimeout(()=>{document.addEventListener("mousedown",t)},100);return()=>{clearTimeout(o),document.removeEventListener("mousedown",t)}},[p,h,c]),!L||p&&!k)return null;let M=()=>{try{Object.entries(A).forEach(([t,o])=>{if(t!==r.NECESSARY&&o!==void 0){let i=t;Object.values(r).includes(i)&&I(i,!!o)}}),E(!1),l(!1)}catch(t){Z(t,{userMessage:"Error saving preferences",context:{operation:"save_preferences"},severity:"warning",log:!0,reportToSentry:!1,showNotification:!1})}},z=()=>{D(),l(!1)},H=()=>{B(),l(!1)},Y=a(s,{gap:"medium",children:[n(u,{as:"p",variant:"muted",level:"small",style:{lineHeight:1.55},children:e(c?"necessaryOnlyDescription":"cookieBannerDescription")}),x&&n(X,{type:"single",collapsible:!0,value:C?"preferences":"",onValueChange:t=>E(t==="preferences"),items:[{value:"preferences",trigger:a(s,{direction:"row",align:"center",gap:"tight",children:[n(W,{className:"dndev-size-sm"}),n(u,{as:"span",level:"small",weight:"medium",children:e("customize")})]}),content:n(s,{gap:"tight",children:U.map(t=>{let o=t.icon,i=A[t.id]??!1;return a(s,{direction:"row",align:"start",justify:"between",gap:"medium",style:{padding:"0.75rem",borderRadius:"var(--radius-surface, 0.5rem)",background:"var(--muted)"},children:[a(s,{direction:"row",align:"start",gap:"tight",style:{flex:1,minWidth:0},children:[n(o,{className:"dndev-size-sm",style:{color:"var(--primary)",marginTop:"0.15rem",flexShrink:0}}),a(s,{gap:"none",style:{minWidth:0},children:[n(u,{as:"span",level:"small",weight:"semibold",children:t.title}),n(u,{as:"span",variant:"muted",level:"caption",style:{lineHeight:1.45},children:t.description})]})]}),t.locked?n(u,{as:"span",variant:"muted",level:"caption",weight:"medium",style:{flexShrink:0},children:e("alwaysOn")}):n(J,{checked:i,onCheckedChange:F=>b(_=>({..._,[t.id]:F}))})]},t.id)})})}]})]}),j=C?a(s,{direction:"row",gap:"tight",style:{width:"100%"},children:[n(m,{onClick:()=>E(!1),variant:f.OUTLINE,style:{flex:1},children:e("form.cancel","Cancel")}),n(m,{onClick:M,variant:f.DEFAULT,style:{flex:1},children:e("savePreferences","Save Preferences")})]}):a(s,{direction:"row",gap:"tight",style:{width:"100%"},children:[x&&n(m,{onClick:H,variant:f.OUTLINE,style:{flex:1},children:e("declineOptional")}),n(m,{onClick:z,variant:f.DEFAULT,style:{flex:1},children:e(c?"acknowledge":"acceptAll")})]});return a(se,{children:[h&&n($,{ref:T,elevated:!0,icon:w,title:e(c?"necessaryOnlyTitle":"cookiePreferences"),content:Y,footer:j,className:Q("dndev-fixed dndev-z-modal",O),style:{[N==="top"?"top":"bottom"]:"var(--gap-md)",insetInlineStart:"var(--gap-md)",width:`min(${oe}px, calc(100vw - var(--gap-md) * 2))`,height:"auto"}}),!h&&!p&&!c&&n(m,{onClick:()=>l(!0),variant:f.OUTLINE,floating:!0,icon:w,display:"compact",tooltip:e("cookiePreferences"),"aria-label":e("cookiePreferences"),className:"dndev-fixed dndev-z-toast",style:{[N==="top"?"top":"bottom"]:"var(--gap-md)",insetInlineStart:"var(--gap-md)"}})]})}var fe=ie;export{fe as default};
@@ -1,11 +1 @@
1
- // packages/ui/src/components/cookie-consent/index.ts
2
- /**
3
- * @fileoverview Cookie consent components
4
- * @description GDPR-compliant cookie consent system
5
- *
6
- * @version 0.1.0
7
- * @since 0.0.1
8
- * @author AMBROISE PARK Consulting
9
- */
10
- // CookieConsent intentionally NOT exported - lazy loaded by ConsentBanner and AuthGuard
11
- export * from './ConsentBanner';
1
+ export*from"./ConsentBanner.js";
@@ -0,0 +1,7 @@
1
+ /**
2
+ * `true` when the app has a non-necessary cookie category to consent to.
3
+ * `false` when only strictly necessary cookies are set (CNIL / loi Informatique et
4
+ * Libertés art. 82: no consent, no banner).
5
+ */
6
+ export declare function useCookieNoticeRequired(): boolean;
7
+ //# sourceMappingURL=useCookieNoticeRequired.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCookieNoticeRequired.d.ts","sourceRoot":"","sources":["../../../src/components/cookie-consent/useCookieNoticeRequired.ts"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAGjD"}
@@ -0,0 +1 @@
1
+ "use client";import{useAppConfig as o,isCookieNoticeRequired as i}from"@donotdev/core";function t(){let e=o().features;return i(e?.requiredCookies)}export{t as useCookieNoticeRequired};
@@ -1,13 +1 @@
1
- // packages/ui/src/components/index.ts
2
- /**
3
- * @fileoverview UI Components Barrel Exports
4
- * @description Barrel exports for UI components. Provides centralized access to auth, common, content, cookie consent, and layout components.
5
- *
6
- * @version 0.1.0
7
- * @since 0.0.1
8
- * @author AMBROISE PARK Consulting
9
- */
10
- export * from './auth';
11
- export * from './common';
12
- export * from './cookie-consent';
13
- export * from './layout';
1
+ export*from"./auth/index.js";export*from"./common/index.js";export*from"./cookie-consent/index.js";export*from"./layout/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"GameContainer.d.ts","sourceRoot":"","sources":["../../../src/components/layout/GameContainer.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,OAAO,EAAE,SAAS,CAAC;IAEnB,2FAA2F;IAC3F,GAAG,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAE9B,yCAAyC;IACzC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAEvC,uCAAuC;IACvC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IAEjD,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAEnC,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,GAAG,EACH,KAAgB,EAChB,OAAkB,EAClB,iBAAyB,EACzB,cAAyB,EACzB,gBAAgB,EAChB,YAAY,GACb,EAAE,kBAAkB,+BAoEpB"}
1
+ {"version":3,"file":"GameContainer.d.ts","sourceRoot":"","sources":["../../../src/components/layout/GameContainer.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;CACpD;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,OAAO,EAAE,SAAS,CAAC;IAEnB,2FAA2F;IAC3F,GAAG,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAE9B,yCAAyC;IACzC,KAAK,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAEvC,uCAAuC;IACvC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;IAEjD,wEAAwE;IACxE,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,GAAG,QAAQ,CAAC;IAEnC,+CAA+C;IAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,GAAG,EACH,KAAgB,EAChB,OAAkB,EAClB,iBAAyB,EACzB,cAAyB,EACzB,gBAAgB,EAChB,YAAY,GACb,EAAE,kBAAkB,+BAoEpB"}
@@ -1,72 +1 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Button, ScrollArea } from '@donotdev/components';
3
- import { cn } from '@donotdev/components';
4
- /**
5
- * GameContainer - Content + CTA grid layout for game screens
6
- *
7
- * Provides scrollable content area with optional fixed CTA button at bottom.
8
- * Used for game sessions, onboarding flows, wizards, assessments, tutorials.
9
- *
10
- * Layout Zones:
11
- * - Content: Scrollable (ScrollArea), centered by default (customizable)
12
- * - CTA: Fixed at bottom, full-width touch target (48px)
13
- *
14
- * Default Behavior:
15
- * - Content is horizontally + vertically centered
16
- * - ScrollArea enabled for cross-browser scroll styling
17
- * - CTA has 16px top padding + 2px border separator
18
- *
19
- * @param {GameContainerProps} props - Component props
20
- * @returns {JSX.Element} GameContainer component
21
- *
22
- * @example
23
- * Basic usage (centered content + CTA)
24
- * ```tsx
25
- * <GameContainer
26
- * content={
27
- * <div className="max-w-2xl">
28
- * <h1>Welcome</h1>
29
- * <p>Let's get started</p>
30
- * </div>
31
- * }
32
- * cta={{ label: 'Start', onClick: handleStart }}
33
- * />
34
- * ```
35
- *
36
- * @example
37
- * Full-width form (no centering)
38
- * ```tsx
39
- * <GameContainer
40
- * align="stretch"
41
- * justify="start"
42
- * content={<FullWidthForm />}
43
- * cta={{ label: 'Submit', onClick: handleSubmit }}
44
- * />
45
- * ```
46
- *
47
- * @example
48
- * Multiple CTA buttons (side by side)
49
- * ```tsx
50
- * <GameContainer
51
- * content={<ChallengeContent />}
52
- * cta={[
53
- * { label: 'Accept', onClick: handleAccept, variant: 'default' },
54
- * { label: 'Decline', onClick: handleDecline, variant: 'outline' }
55
- * ]}
56
- * />
57
- * ```
58
- *
59
- * @version 0.1.0
60
- * @since 0.0.1
61
- * @author AMBROISE PARK Consulting
62
- */
63
- export function GameContainer({ content, cta, align = 'center', justify = 'center', disableScrollArea = false, contentVariant = 'narrow', contentClassName, ctaClassName, }) {
64
- const narrowWrapper = contentVariant === 'narrow' && (_jsx("div", { className: "dndev-game-container__content-narrow", children: content }));
65
- const scrollContent = contentVariant === 'narrow' ? narrowWrapper : content;
66
- const contentInner = disableScrollArea ? (_jsx("div", { style: {
67
- overflow: 'auto',
68
- overscrollBehavior: 'contain',
69
- height: '100%',
70
- }, children: scrollContent })) : (_jsx(ScrollArea, { className: "dndev-game-container__scroll", children: scrollContent }));
71
- return (_jsxs("div", { className: "dndev-game-container", children: [_jsx("div", { className: cn('dndev-game-container__content', contentClassName), "data-align": align, "data-justify": justify, "data-content-variant": contentVariant, children: _jsx("div", { className: "dndev-game-container__scroll-wrapper", children: contentInner }) }), cta && (_jsx("div", { className: cn('dndev-game-container__cta', ctaClassName), children: Array.isArray(cta) ? (_jsx("div", { className: "dndev-game-container__cta-buttons", children: cta.map((button, index) => (_jsx(Button, { onClick: button.onClick, disabled: button.disabled ?? false, variant: button.variant ?? 'default', className: "dndev-game-container__cta-button", fullWidth: true, children: button.label }, index))) })) : (_jsx(Button, { onClick: cta.onClick, disabled: cta.disabled ?? false, variant: cta.variant ?? 'default', className: "dndev-game-container__cta-button", children: cta.label })) }))] }));
72
- }
1
+ "use client";import{Button as i,ScrollArea as g}from"@donotdev/components";import{cn as l}from"@donotdev/components";import{jsx as e,jsxs as p}from"react/jsx-runtime";function b({content:r,cta:a,align:d="center",justify:s="center",disableScrollArea:c=!1,contentVariant:t="narrow",contentClassName:v,ctaClassName:m}){let o=t==="narrow"?t==="narrow"&&e("div",{className:"dndev-game-container__content-narrow",children:r}):r,f=c?e("div",{style:{overflow:"auto",overscrollBehavior:"contain",height:"100%"},children:o}):e(g,{className:"dndev-game-container__scroll",children:o});return p("div",{className:"dndev-game-container",children:[e("div",{className:l("dndev-game-container__content",v),"data-align":d,"data-justify":s,"data-content-variant":t,children:e("div",{className:"dndev-game-container__scroll-wrapper",children:f})}),a&&e("div",{className:l("dndev-game-container__cta",m),children:Array.isArray(a)?e("div",{className:"dndev-game-container__cta-buttons",children:a.map((n,u)=>e(i,{onClick:n.onClick,disabled:n.disabled??!1,variant:n.variant??"default",className:"dndev-game-container__cta-button",fullWidth:!0,children:n.label},u))}):e(i,{onClick:a.onClick,disabled:a.disabled??!1,variant:a.variant??"default",className:"dndev-game-container__cta-button",children:a.label})})]})}export{b as GameContainer};
@@ -1 +1 @@
1
- {"version":3,"file":"GameFlow.d.ts","sourceRoot":"","sources":["../../../src/components/layout/GameFlow.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CACjC,MAAM,EAEN,MAAM,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC,CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,cAAc,EAAE,cAAc,CAAC;IAC/B,oCAAoC;IACpC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iDAAiD;IACjD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAsCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CAAC,EACvB,cAAc,EACd,aAAa,EACb,UAAU,EACV,QAAe,GAChB,EAAE,aAAa,sCAgCf"}
1
+ {"version":3,"file":"GameFlow.d.ts","sourceRoot":"","sources":["../../../src/components/layout/GameFlow.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CACjC,MAAM,EAEN,MAAM,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC,CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,cAAc,EAAE,cAAc,CAAC;IAC/B,oCAAoC;IACpC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iDAAiD;IACjD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAsCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CAAC,EACvB,cAAc,EACd,aAAa,EACb,UAAU,EACV,QAAe,GAChB,EAAE,aAAa,sCAgCf"}
@@ -1,93 +1 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- // packages/ui/src/components/layout/GameFlow.tsx
3
- /**
4
- * @fileoverview Game Flow - Screen router for game/session flows
5
- * @description Handles routing, lazy loading, and preloading of game screens
6
- * @package @donotdev/ui
7
- * @version 0.1.0
8
- * @since 0.0.1
9
- * @author AMBROISE PARK Consulting
10
- */
11
- import { useEffect, Suspense, lazy, } from 'react';
12
- /**
13
- * Module-level cache for preloaded screens
14
- * Tracks which screens have been preloaded to avoid duplicate preloading
15
- */
16
- const preloadedScreens = new Set();
17
- /**
18
- * Module-level cache for lazy components.
19
- * CRITICAL: lazy() must NOT be called inside a component (useMemo or otherwise).
20
- * Doing so creates a new component TYPE on each call, which causes React to
21
- * unmount/remount the entire subtree and can trigger Rules of Hooks violations.
22
- * This cache ensures each screen name always resolves to the same lazy component ref.
23
- */
24
- const lazyComponentCache = new Map();
25
- /**
26
- * Get or create a cached lazy component for a screen name
27
- */
28
- function getLazyComponent(screenName, registry) {
29
- const cached = lazyComponentCache.get(screenName);
30
- if (cached)
31
- return cached;
32
- const importer = registry[screenName];
33
- if (!importer)
34
- return null;
35
- const component = lazy(importer);
36
- lazyComponentCache.set(screenName, component);
37
- return component;
38
- }
39
- /**
40
- * GameFlow - Screen router for game/session flows
41
- *
42
- * Handles:
43
- * - Routing to correct screen component based on currentScreen
44
- * - Lazy loading of screen components
45
- * - Preloading of nextScreen for instant transitions
46
- * - h-full wrapper for proper layout filling
47
- * - Suspense boundaries for loading states
48
- *
49
- * @param {GameFlowProps} props - Component props
50
- * @param {ScreenRegistry} props.screenRegistry - Registry of screen lazy imports
51
- * @param {string | null} props.currentScreen - Current screen name to render
52
- * @param {string | null} [props.nextScreen] - Next screen name for preloading
53
- * @param {ReactNode} [props.fallback] - Fallback component for Suspense
54
- * @returns {JSX.Element | null} GameFlow component
55
- *
56
- * @example
57
- * ```tsx
58
- * <GameFlow
59
- * screenRegistry={screenRegistry}
60
- * currentScreen={currentScreen}
61
- * nextScreen={nextScreen}
62
- * fallback={<Spinner overlay />}
63
- * />
64
- * ```
65
- *
66
- * @version 0.1.0
67
- * @since 0.0.1
68
- * @author AMBROISE PARK Consulting
69
- */
70
- export function GameFlow({ screenRegistry, currentScreen, nextScreen, fallback = null, }) {
71
- // Preload nextScreen component when it changes
72
- useEffect(() => {
73
- if (nextScreen && !preloadedScreens.has(nextScreen)) {
74
- preloadedScreens.add(nextScreen);
75
- const importer = screenRegistry[nextScreen];
76
- if (importer) {
77
- // Trigger lazy load without awaiting (fire and forget)
78
- importer().catch(() => {
79
- // Silently handle import errors - component will handle on render
80
- });
81
- }
82
- }
83
- }, [nextScreen, screenRegistry]);
84
- // Get cached lazy component for currentScreen (stable reference per screen name)
85
- const ScreenComponent = currentScreen
86
- ? getLazyComponent(currentScreen, screenRegistry)
87
- : null;
88
- // If no currentScreen or no component found, return null
89
- if (!currentScreen || !ScreenComponent) {
90
- return null;
91
- }
92
- return (_jsx("div", { style: { height: '100%' }, children: _jsx(Suspense, { fallback: fallback, children: _jsx(ScreenComponent, {}) }) }));
93
- }
1
+ "use client";import{useEffect as c,Suspense as a,lazy as u}from"react";import{jsx as l}from"react/jsx-runtime";var i=new Set,s=new Map;function f(n,t){let e=s.get(n);if(e)return e;let r=t[n];if(!r)return null;let o=u(r);return s.set(n,o),o}function m({screenRegistry:n,currentScreen:t,nextScreen:e,fallback:r=null}){c(()=>{if(e&&!i.has(e)){i.add(e);let p=n[e];p&&p().catch(()=>{})}},[e,n]);let o=t?f(t,n):null;return!t||!o?null:l("div",{style:{height:"100%"},children:l(a,{fallback:r,children:l(o,{})})})}export{m as GameFlow};
@@ -1 +1 @@
1
- {"version":3,"file":"PageConfig.d.ts","sourceRoot":"","sources":["../../../src/components/layout/PageConfig.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,EACzB,eAAe,EACf,MAAM,GACP,EAAE;IACD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,QAcA"}
1
+ {"version":3,"file":"PageConfig.d.ts","sourceRoot":"","sources":["../../../src/components/layout/PageConfig.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,UAAU,CAAC,EACzB,eAAe,EACf,MAAM,GACP,EAAE;IACD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB,QAcA"}