@donotdev/ui 0.3.0 → 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.
- package/dist/components/auth/AuthHeader.js +1 -93
- package/dist/components/auth/AuthMenu.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.js +3 -286
- package/dist/components/auth/index.js +1 -9
- package/dist/components/common/FeatureCard.d.ts.map +1 -1
- package/dist/components/common/FeatureCard.js +1 -86
- package/dist/components/common/FeatureDisabled.js +1 -67
- package/dist/components/common/IconPlaceholder.d.ts +24 -0
- package/dist/components/common/IconPlaceholder.d.ts.map +1 -0
- package/dist/components/common/IconPlaceholder.js +1 -0
- package/dist/components/common/LazyLucideIcon.d.ts +39 -0
- package/dist/components/common/LazyLucideIcon.d.ts.map +1 -0
- package/dist/components/common/LazyLucideIcon.js +1 -0
- package/dist/components/common/ProgressBar.js +1 -84
- package/dist/components/common/RedirectOverlay.js +1 -243
- package/dist/components/common/Skeleton.js +1 -144
- package/dist/components/common/TechBento.d.ts.map +1 -1
- package/dist/components/common/TechBento.js +1 -53
- package/dist/components/common/icon.d.ts +1 -1
- package/dist/components/common/icon.d.ts.map +1 -1
- package/dist/components/common/icon.js +1 -84
- package/dist/components/common/iconByName.d.ts +33 -0
- package/dist/components/common/iconByName.d.ts.map +1 -0
- package/dist/components/common/iconByName.js +1 -0
- package/dist/components/common/index.js +1 -16
- package/dist/components/cookie-consent/ConsentBanner.d.ts +3 -1
- package/dist/components/cookie-consent/ConsentBanner.d.ts.map +1 -1
- package/dist/components/cookie-consent/ConsentBanner.js +1 -31
- package/dist/components/cookie-consent/CookieConsent.d.ts.map +1 -1
- package/dist/components/cookie-consent/CookieConsent.js +1 -183
- package/dist/components/cookie-consent/index.js +1 -11
- package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts +7 -0
- package/dist/components/cookie-consent/useCookieNoticeRequired.d.ts.map +1 -0
- package/dist/components/cookie-consent/useCookieNoticeRequired.js +1 -0
- package/dist/components/index.js +1 -13
- package/dist/components/layout/GameContainer.d.ts.map +1 -1
- package/dist/components/layout/GameContainer.js +1 -72
- package/dist/components/layout/GameFlow.d.ts.map +1 -1
- package/dist/components/layout/GameFlow.js +1 -93
- package/dist/components/layout/PageConfig.d.ts.map +1 -1
- package/dist/components/layout/PageConfig.js +1 -47
- package/dist/components/layout/PageContainer.d.ts.map +1 -1
- package/dist/components/layout/PageContainer.js +1 -38
- package/dist/components/layout/components/Breadcrumbs.d.ts +2 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.js +1 -89
- package/dist/components/layout/components/DropdownNavigation.d.ts.map +1 -1
- package/dist/components/layout/components/DropdownNavigation.js +1 -30
- package/dist/components/layout/components/FloatingLanguageSwitcher.d.ts.map +1 -1
- package/dist/components/layout/components/FloatingLanguageSwitcher.js +1 -26
- package/dist/components/layout/components/Notifications.js +1 -182
- package/dist/components/layout/components/header/AppBranding.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppBranding.js +1 -54
- package/dist/components/layout/components/header/AppIcon.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppIcon.js +1 -59
- package/dist/components/layout/components/header/AppTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/AppTitle.js +1 -40
- package/dist/components/layout/components/header/CacheSettings.js +1 -225
- package/dist/components/layout/components/header/GameTitle.d.ts.map +1 -1
- package/dist/components/layout/components/header/GameTitle.js +1 -66
- package/dist/components/layout/components/header/HeaderMenu.d.ts +17 -16
- package/dist/components/layout/components/header/HeaderMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderMenu.js +1 -47
- package/dist/components/layout/components/header/HeaderNavigation.d.ts.map +1 -1
- package/dist/components/layout/components/header/HeaderNavigation.js +1 -66
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.js +1 -85
- package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
- package/dist/components/layout/components/header/ThemeToggle.js +1 -93
- package/dist/components/layout/components/index.js +1 -25
- package/dist/components/layout/index.js +1 -14
- package/dist/crud/components/ChildRowsPicker.js +1 -68
- package/dist/crud/components/CrudCardLink.js +1 -14
- package/dist/crud/components/EntityCardList.js +1 -184
- package/dist/crud/components/EntityDisplayRenderer.js +1 -130
- package/dist/crud/components/EntityFormRenderer.js +1 -433
- package/dist/crud/components/EntityList.js +1 -521
- package/dist/crud/components/EntityRecommendations.js +1 -87
- package/dist/crud/components/EntityWorkflow.js +1 -55
- package/dist/crud/components/Form.d.ts.map +1 -1
- package/dist/crud/components/Form.js +1 -198
- package/dist/crud/components/cellEditFor.js +1 -74
- package/dist/crud/components/entityParent.js +1 -76
- package/dist/crud/components/index.js +1 -16
- package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -1
- package/dist/crud/components/useRecordBreadcrumb.js +1 -43
- package/dist/crud/crudImports.js +1 -51
- package/dist/crud/index.js +1 -11
- package/dist/data/techLogos.js +1 -99
- package/dist/dndev-next.css +104 -17
- package/dist/dndev.css +104 -17
- package/dist/index.js +1 -5
- package/dist/internal/common/DnDevErrorBoundary.js +1 -55
- package/dist/internal/common/ErrorFallback.js +3 -214
- package/dist/internal/common/GlobalErrorFallback.js +1 -45
- package/dist/internal/common/RouteErrorFallback.js +3 -140
- package/dist/internal/devtools/DebugTools.js +1 -131
- package/dist/internal/devtools/components/AuthDebugButton.js +1 -72
- package/dist/internal/devtools/components/ConfigTab.js +1 -61
- package/dist/internal/devtools/components/CookieTab.js +1 -156
- package/dist/internal/devtools/components/DebugDialog.js +1 -48
- package/dist/internal/devtools/components/DesignTab.js +1 -469
- package/dist/internal/devtools/components/LayoutReset.js +1 -214
- package/dist/internal/devtools/components/MaskedValue.js +1 -39
- package/dist/internal/devtools/components/StoresTab.js +1 -90
- package/dist/internal/devtools/components/index.js +1 -16
- package/dist/internal/devtools/index.js +1 -13
- package/dist/internal/devtools/types.js +0 -2
- package/dist/internal/devtools/utils/envVarDiscovery.js +1 -106
- package/dist/internal/devtools/utils/index.js +1 -12
- package/dist/internal/devtools/utils/maskSensitive.js +1 -59
- package/dist/internal/devtools/utils/virtualModuleInspector.js +1 -309
- package/dist/internal/initializers/BaseStoresInitializer.js +1 -367
- package/dist/internal/initializers/NextJsStoresInitializer.js +1 -78
- package/dist/internal/initializers/ViteStoresInitializer.js +1 -20
- package/dist/internal/initializers/index.js +1 -11
- package/dist/internal/layout/DnDevLayout.js +1 -321
- package/dist/internal/layout/components/AutoMetaTags.d.ts +2 -0
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +1 -338
- package/dist/internal/layout/components/FaviconHead.js +1 -60
- package/dist/internal/layout/components/FontPreloadLinks.js +1 -31
- package/dist/internal/layout/components/HeadTags.js +1 -20
- package/dist/internal/layout/components/PWAUpdateNotification.js +1 -131
- package/dist/internal/layout/components/footer/FooterBranding.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterBranding.js +1 -35
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterCopyright.js +1 -37
- package/dist/internal/layout/components/footer/FooterLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterLegalLinks.js +1 -44
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts +4 -2
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/useLegalLinks.js +1 -21
- package/dist/internal/layout/components/i18nSeoMeta.js +1 -53
- package/dist/internal/layout/components/index.js +1 -13
- package/dist/internal/layout/config/defaults.js +1 -47
- package/dist/internal/layout/config/index.js +1 -11
- package/dist/internal/layout/config/presets/admin.js +1 -35
- package/dist/internal/layout/config/presets/blog.js +1 -31
- package/dist/internal/layout/config/presets/docs.js +1 -51
- package/dist/internal/layout/config/presets/game.js +1 -53
- package/dist/internal/layout/config/presets/index.js +1 -24
- package/dist/internal/layout/config/presets/landing.js +1 -42
- package/dist/internal/layout/config/presets/moolti.js +1 -52
- package/dist/internal/layout/config/presets/plain.js +1 -25
- package/dist/internal/layout/renderers/index.js +0 -10
- package/dist/internal/layout/zones/DnDevFooter.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevFooter.js +1 -67
- package/dist/internal/layout/zones/DnDevHeader.js +1 -41
- package/dist/internal/layout/zones/DnDevMergedBar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevMergedBar.js +1 -52
- package/dist/internal/layout/zones/DnDevSidebar.d.ts.map +1 -1
- package/dist/internal/layout/zones/DnDevSidebar.js +1 -181
- package/dist/internal/layout/zones/index.js +1 -14
- package/dist/internal/providers/NavigationProvider.d.ts.map +1 -1
- package/dist/internal/providers/NavigationProvider.js +1 -71
- package/dist/internal/providers/SentryInitializer.d.ts.map +1 -1
- package/dist/internal/providers/SentryInitializer.js +1 -36
- package/dist/internal/providers/UIProviders.js +1 -79
- package/dist/internal/providers/index.js +1 -12
- package/dist/next.js +1 -11
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +1 -107
- package/dist/providers/ViteAppProviders.d.ts.map +1 -1
- package/dist/providers/ViteAppProviders.js +1 -117
- package/dist/providers/index.js +1 -11
- package/dist/routing/404.js +1 -108
- package/dist/routing/AuthGuard.js +1 -178
- package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
- package/dist/routing/AuthGuardFallback.js +1 -67
- package/dist/routing/AuthReturnTo.js +1 -68
- package/dist/routing/DnDevNavigationMenu.d.ts.map +1 -1
- package/dist/routing/DnDevNavigationMenu.js +1 -138
- package/dist/routing/GoTo.d.ts.map +1 -1
- package/dist/routing/GoTo.js +1 -38
- package/dist/routing/GoToDialog.d.ts.map +1 -1
- package/dist/routing/GoToDialog.js +1 -97
- package/dist/routing/GoToInput.d.ts.map +1 -1
- package/dist/routing/GoToInput.js +1 -49
- package/dist/routing/GoToWrapper.d.ts.map +1 -1
- package/dist/routing/GoToWrapper.js +1 -59
- package/dist/routing/Link.d.ts +10 -2
- package/dist/routing/Link.d.ts.map +1 -1
- package/dist/routing/Link.js +1 -109
- package/dist/routing/NavigationItem.d.ts.map +1 -1
- package/dist/routing/NavigationItem.js +1 -44
- package/dist/routing/NotFoundDocument.d.ts +33 -0
- package/dist/routing/NotFoundDocument.d.ts.map +1 -0
- package/dist/routing/NotFoundDocument.js +1 -0
- package/dist/routing/SignedInRedirect.js +1 -47
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/index.js +1 -26
- package/dist/routing/hooks/types.js +0 -2
- package/dist/routing/hooks/useLocation.next.js +1 -35
- package/dist/routing/hooks/useLocation.vite.js +1 -13
- package/dist/routing/hooks/useMatch.next.js +1 -31
- package/dist/routing/hooks/useMatch.vite.js +1 -6
- package/dist/routing/hooks/useNavigate.next.js +1 -64
- package/dist/routing/hooks/useNavigate.vite.js +1 -61
- package/dist/routing/hooks/useParams.next.js +1 -9
- package/dist/routing/hooks/useParams.vite.js +1 -6
- package/dist/routing/hooks/useQueryParams.next.js +1 -66
- package/dist/routing/hooks/useQueryParams.vite.js +1 -66
- package/dist/routing/hooks/useRedirectGuard.next.js +1 -119
- package/dist/routing/hooks/useRedirectGuard.vite.js +1 -117
- package/dist/routing/hooks/useRouteParam.next.js +1 -38
- package/dist/routing/hooks/useRouteParam.vite.js +1 -38
- package/dist/routing/hooks/useRoutePath.next.js +1 -36
- package/dist/routing/hooks/useRoutePath.vite.js +1 -25
- package/dist/routing/hooks/useSearchParams.next.js +1 -22
- package/dist/routing/hooks/useSearchParams.vite.js +1 -22
- package/dist/routing/hooks/useUrlLanguage.next.js +1 -50
- package/dist/routing/hooks/useUrlLanguage.vite.js +1 -41
- package/dist/routing/index.d.ts +1 -0
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +1 -32
- package/dist/routing/link/InternalLink.next.d.ts +23 -0
- package/dist/routing/link/InternalLink.next.d.ts.map +1 -0
- package/dist/routing/link/InternalLink.next.js +1 -0
- package/dist/routing/link/InternalLink.vite.d.ts +22 -0
- package/dist/routing/link/InternalLink.vite.d.ts.map +1 -0
- package/dist/routing/link/InternalLink.vite.js +1 -0
- package/dist/routing/link/absolutePath.d.ts +17 -0
- package/dist/routing/link/absolutePath.d.ts.map +1 -0
- package/dist/routing/link/absolutePath.js +1 -0
- package/dist/routing/link/link.next.d.ts +12 -0
- package/dist/routing/link/link.next.d.ts.map +1 -0
- package/dist/routing/link/link.next.js +1 -0
- package/dist/routing/link/link.vite.d.ts +12 -0
- package/dist/routing/link/link.vite.d.ts.map +1 -0
- package/dist/routing/link/link.vite.js +1 -0
- package/dist/routing/link/types.d.ts +30 -0
- package/dist/routing/link/types.d.ts.map +1 -0
- package/dist/routing/link/types.js +0 -0
- package/dist/routing/parentRoute.js +1 -43
- package/dist/routing/useGoTo.d.ts.map +1 -1
- package/dist/routing/useGoTo.js +1 -59
- package/dist/routing/useNavigation.d.ts.map +1 -1
- package/dist/routing/useNavigation.js +1 -114
- package/dist/routing/useRouteDiscovery.d.ts +1 -0
- package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
- package/dist/routing/useRouteDiscovery.js +1 -313
- package/dist/rsc.d.ts +28 -0
- package/dist/rsc.d.ts.map +1 -0
- package/dist/rsc.js +1 -0
- package/dist/styles/index.css +104 -17
- package/dist/styles/index.js +1 -10
- package/dist/styles/layoutConstants.js +1 -134
- package/dist/symbol-index.json +1 -1
- package/dist/utils/assetResolver.d.ts.map +1 -1
- package/dist/utils/assetResolver.js +1 -297
- package/dist/utils/index.js +1 -23
- package/dist/utils/sanitizeSvg.js +1 -51
- package/dist/utils/tList.js +1 -42
- package/dist/utils/useAISafe.d.ts.map +1 -1
- package/dist/utils/useAISafe.js +1 -53
- package/dist/utils/useAuthSafe.d.ts.map +1 -1
- package/dist/utils/useAuthSafe.js +1 -78
- package/dist/utils/useAuthVisibility.d.ts.map +1 -1
- package/dist/utils/useAuthVisibility.js +1 -63
- package/dist/utils/useBillingVisibility.d.ts.map +1 -1
- package/dist/utils/useBillingVisibility.js +1 -57
- package/dist/utils/useCrudSafe.d.ts.map +1 -1
- package/dist/utils/useCrudSafe.js +1 -75
- package/dist/utils/useDeleteAccountSafe.js +1 -52
- package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
- package/dist/utils/useFormStoreSafe.js +1 -85
- package/dist/utils/useOAuthSafe.d.ts.map +1 -1
- package/dist/utils/useOAuthSafe.js +1 -38
- package/dist/utils/useSeo.js +1 -151
- package/dist/utils/useStripeBillingSafe.d.ts.map +1 -1
- package/dist/utils/useStripeBillingSafe.js +1 -81
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +1 -235
- package/dist/vite-routing/RootLayout.d.ts.map +1 -1
- package/dist/vite-routing/RootLayout.js +1 -205
- package/dist/vite-routing/index.js +1 -11
- package/dist/vite.js +1 -10
- package/guidelines/COMPONENTS.md +4 -4
- package/guidelines/PAGES.md +3 -0
- package/guidelines/ROUTING.md +15 -0
- package/guidelines/SEO.md +4 -1
- package/package.json +18 -8
- package/dist/ChildRowsPicker-63M4EQUQ.js +0 -1
- package/dist/ChildRowsPicker-ISP365ON.js +0 -1
- package/dist/ChildRowsPicker-PQFE6NCR.js +0 -1
- package/dist/ChildRowsPicker-XXFFSMWY.js +0 -1
- package/dist/CookieConsent-QOUAY6B4.js +0 -1
- package/dist/GoToDialog-KSBGOIWO.js +0 -1
- package/dist/GoToDialog-XBK5EZF4.js +0 -1
- package/dist/chunk-3CIZFGST.js +0 -1
- package/dist/chunk-LHMKU342.js +0 -1
- package/dist/chunk-MS7ZIW5Z.js +0 -1
- package/dist/chunk-O2XFH626.js +0 -1
- package/dist/chunk-P2DHZWPY.js +0 -1
- package/dist/components/common/lucideIconByName.d.ts +0 -9
- package/dist/components/common/lucideIconByName.d.ts.map +0 -1
- package/dist/components/common/lucideIconByName.js +0 -32
- package/dist/internal/layout/components/PerformanceHints.d.ts +0 -71
- package/dist/internal/layout/components/PerformanceHints.d.ts.map +0 -1
- package/dist/internal/layout/components/PerformanceHints.js +0 -71
|
@@ -1,47 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* @fileoverview PageConfig - Declarative per-page layout overrides (Next.js)
|
|
4
|
-
* @description Tiny component that sets route-level overrides in the theme store.
|
|
5
|
-
* For Vite, LayoutRoute handles this automatically from PageMeta.
|
|
6
|
-
* For Next.js, drop <PageConfig hideBreadcrumbs /> in your page component.
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.2.0
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { useLayoutEffect } from 'react';
|
|
13
|
-
import { useLayout } from '@donotdev/core';
|
|
14
|
-
/**
|
|
15
|
-
* PageConfig - Declarative per-page layout overrides
|
|
16
|
-
*
|
|
17
|
-
* Sets route-level overrides (preset, hideBreadcrumbs) in the theme store.
|
|
18
|
-
* Cleans up on unmount (resets to defaults).
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```tsx
|
|
22
|
-
* // In a Next.js page component:
|
|
23
|
-
* export default function MyPage() {
|
|
24
|
-
* return (
|
|
25
|
-
* <>
|
|
26
|
-
* <PageConfig hideBreadcrumbs />
|
|
27
|
-
* <PageContainer>...</PageContainer>
|
|
28
|
-
* </>
|
|
29
|
-
* );
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export function PageConfig({ hideBreadcrumbs, preset, }) {
|
|
34
|
-
const setHide = useLayout('setRouteHideBreadcrumbs');
|
|
35
|
-
const setPreset = useLayout('setRoutePresetOverride');
|
|
36
|
-
useLayoutEffect(() => {
|
|
37
|
-
if (hideBreadcrumbs != null)
|
|
38
|
-
setHide(hideBreadcrumbs);
|
|
39
|
-
if (preset != null)
|
|
40
|
-
setPreset(preset);
|
|
41
|
-
return () => {
|
|
42
|
-
setHide(false);
|
|
43
|
-
setPreset(null);
|
|
44
|
-
};
|
|
45
|
-
}, [hideBreadcrumbs, preset, setHide, setPreset]);
|
|
46
|
-
return null;
|
|
47
|
-
}
|
|
1
|
+
"use client";import{useLayoutEffect as n}from"react";import{useLayout as u}from"@donotdev/core";function f({hideBreadcrumbs:e,preset:t}){let o=u("setRouteHideBreadcrumbs"),r=u("setRoutePresetOverride");return n(()=>(e!=null&&o(e),t!=null&&r(t),()=>{o(!1),r(null)}),[e,t,o,r]),null}export{f as PageConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageContainer.d.ts","sourceRoot":"","sources":["../../../src/components/layout/PageContainer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PageContainer.d.ts","sourceRoot":"","sources":["../../../src/components/layout/PageContainer.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAkB,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGtE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAe9C;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAC5B,MAAM,GACN,UAAU,GACV,MAAM,GACN,QAAQ,GACR,OAAO,CAAC;AAEZ;;GAEG;AACH,UAAU,kBAAkB;IAC1B,4BAA4B;IAC5B,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAE/B,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,oBAAoB;IACpB,QAAQ,EAAE,SAAS,CAAC;IAEpB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,kBAAkB,CAqB3D,CAAC"}
|
|
@@ -1,38 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// packages/ui/src/components/layout/PageContainer.tsx
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview PageContainer - Semantic Layout Wrapper with Automatic SEO
|
|
5
|
-
* @description Takes all available space from Layout parent, provides automatic meta tags
|
|
6
|
-
* @package @donotdev/ui
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.0.1
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { Suspense } from 'react';
|
|
13
|
-
import { cn } from '@donotdev/components';
|
|
14
|
-
import DnDevErrorBoundary from '../../internal/common/DnDevErrorBoundary';
|
|
15
|
-
import RouteErrorFallback from '../../internal/common/RouteErrorFallback';
|
|
16
|
-
function PageContainerErrorFallback(props) {
|
|
17
|
-
return (_jsx(Suspense, { fallback: _jsx("div", { children: "Loading error fallback..." }), children: _jsx(RouteErrorFallback, { ...props }) }));
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* PageContainer - Layout wrapper with semantic width constraints
|
|
21
|
-
*
|
|
22
|
-
* DnDevLayout already handles:
|
|
23
|
-
* - Main padding via --content-padding
|
|
24
|
-
* - Sidebar/header spacing
|
|
25
|
-
* - Responsive behavior
|
|
26
|
-
*
|
|
27
|
-
* @version 0.1.0
|
|
28
|
-
* @since 0.0.1
|
|
29
|
-
* @author AMBROISE PARK Consulting
|
|
30
|
-
*
|
|
31
|
-
* PageContainer provides:
|
|
32
|
-
* - Semantic width constraints without additional padding
|
|
33
|
-
* - Automatic spacing system using CSS variables
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
export const PageContainer = ({ variant = 'standard', density, className, children, centered = true, gapFirst = false, }) => {
|
|
37
|
-
return (_jsx(DnDevErrorBoundary, { level: "route", fallback: PageContainerErrorFallback, children: _jsx("div", { className: cn('dndev-container', className), "data-variant": variant, "data-density": density, "data-centered": centered ? 'true' : 'false', "data-gap-first": gapFirst ? 'true' : undefined, children: children }) }));
|
|
38
|
-
};
|
|
1
|
+
"use client";import{Suspense as d}from"react";import{cn as p}from"@donotdev/components";import s from"../../internal/common/DnDevErrorBoundary.js";import l from"../../internal/common/RouteErrorFallback.js";import{jsx as e}from"react/jsx-runtime";function c(r){return e(d,{fallback:e("div",{children:"Loading error fallback..."}),children:e(l,{...r})})}var v=({variant:r="standard",density:a,className:o,children:n,centered:t=!0,gapFirst:i=!1})=>e(s,{level:"route",fallback:c,children:e("div",{className:p("dndev-container",o),"data-variant":r,"data-density":a,"data-centered":t?"true":"false","data-gap-first":i?"true":void 0,children:n})});export{v as PageContainer};
|
|
@@ -31,7 +31,8 @@ export interface BreadcrumbsProps {
|
|
|
31
31
|
* @since 0.0.1
|
|
32
32
|
* @author AMBROISE PARK Consulting
|
|
33
33
|
*
|
|
34
|
-
* Automatically generates breadcrumbs from current route or accepts custom items
|
|
34
|
+
* Automatically generates breadcrumbs from current route or accepts custom items.
|
|
35
|
+
* Renders no generated trail inside a NotFoundDocument (the 404, served for any URL).
|
|
35
36
|
*/
|
|
36
37
|
declare const Breadcrumbs: ComponentType<BreadcrumbsProps>;
|
|
37
38
|
export default Breadcrumbs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/components/Breadcrumbs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/components/Breadcrumbs.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAY3C,yCAAyC;AACzC,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC9C;AAED,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAC/B,+EAA+E;IAC/E,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,iCAAiC;IACjC,SAAS,CAAC,EAAE,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClD,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,uBAAuB;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,QAAA,MAAM,WAAW,EAAE,aAAa,CAAC,gBAAgB,CA0FhD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,89 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// packages/ui/src/components/layout/components/Breadcrumbs.tsx
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview Breadcrumbs Component
|
|
5
|
-
* @description Professional breadcrumb navigation with route discovery
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Automatic route discovery and breadcrumb generation
|
|
9
|
-
* - Clickable navigation
|
|
10
|
-
* - Professional styling with icons
|
|
11
|
-
* - Responsive design
|
|
12
|
-
* - Customizable separator
|
|
13
|
-
* - Active state management
|
|
14
|
-
*
|
|
15
|
-
* @version 0.1.0
|
|
16
|
-
* @since 0.0.1
|
|
17
|
-
* @author AMBROISE PARK Consulting
|
|
18
|
-
*/
|
|
19
|
-
import { ChevronRight } from 'lucide-react';
|
|
20
|
-
import { useMemo } from 'react';
|
|
21
|
-
import { cn } from '@donotdev/components';
|
|
22
|
-
import { useLayout, useTranslation } from '@donotdev/core';
|
|
23
|
-
// Platform-specific hooks via conditional exports
|
|
24
|
-
import { useRoutePath } from '@donotdev/ui/routing/hooks';
|
|
25
|
-
import { Link } from '../../../routing/Link';
|
|
26
|
-
import { getPathPrefixes } from '../../../routing/parentRoute';
|
|
27
|
-
import { useAllRoutes } from '../../../routing/useRouteDiscovery';
|
|
28
|
-
/**
|
|
29
|
-
* Breadcrumbs component for navigation
|
|
30
|
-
*
|
|
31
|
-
* @version 0.1.0
|
|
32
|
-
* @since 0.0.1
|
|
33
|
-
* @author AMBROISE PARK Consulting
|
|
34
|
-
*
|
|
35
|
-
* Automatically generates breadcrumbs from current route or accepts custom items
|
|
36
|
-
*/
|
|
37
|
-
const Breadcrumbs = ({ items, separator: Separator = ChevronRight, showHome = true, homeHref = '/', variant = 'default', className, }) => {
|
|
38
|
-
const { t } = useTranslation('dndev');
|
|
39
|
-
const pathname = useRoutePath();
|
|
40
|
-
const allRoutes = useAllRoutes();
|
|
41
|
-
// Record shown by the page (set by EntityFormRenderer / EntityDisplayRenderer)
|
|
42
|
-
const recordLabel = useLayout('routeRecordLabel');
|
|
43
|
-
// Build set of valid route paths for existence checking
|
|
44
|
-
const validRoutes = useMemo(() => {
|
|
45
|
-
return new Set(allRoutes.map((route) => route.path));
|
|
46
|
-
}, [allRoutes]);
|
|
47
|
-
// Auto-generate breadcrumbs from current path if not provided
|
|
48
|
-
const breadcrumbItems = items
|
|
49
|
-
? items
|
|
50
|
-
: (() => {
|
|
51
|
-
const pathSegments = pathname.split('/').filter(Boolean);
|
|
52
|
-
const prefixes = getPathPrefixes(pathname);
|
|
53
|
-
const breadcrumbs = [];
|
|
54
|
-
pathSegments.forEach((segment, index) => {
|
|
55
|
-
const currentPath = prefixes[index] ?? '';
|
|
56
|
-
// A record id segment shows the record's name, not the raw id
|
|
57
|
-
const label = recordLabel && decodeURIComponent(segment) === recordLabel.id
|
|
58
|
-
? recordLabel.label
|
|
59
|
-
: segment
|
|
60
|
-
.split('-')
|
|
61
|
-
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
62
|
-
.join(' ');
|
|
63
|
-
// Only add href if route actually exists
|
|
64
|
-
const href = validRoutes.has(currentPath) ? currentPath : undefined;
|
|
65
|
-
breadcrumbs.push({ label, href });
|
|
66
|
-
});
|
|
67
|
-
return breadcrumbs;
|
|
68
|
-
})();
|
|
69
|
-
// Add home item if enabled
|
|
70
|
-
const allItems = showHome
|
|
71
|
-
? [
|
|
72
|
-
{ label: t('navigation.home', 'Home'), href: homeHref },
|
|
73
|
-
...breadcrumbItems,
|
|
74
|
-
]
|
|
75
|
-
: breadcrumbItems;
|
|
76
|
-
// Smart variant: Hide breadcrumbs on simple pages (root or single segment)
|
|
77
|
-
if (variant === 'smart') {
|
|
78
|
-
const segments = pathname.split('/').filter(Boolean);
|
|
79
|
-
if (segments.length < 2) {
|
|
80
|
-
return null; // Don't render breadcrumbs on simple pages
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return (_jsx("nav", { role: "navigation", "aria-label": "Breadcrumb navigation", className: cn('breadcrumbs', className), children: allItems.map((item, index) => {
|
|
84
|
-
const isLast = index === allItems.length - 1;
|
|
85
|
-
const isActive = isLast || !item.href;
|
|
86
|
-
return (_jsxs("span", { className: "breadcrumb-item", children: [index > 0 && _jsx(Separator, { className: "dndev-size-md separator" }), item.icon && _jsx(item.icon, { className: "dndev-size-md icon" }), item.href && !isActive ? (_jsx(Link, { path: item.href, className: "breadcrumb-link", children: item.label })) : (_jsx("span", { className: "breadcrumb-label", children: item.label }))] }, index));
|
|
87
|
-
}) }));
|
|
88
|
-
};
|
|
89
|
-
export default Breadcrumbs;
|
|
1
|
+
"use client";import{ChevronRight as C}from"lucide-react";import{useMemo as L}from"react";import{cn as R}from"@donotdev/components";import{useLayout as P,useTranslation as T}from"@donotdev/core";import{useRoutePath as k}from"@donotdev/ui/routing/hooks";import{Link as A}from"../../../routing/Link.js";import{useIsNotFoundDocument as D}from"../../../routing/NotFoundDocument.js";import{getPathPrefixes as F}from"../../../routing/parentRoute.js";import{useAllRoutes as H}from"../../../routing/useRouteDiscovery.js";import{jsx as t,jsxs as z}from"react/jsx-runtime";var x=({items:o,separator:d=C,showHome:b=!0,homeHref:f="/",variant:h="default",className:g})=>{let{t:v}=T("dndev"),n=k(),c=H(),s=P("routeRecordLabel"),B=L(()=>new Set(c.map(e=>e.path)),[c]);if(D()&&!o)return null;let l=o||(()=>{let e=n.split("/").filter(Boolean),r=F(n),m=[];return e.forEach((a,N)=>{let u=r[N]??"",I=s&&decodeURIComponent(a)===s.id?s.label:a.split("-").map(p=>p.charAt(0).toUpperCase()+p.slice(1)).join(" "),y=B.has(u)?u:void 0;m.push({label:I,href:y})}),m})(),i=b?[{label:v("navigation.home","Home"),href:f},...l]:l;return h==="smart"&&n.split("/").filter(Boolean).length<2?null:t("nav",{role:"navigation","aria-label":"Breadcrumb navigation",className:R("breadcrumbs",g),children:i.map((e,r)=>{let a=r===i.length-1||!e.href;return z("span",{className:"breadcrumb-item",children:[r>0&&t(d,{className:"dndev-size-md separator"}),e.icon&&t(e.icon,{className:"dndev-size-md icon"}),e.href&&!a?t(A,{path:e.href,className:"breadcrumb-link",children:e.label}):t("span",{className:"breadcrumb-label",children:e.label})]},r)})})},O=x;export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/components/DropdownNavigation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DropdownNavigation.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/components/DropdownNavigation.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAItD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKtD;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;GAaG;AACH,QAAA,MAAM,kBAAkB,EAAE,aAAa,CAAC,uBAAuB,CAsD9D,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1,30 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { DropdownMenu, Button, cn, Stack } from '@donotdev/components';
|
|
3
|
-
import { Link } from '../../../routing/Link';
|
|
4
|
-
import { NavigationItemComponent } from '../../../routing/NavigationItem';
|
|
5
|
-
/**
|
|
6
|
-
* DropdownNavigation component - professional navigation with dropdown support
|
|
7
|
-
*
|
|
8
|
-
* Renders a navigation bar with dropdown menus for complex navigation structures.
|
|
9
|
-
* Supports both direct links and dropdown menus with subroutes.
|
|
10
|
-
*
|
|
11
|
-
* @version 0.1.0
|
|
12
|
-
* @since 0.0.1
|
|
13
|
-
* @author AMBROISE PARK Consulting
|
|
14
|
-
*
|
|
15
|
-
* @param navigation - Array of navigation menu items
|
|
16
|
-
* @param className - Additional CSS classes
|
|
17
|
-
* @returns Rendered navigation component
|
|
18
|
-
*/
|
|
19
|
-
const DropdownNavigation = ({ navigation, className, }) => {
|
|
20
|
-
return (_jsx(Stack, { role: "navigation", direction: "row", align: "center", className: className, style: { gap: 'var(--gap-sm)' }, children: navigation.map((item, idx) => item.routes && item.routes.length > 0 ? (_jsx(DropdownMenu, { trigger: _jsx(Button, { icon: item.icon, children: item.label }), items: item.routes.map((route) => {
|
|
21
|
-
// NavigationItemComponent already renders a Link/anchor — use it directly.
|
|
22
|
-
// External links are handled via the route.external flag inside NavigationItemComponent.
|
|
23
|
-
return {
|
|
24
|
-
label: route.label,
|
|
25
|
-
children: _jsx(NavigationItemComponent, { route: route }),
|
|
26
|
-
asChild: !!route.path,
|
|
27
|
-
};
|
|
28
|
-
}), contentAlign: "start" }, item.label + idx)) : item.path ? (_jsx(Button, { icon: item.icon, "aria-label": item.label, render: ({ children, ...props }) => (_jsx(Link, { path: item.path, ...props, children: children })), children: item.label }, item.label + idx)) : (_jsx(Button, { icon: item.icon, disabled: true, "aria-label": item.label, children: item.label }, item.label + idx))) }));
|
|
29
|
-
};
|
|
30
|
-
export default DropdownNavigation;
|
|
1
|
+
"use client";import{DropdownMenu as i,Button as e,Stack as c}from"@donotdev/components";import{Link as s}from"../../../routing/Link.js";import{NavigationItemComponent as g}from"../../../routing/NavigationItem.js";import{jsx as a}from"react/jsx-runtime";var d=({navigation:r,className:l})=>a(c,{role:"navigation",direction:"row",align:"center",className:l,style:{gap:"var(--gap-sm)"},children:r.map((o,t)=>o.routes&&o.routes.length>0?a(i,{trigger:a(e,{icon:o.icon,children:o.label}),items:o.routes.map(n=>({label:n.label,children:a(g,{route:n}),asChild:!!n.path})),contentAlign:"start"},o.label+t):o.path?a(e,{icon:o.icon,"aria-label":o.label,render:({children:n,...p})=>a(s,{path:o.path,...p,children:n}),children:o.label},o.label+t):a(e,{icon:o.icon,disabled:!0,"aria-label":o.label,children:o.label},o.label+t))}),m=d;export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingLanguageSwitcher.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/components/FloatingLanguageSwitcher.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FloatingLanguageSwitcher.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/components/FloatingLanguageSwitcher.tsx"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAI3C,wDAAwD;AACxD,MAAM,WAAW,6BAA6B;IAC5C,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;GAMG;AACH,QAAA,MAAM,wBAAwB,EAAE,aAAa,CAC3C,6BAA6B,CAqC9B,CAAC;AAEF,eAAe,wBAAwB,CAAC"}
|
|
@@ -1,26 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Card, cn } from '@donotdev/components';
|
|
3
|
-
/**
|
|
4
|
-
* FloatingLanguageSwitcher - Professional, floating language selector
|
|
5
|
-
*
|
|
6
|
-
* @version 0.1.0
|
|
7
|
-
* @since 0.0.1
|
|
8
|
-
* @author AMBROISE PARK Consulting
|
|
9
|
-
*/
|
|
10
|
-
const FloatingLanguageSwitcher = ({ languages, currentLanguage, onLanguageChange, className }) => {
|
|
11
|
-
return (_jsx(Card, { className: cn('dndev-z-modal', className), style: {
|
|
12
|
-
position: 'fixed',
|
|
13
|
-
bottom: 'var(--gap-md)',
|
|
14
|
-
insetInlineEnd: 'var(--gap-md)',
|
|
15
|
-
display: 'flex',
|
|
16
|
-
alignItems: 'center',
|
|
17
|
-
gap: 'var(--gap-sm)',
|
|
18
|
-
transition: 'var(--dur-fast) ease-out',
|
|
19
|
-
}, role: "region", "aria-label": "Language selector", "data-role": "floating", children: _jsx("select", { style: {
|
|
20
|
-
backgroundColor: 'transparent',
|
|
21
|
-
outline: 'none',
|
|
22
|
-
fontSize: 'var(--font-size-base)',
|
|
23
|
-
cursor: 'pointer',
|
|
24
|
-
}, value: currentLanguage, onChange: (e) => onLanguageChange?.(e.target.value), "aria-label": "Select language", children: languages.map((lang) => (_jsx("option", { value: lang, children: lang }, lang))) }) }));
|
|
25
|
-
};
|
|
26
|
-
export default FloatingLanguageSwitcher;
|
|
1
|
+
"use client";import{Card as g,cn as i}from"@donotdev/components";import{jsx as a}from"react/jsx-runtime";var l=({languages:n,currentLanguage:t,onLanguageChange:o,className:r})=>a(g,{className:i("dndev-z-modal",r),style:{position:"fixed",bottom:"var(--gap-md)",insetInlineEnd:"var(--gap-md)",display:"flex",alignItems:"center",gap:"var(--gap-sm)",transition:"var(--dur-fast) ease-out"},role:"region","aria-label":"Language selector","data-role":"floating",children:a("select",{style:{backgroundColor:"transparent",outline:"none",fontSize:"var(--font-size-base)",cursor:"pointer"},value:t,onChange:e=>o?.(e.target.value),"aria-label":"Select language",children:n.map(e=>a("option",{value:e,children:e},e))})}),p=l;export{p as default};
|
|
@@ -1,182 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
// packages/ui/src/components/layout/components/Notifications.tsx
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview Notifications component for layout system
|
|
6
|
-
* @description Notification bell with dropdown for displaying user notifications
|
|
7
|
-
*
|
|
8
|
-
* This component provides a notification system for the layout header with
|
|
9
|
-
* badge counts, dropdown display, and proper accessibility. It integrates
|
|
10
|
-
* with notification stores and provides real-time updates.
|
|
11
|
-
*
|
|
12
|
-
* @version 0.1.0
|
|
13
|
-
* @since 0.0.1
|
|
14
|
-
* @author AMBROISE PARK Consulting
|
|
15
|
-
* @example
|
|
16
|
-
* ```tsx
|
|
17
|
-
* <Notifications
|
|
18
|
-
* count={5}
|
|
19
|
-
* notifications={notifications}
|
|
20
|
-
* onNotificationClick={markAsRead}
|
|
21
|
-
* />
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
// packages/core/ui/src/components/layout/components/Notifications.tsx
|
|
25
|
-
import { Bell } from 'lucide-react';
|
|
26
|
-
import { useMemo, useEffect, useRef } from 'react';
|
|
27
|
-
import { Button, cn, toast, Stack } from '@donotdev/components';
|
|
28
|
-
/**
|
|
29
|
-
* Size mappings for consistent notification component sizing using CSS variables
|
|
30
|
-
*/
|
|
31
|
-
const SIZE_VARIANTS = {
|
|
32
|
-
sm: {
|
|
33
|
-
button: { width: 'var(--icon-md)', height: 'var(--icon-md)' },
|
|
34
|
-
icon: { width: 'var(--icon-md)', height: 'var(--icon-md)' },
|
|
35
|
-
badge: {
|
|
36
|
-
width: 'var(--icon-md)',
|
|
37
|
-
height: 'var(--icon-md)',
|
|
38
|
-
fontSize: 'var(--font-size-xs)',
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
md: {
|
|
42
|
-
button: { width: 'var(--touch-target)', height: 'var(--touch-target)' },
|
|
43
|
-
icon: { width: 'var(--icon-md)', height: 'var(--icon-md)' },
|
|
44
|
-
badge: {
|
|
45
|
-
width: 'var(--icon-md)',
|
|
46
|
-
height: 'var(--icon-md)',
|
|
47
|
-
fontSize: 'var(--font-size-xs)',
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
lg: {
|
|
51
|
-
button: { width: 'var(--touch-target)', height: 'var(--touch-target)' },
|
|
52
|
-
icon: { width: 'var(--icon-touch)', height: 'var(--icon-touch)' },
|
|
53
|
-
badge: {
|
|
54
|
-
width: 'var(--icon-touch)',
|
|
55
|
-
height: 'var(--icon-touch)',
|
|
56
|
-
fontSize: 'var(--font-size-sm)',
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Notifications component - notification bell with dropdown
|
|
62
|
-
*
|
|
63
|
-
* Features:
|
|
64
|
-
* - Badge count display with proper formatting
|
|
65
|
-
* - Dropdown notification list
|
|
66
|
-
* - Real-time notification updates
|
|
67
|
-
* - Mark as read functionality
|
|
68
|
-
* - Different notification types with styling
|
|
69
|
-
* - Responsive design
|
|
70
|
-
* - Keyboard navigation support
|
|
71
|
-
* - Loading states
|
|
72
|
-
* - Empty states
|
|
73
|
-
* - Time formatting for timestamps
|
|
74
|
-
*
|
|
75
|
-
* This component provides a complete notification system that can be
|
|
76
|
-
* easily integrated into any layout header or navigation area.
|
|
77
|
-
*
|
|
78
|
-
* @version 0.1.0
|
|
79
|
-
* @since 0.0.1
|
|
80
|
-
* @author AMBROISE PARK Consulting
|
|
81
|
-
* @param props - Notifications component props
|
|
82
|
-
* @returns React component
|
|
83
|
-
*
|
|
84
|
-
* @example
|
|
85
|
-
* ```tsx
|
|
86
|
-
* // Basic usage
|
|
87
|
-
* <Notifications count={3} />
|
|
88
|
-
*
|
|
89
|
-
* // With full notification data
|
|
90
|
-
* <Notifications
|
|
91
|
-
* notifications={[
|
|
92
|
-
* {
|
|
93
|
-
* id: '1',
|
|
94
|
-
* title: 'New message',
|
|
95
|
-
* message: 'You have a new message from John',
|
|
96
|
-
* type: 'info',
|
|
97
|
-
* timestamp: new Date(),
|
|
98
|
-
* }
|
|
99
|
-
* ]}
|
|
100
|
-
* onNotificationClick={handleNotificationClick}
|
|
101
|
-
* />
|
|
102
|
-
*
|
|
103
|
-
* // Custom styling and behavior
|
|
104
|
-
* <Notifications
|
|
105
|
-
* count={notifications.filter(n => !n.read).length}
|
|
106
|
-
* maxVisible={5}
|
|
107
|
-
* onMarkAllRead={markAllAsRead}
|
|
108
|
-
*
|
|
109
|
-
* />
|
|
110
|
-
* ```
|
|
111
|
-
*
|
|
112
|
-
* @version 0.1.0
|
|
113
|
-
* @since 0.0.1
|
|
114
|
-
* @author AMBROISE PARK Consulting
|
|
115
|
-
*/
|
|
116
|
-
export const Notifications = ({ notifications = [], count = 0, loading = false, onNotificationClick, onDropdownOpen, className, maxVisible = 10, alwaysShow = false, size = 'md', disabled = false, }) => {
|
|
117
|
-
const sizeVariant = SIZE_VARIANTS[size];
|
|
118
|
-
const shownNotificationIds = useRef(new Set());
|
|
119
|
-
// Calculate display count (format large numbers)
|
|
120
|
-
const displayCount = useMemo(() => {
|
|
121
|
-
if (count === 0)
|
|
122
|
-
return null;
|
|
123
|
-
if (count > 99)
|
|
124
|
-
return '99+';
|
|
125
|
-
return count.toString();
|
|
126
|
-
}, [count]);
|
|
127
|
-
// Show component if there are notifications or alwaysShow is true
|
|
128
|
-
const shouldShow = count > 0 || alwaysShow;
|
|
129
|
-
// Show new notifications as infinite toasts
|
|
130
|
-
useEffect(() => {
|
|
131
|
-
notifications.forEach((notification) => {
|
|
132
|
-
if (!shownNotificationIds.current.has(notification.id)) {
|
|
133
|
-
shownNotificationIds.current.add(notification.id);
|
|
134
|
-
const toastType = notification.type === 'error'
|
|
135
|
-
? 'error'
|
|
136
|
-
: notification.type === 'warning'
|
|
137
|
-
? 'warning'
|
|
138
|
-
: notification.type === 'success'
|
|
139
|
-
? 'success'
|
|
140
|
-
: 'info';
|
|
141
|
-
toast({
|
|
142
|
-
title: notification.title,
|
|
143
|
-
description: notification.message,
|
|
144
|
-
toastType: toastType,
|
|
145
|
-
duration: 0, // Infinite/persistent
|
|
146
|
-
onDismiss: () => {
|
|
147
|
-
shownNotificationIds.current.delete(notification.id);
|
|
148
|
-
if (onNotificationClick) {
|
|
149
|
-
onNotificationClick(notification);
|
|
150
|
-
}
|
|
151
|
-
},
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}, [notifications, onNotificationClick]);
|
|
156
|
-
if (!shouldShow) {
|
|
157
|
-
return null;
|
|
158
|
-
}
|
|
159
|
-
return (_jsx("div", { className: cn(className), style: { position: 'relative' }, children: _jsx(Button, { disabled: disabled, style: {
|
|
160
|
-
...sizeVariant.button,
|
|
161
|
-
position: 'relative',
|
|
162
|
-
}, onClick: () => {
|
|
163
|
-
onDropdownOpen?.();
|
|
164
|
-
}, onFocus: (e) => {
|
|
165
|
-
e.currentTarget.style.outline = '2px solid var(--ring)';
|
|
166
|
-
e.currentTarget.style.outlineOffset = '2px';
|
|
167
|
-
}, onBlur: (e) => {
|
|
168
|
-
e.currentTarget.style.outline = 'none';
|
|
169
|
-
}, "aria-label": `${count} notification${count !== 1 ? 's' : ''}`, icon: Bell, children: displayCount && (_jsx(Stack, { align: "center", justify: "center", style: {
|
|
170
|
-
position: 'absolute',
|
|
171
|
-
top: '-0.25rem',
|
|
172
|
-
insetInlineEnd: '-0.25rem',
|
|
173
|
-
backgroundColor: 'var(--destructive)',
|
|
174
|
-
color: 'var(--destructive-foreground)',
|
|
175
|
-
borderRadius: 'var(--radius-full)',
|
|
176
|
-
fontWeight: 600,
|
|
177
|
-
lineHeight: 1,
|
|
178
|
-
minWidth: 0,
|
|
179
|
-
...sizeVariant.badge,
|
|
180
|
-
}, "aria-hidden": "true", children: displayCount })) }) }));
|
|
181
|
-
};
|
|
182
|
-
export default Notifications;
|
|
1
|
+
"use client";import{Bell as v}from"lucide-react";import{useMemo as f,useEffect as p,useRef as b}from"react";import{Button as w,cn as y,toast as S,Stack as x}from"@donotdev/components";import{jsx as o}from"react/jsx-runtime";var N={sm:{button:{width:"var(--icon-md)",height:"var(--icon-md)"},icon:{width:"var(--icon-md)",height:"var(--icon-md)"},badge:{width:"var(--icon-md)",height:"var(--icon-md)",fontSize:"var(--font-size-xs)"}},md:{button:{width:"var(--touch-target)",height:"var(--touch-target)"},icon:{width:"var(--icon-md)",height:"var(--icon-md)"},badge:{width:"var(--icon-md)",height:"var(--icon-md)",fontSize:"var(--font-size-xs)"}},lg:{button:{width:"var(--touch-target)",height:"var(--touch-target)"},icon:{width:"var(--icon-touch)",height:"var(--icon-touch)"},badge:{width:"var(--icon-touch)",height:"var(--icon-touch)",fontSize:"var(--font-size-sm)"}}},z=({notifications:n=[],count:e=0,loading:I=!1,onNotificationClick:i,onDropdownOpen:d,className:c,maxVisible:T=10,alwaysShow:l=!1,size:u="md",disabled:h=!1})=>{let a=N[u],r=b(new Set),s=f(()=>e===0?null:e>99?"99+":e.toString(),[e]),g=e>0||l;return p(()=>{n.forEach(t=>{if(!r.current.has(t.id)){r.current.add(t.id);let m=t.type==="error"?"error":t.type==="warning"?"warning":t.type==="success"?"success":"info";S({title:t.title,description:t.message,toastType:m,duration:0,onDismiss:()=>{r.current.delete(t.id),i&&i(t)}})}})},[n,i]),g?o("div",{className:y(c),style:{position:"relative"},children:o(w,{disabled:h,style:{...a.button,position:"relative"},onClick:()=>{d?.()},onFocus:t=>{t.currentTarget.style.outline="2px solid var(--ring)",t.currentTarget.style.outlineOffset="2px"},onBlur:t=>{t.currentTarget.style.outline="none"},"aria-label":`${e} notification${e!==1?"s":""}`,icon:v,children:s&&o(x,{align:"center",justify:"center",style:{position:"absolute",top:"-0.25rem",insetInlineEnd:"-0.25rem",backgroundColor:"var(--destructive)",color:"var(--destructive-foreground)",borderRadius:"var(--radius-full)",fontWeight:600,lineHeight:1,minWidth:0,...a.badge},"aria-hidden":"true",children:s})})}):null},k=z;export{z as Notifications,k as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppBranding.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/AppBranding.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppBranding.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/AppBranding.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,EAAM,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAOnD,2CAA2C;AAC3C,MAAM,WAAW,gBAAgB;IAC/B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,8CAA8C;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,WAAW,GAAI,qCAIzB,gBAAgB,gCA2ClB,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,54 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
// packages/ui/src/components/layout/components/header/AppBranding.tsx
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview AppBranding - Combined logo + title with display modes
|
|
5
|
-
* @description Unified branding component supporting COMPACT (logo only),
|
|
6
|
-
* FULL (logo + title), and AUTO (container-responsive) display modes.
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.0.1
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { cn, DISPLAY } from '@donotdev/components';
|
|
13
|
-
import { useAppConfig } from '@donotdev/core';
|
|
14
|
-
import { Link } from '../../../../routing/Link';
|
|
15
|
-
import { AssetResolver } from '../../../../utils/assetResolver';
|
|
16
|
-
import { sanitizeSvg } from '../../../../utils/sanitizeSvg';
|
|
17
|
-
/**
|
|
18
|
-
* AppBranding - Unified branding component
|
|
19
|
-
*
|
|
20
|
-
* Combines AppIcon + AppTitle with DISPLAY mode support.
|
|
21
|
-
* Uses CSS container queries for AUTO mode - no JS breakpoint checks.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```tsx
|
|
25
|
-
* // Auto-responsive (default)
|
|
26
|
-
* <AppBranding />
|
|
27
|
-
*
|
|
28
|
-
* // Logo only
|
|
29
|
-
* <AppBranding display="compact" />
|
|
30
|
-
*
|
|
31
|
-
* // Always show logo + title
|
|
32
|
-
* <AppBranding display="full" />
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @version 0.1.0
|
|
36
|
-
* @since 0.0.1
|
|
37
|
-
* @author AMBROISE PARK Consulting
|
|
38
|
-
*/
|
|
39
|
-
export const AppBranding = ({ display = DISPLAY.AUTO, linkToHome = true, className, }) => {
|
|
40
|
-
const appName = useAppConfig('name');
|
|
41
|
-
const appShortName = useAppConfig('shortName');
|
|
42
|
-
const displayTitle = appShortName || appName || 'App';
|
|
43
|
-
const svgContent = AssetResolver.getLogoSvgContent();
|
|
44
|
-
const logoPath = AssetResolver.resolveLogo();
|
|
45
|
-
const showTitle = display === DISPLAY.FULL || display === DISPLAY.AUTO;
|
|
46
|
-
const logo = svgContent ? (_jsx("div", { className: "app-branding-logo", role: "img", "aria-label": displayTitle, dangerouslySetInnerHTML: { __html: sanitizeSvg(svgContent) } })) : AssetResolver.assetExists(logoPath) ? (_jsx("img", { src: logoPath, alt: displayTitle, className: "app-branding-logo" })) : null;
|
|
47
|
-
const title = showTitle && (_jsx("span", { className: "app-branding-title", "data-display": display, children: displayTitle }));
|
|
48
|
-
const content = (_jsxs("div", { className: cn('app-branding', className), "data-display": display, children: [logo, title] }));
|
|
49
|
-
if (linkToHome) {
|
|
50
|
-
return (_jsx(Link, { path: "/", className: "app-branding-link", children: content }));
|
|
51
|
-
}
|
|
52
|
-
return content;
|
|
53
|
-
};
|
|
54
|
-
export default AppBranding;
|
|
1
|
+
"use client";import{cn as A,DISPLAY as n}from"@donotdev/components";import{useAppConfig as i}from"@donotdev/core";import{Link as L}from"../../../../routing/Link.js";import{AssetResolver as e}from"../../../../utils/assetResolver.js";import{sanitizeSvg as N}from"../../../../utils/sanitizeSvg.js";import{jsx as t,jsxs as S}from"react/jsx-runtime";var v=({display:o=n.AUTO,linkToHome:l=!0,className:m})=>{let g=i("name"),a=i("shortName")||g||"App",s=e.getLogoSvgContent(),p=e.resolveLogo(),c=o===n.FULL||o===n.AUTO,d=s?t("div",{className:"app-branding-logo",role:"img","aria-label":a,dangerouslySetInnerHTML:{__html:N(s)}}):e.assetExists(p)?t("img",{src:p,alt:a,className:"app-branding-logo"}):null,f=c&&t("span",{className:"app-branding-title","data-display":o,children:a}),r=S("div",{className:A("app-branding",m),"data-display":o,children:[d,f]});return l?t(L,{path:"/",className:"app-branding-link",children:r}):r},y=v;export{v as AppBranding,y as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppIcon.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/AppIcon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppIcon.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/AppIcon.tsx"],"names":[],"mappings":"AAoBA,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,QAAQ,GAAG,MAAM,CAAC;IACrD,2BAA2B;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAUD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,GAAI,0BAAqC,YAAY,gCA2CxE,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -1,59 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// packages/ui/src/components/layout/components/header/AppIcon.tsx
|
|
3
|
-
/**
|
|
4
|
-
* @fileoverview AppIcon - Logo.svg icon with theme support
|
|
5
|
-
* @description AppIcon works with logo.svg (user must provide).
|
|
6
|
-
* Inlines SVG content from build-time data for CSS variable theming.
|
|
7
|
-
* Works in both CSR and SSR. Falls back to img tag if logo missing.
|
|
8
|
-
*
|
|
9
|
-
* @version 0.1.0
|
|
10
|
-
* @since 0.0.1
|
|
11
|
-
* @author AMBROISE PARK Consulting
|
|
12
|
-
*/
|
|
13
|
-
import { cn } from '@donotdev/components';
|
|
14
|
-
import { useAppConfig } from '@donotdev/core';
|
|
15
|
-
import { AssetResolver } from '../../../../utils/assetResolver';
|
|
16
|
-
import { sanitizeSvg } from '../../../../utils/sanitizeSvg';
|
|
17
|
-
const SIZE_STYLES = {
|
|
18
|
-
sm: { width: 'var(--icon-md)', height: 'var(--icon-md)' },
|
|
19
|
-
md: { width: 'var(--icon-touch)', height: 'var(--icon-touch)' },
|
|
20
|
-
lg: { width: 'var(--icon-touch)', height: 'var(--icon-touch)' },
|
|
21
|
-
xl: { width: 'var(--touch-target)', height: 'var(--touch-target)' },
|
|
22
|
-
header: { height: 'var(--icon-touch)', width: 'auto' },
|
|
23
|
-
};
|
|
24
|
-
/**
|
|
25
|
-
* AppIcon - Application icon component
|
|
26
|
-
*
|
|
27
|
-
* Uses logo.svg (user must provide). Reads SVG content synchronously from build-time data.
|
|
28
|
-
* CSS variables (var(--primary), var(--accent)) work automatically when SVG is inlined.
|
|
29
|
-
* Falls back to img tag if logo.svg is not available.
|
|
30
|
-
*
|
|
31
|
-
* @version 0.1.0
|
|
32
|
-
* @since 0.0.1
|
|
33
|
-
* @author AMBROISE PARK Consulting
|
|
34
|
-
*/
|
|
35
|
-
export const AppIcon = ({ alt, size = 'header', className }) => {
|
|
36
|
-
const appName = useAppConfig('name');
|
|
37
|
-
const appShortName = useAppConfig('shortName');
|
|
38
|
-
const resolvedAlt = alt || appName || appShortName || 'App';
|
|
39
|
-
const svgContent = AssetResolver.getLogoSvgContent();
|
|
40
|
-
const logoPath = AssetResolver.resolveLogo();
|
|
41
|
-
const sizeStyle = typeof size === 'string' && size in SIZE_STYLES
|
|
42
|
-
? SIZE_STYLES[size]
|
|
43
|
-
: typeof size === 'string'
|
|
44
|
-
? {}
|
|
45
|
-
: { width: size, height: size };
|
|
46
|
-
// Inline SVG - CSS variables work automatically
|
|
47
|
-
if (svgContent) {
|
|
48
|
-
return (_jsx("div", { className: cn('app-icon-header', className), style: {
|
|
49
|
-
display: 'inline-flex',
|
|
50
|
-
...sizeStyle,
|
|
51
|
-
}, role: "img", "aria-label": resolvedAlt, dangerouslySetInnerHTML: { __html: sanitizeSvg(svgContent) } }));
|
|
52
|
-
}
|
|
53
|
-
// Fallback to img tag if SVG content not available
|
|
54
|
-
return (_jsx("img", { src: logoPath, alt: resolvedAlt, className: cn(className), style: {
|
|
55
|
-
objectFit: 'contain',
|
|
56
|
-
...sizeStyle,
|
|
57
|
-
} }));
|
|
58
|
-
};
|
|
59
|
-
export default AppIcon;
|
|
1
|
+
"use client";import{cn as i}from"@donotdev/components";import{useAppConfig as a}from"@donotdev/core";import{AssetResolver as s}from"../../../../utils/assetResolver.js";import{sanitizeSvg as d}from"../../../../utils/sanitizeSvg.js";import{jsx as h}from"react/jsx-runtime";var c={sm:{width:"var(--icon-md)",height:"var(--icon-md)"},md:{width:"var(--icon-touch)",height:"var(--icon-touch)"},lg:{width:"var(--icon-touch)",height:"var(--icon-touch)"},xl:{width:"var(--touch-target)",height:"var(--touch-target)"},header:{height:"var(--icon-touch)",width:"auto"}},v=({alt:p,size:t="header",className:o})=>{let g=a("name"),l=a("shortName"),e=p||g||l||"App",r=s.getLogoSvgContent(),m=s.resolveLogo(),n=typeof t=="string"&&t in c?c[t]:typeof t=="string"?{}:{width:t,height:t};return r?h("div",{className:i("app-icon-header",o),style:{display:"inline-flex",...n},role:"img","aria-label":e,dangerouslySetInnerHTML:{__html:d(r)}}):h("img",{src:m,alt:e,className:i(o),style:{objectFit:"contain",...n}})},A=v;export{v as AppIcon,A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppTitle.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/AppTitle.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AppTitle.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/AppTitle.tsx"],"names":[],"mappings":"AAiBA,wCAAwC;AACxC,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,mCAItB,aAAa,gCAiCf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|