@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.
- 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.js +1 -75
- 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 +25 -4
- package/dist/dndev.css +25 -4
- 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 +25 -4
- 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 +3 -3
- 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
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Lucide icon loaded by name
|
|
3
|
+
* @description Renders a Lucide icon from its export name (`"Rocket"`) through `DynamicIcon`
|
|
4
|
+
* (`lucide-react/dynamic`): each icon is its own async chunk, loaded on first render. This
|
|
5
|
+
* module is itself loaded lazily by `iconByName`, so the name table stays out of the
|
|
6
|
+
* initial bundle. Internal to @donotdev/ui (not re-exported).
|
|
7
|
+
*
|
|
8
|
+
* @version 0.1.0
|
|
9
|
+
* @since 0.3.2
|
|
10
|
+
* @author AMBROISE PARK Consulting
|
|
11
|
+
*/
|
|
12
|
+
import type { LucideProps } from 'lucide-react';
|
|
13
|
+
import type { IconName } from 'lucide-react/dynamic';
|
|
14
|
+
import type { ComponentType, ReactElement } from 'react';
|
|
15
|
+
/**
|
|
16
|
+
* Dynamic icon name of a lucide-react export name. Accepts the export's three spellings:
|
|
17
|
+
* `Sun`, `SunIcon`, `LucideSun`.
|
|
18
|
+
*
|
|
19
|
+
* @param name - Lucide export name
|
|
20
|
+
* @returns The dynamic icon name, or undefined when lucide has no such icon
|
|
21
|
+
*/
|
|
22
|
+
export declare function toDynamicIconName(name: string): IconName | undefined;
|
|
23
|
+
/** Props of {@link LazyLucideIcon}. */
|
|
24
|
+
export interface LazyLucideIconProps extends LucideProps {
|
|
25
|
+
/** Lucide export name (`"Rocket"`) */
|
|
26
|
+
name: string;
|
|
27
|
+
/** Icon rendered when lucide has no icon of that name */
|
|
28
|
+
fallback: ComponentType<LucideProps>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Lucide icon by export name, fetched as its own chunk. Renders a same-size placeholder
|
|
32
|
+
* while the chunk loads (and on the server: no layout shift on hydration).
|
|
33
|
+
*
|
|
34
|
+
* @version 0.1.0
|
|
35
|
+
* @since 0.3.2
|
|
36
|
+
* @author AMBROISE PARK Consulting
|
|
37
|
+
*/
|
|
38
|
+
export default function LazyLucideIcon({ name, fallback: Fallback, ...props }: LazyLucideIconProps): ReactElement;
|
|
39
|
+
//# sourceMappingURL=LazyLucideIcon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LazyLucideIcon.d.ts","sourceRoot":"","sources":["../../../src/components/common/LazyLucideIcon.tsx"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAsBzD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAKpE;AAED,uCAAuC;AACvC,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,yDAAyD;IACzD,QAAQ,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC;CACtC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,IAAI,EACJ,QAAQ,EAAE,QAAQ,EAClB,GAAG,KAAK,EACT,EAAE,mBAAmB,GAAG,YAAY,CAepC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{DynamicIcon as p,iconNames as s}from"lucide-react/dynamic";import{useCallback as l}from"react";import{IconPlaceholder as d}from"./IconPlaceholder.js";import{jsx as c}from"react/jsx-runtime";function u(e){return e.split("-").map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join("")}var i=new Map(s.map(e=>[u(e),e]));function f(e){return i.get(e)??i.get(e.replace(/^Lucide/,"").replace(/Icon$/,""))}function y({name:e,fallback:n,...o}){let{className:t,style:a}=o,m=l(()=>c(d,{className:t,style:a}),[t,a]),r=f(e);return r?c(p,{name:r,fallback:m,...o}):c(n,{...o})}export{y as default,f as toDynamicIconName};
|
|
@@ -1,84 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
// packages/ui/src/components/common/ProgressBar.tsx
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview ProgressBar component
|
|
6
|
-
* @description Progress bar component with animation support
|
|
7
|
-
*
|
|
8
|
-
* @version 0.1.0
|
|
9
|
-
* @since 0.0.1
|
|
10
|
-
* @author AMBROISE PARK Consulting
|
|
11
|
-
*/
|
|
12
|
-
import { useEffect, useState } from 'react';
|
|
13
|
-
import { cn } from '@donotdev/components';
|
|
14
|
-
/**
|
|
15
|
-
* ProgressBar - A top progress bar for navigation and page transitions
|
|
16
|
-
*
|
|
17
|
-
* Features:
|
|
18
|
-
* - Smooth progress animations
|
|
19
|
-
* - Fake progress simulation for better UX
|
|
20
|
-
* - Configurable duration and behavior
|
|
21
|
-
* - Accessibility support
|
|
22
|
-
* - Auto-hide on completion
|
|
23
|
-
*
|
|
24
|
-
* @version 0.1.0
|
|
25
|
-
* @since 0.0.1
|
|
26
|
-
* @author AMBROISE PARK Consulting
|
|
27
|
-
*/
|
|
28
|
-
const ProgressBar = ({ isActive = false, progress: controlledProgress, useFakeProgress = true, duration = 2000, className, show = true, }) => {
|
|
29
|
-
const [fakeProgress, setFakeProgress] = useState(0);
|
|
30
|
-
const [isVisible, setIsVisible] = useState(false);
|
|
31
|
-
// Handle fake progress animation
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (!isActive || !useFakeProgress || controlledProgress !== undefined) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
setIsVisible(true);
|
|
37
|
-
setFakeProgress(0);
|
|
38
|
-
const startTime = Date.now();
|
|
39
|
-
const interval = setInterval(() => {
|
|
40
|
-
const elapsed = Date.now() - startTime;
|
|
41
|
-
const newProgress = Math.min((elapsed / duration) * 90, 90); // Cap at 90% for fake progress
|
|
42
|
-
setFakeProgress(newProgress);
|
|
43
|
-
}, 16); // ~60fps
|
|
44
|
-
return () => {
|
|
45
|
-
clearInterval(interval);
|
|
46
|
-
};
|
|
47
|
-
}, [isActive, useFakeProgress, controlledProgress, duration]);
|
|
48
|
-
// Handle controlled progress
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if (controlledProgress !== undefined) {
|
|
51
|
-
setIsVisible(controlledProgress > 0 && controlledProgress < 100);
|
|
52
|
-
}
|
|
53
|
-
}, [controlledProgress]);
|
|
54
|
-
// Auto-hide when complete
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
if (!isActive) {
|
|
57
|
-
const timer = setTimeout(() => {
|
|
58
|
-
setIsVisible(false);
|
|
59
|
-
setFakeProgress(0);
|
|
60
|
-
}, 300); // Small delay to show completion
|
|
61
|
-
return () => clearTimeout(timer);
|
|
62
|
-
}
|
|
63
|
-
}, [isActive]);
|
|
64
|
-
const currentProgress = controlledProgress ?? fakeProgress;
|
|
65
|
-
if (!show || !isVisible) {
|
|
66
|
-
return null;
|
|
67
|
-
}
|
|
68
|
-
return (_jsx("div", { className: cn(className), style: {
|
|
69
|
-
position: 'fixed',
|
|
70
|
-
insetInlineStart: 0,
|
|
71
|
-
insetInlineEnd: 0,
|
|
72
|
-
zIndex: 9999,
|
|
73
|
-
height: '4px',
|
|
74
|
-
backgroundColor: 'transparent',
|
|
75
|
-
top: 'var(--header-height, 0px)',
|
|
76
|
-
}, role: "progressbar", "aria-valuenow": Math.round(currentProgress), "aria-valuemin": 0, "aria-valuemax": 100, "aria-label": "Page loading progress", children: _jsx("div", { style: {
|
|
77
|
-
height: '100%',
|
|
78
|
-
width: `${currentProgress}%`,
|
|
79
|
-
background: 'linear-gradient(to right, var(--primary), color-mix(in srgb, var(--primary) 80%, transparent), color-mix(in srgb, var(--primary) 60%, transparent))',
|
|
80
|
-
transition: isActive ? 'width 0.3s ease-out' : 'width 0.2s ease-in',
|
|
81
|
-
boxShadow: 'var(--shadow-sm)',
|
|
82
|
-
} }) }));
|
|
83
|
-
};
|
|
84
|
-
export default ProgressBar;
|
|
1
|
+
"use client";import{useEffect as s,useState as u}from"react";import{cn as v}from"@donotdev/components";import{jsx as m}from"react/jsx-runtime";var w=({isActive:r=!1,progress:e,useFakeProgress:i=!0,duration:o=2e3,className:l,show:f=!0})=>{let[d,a]=u(0),[g,t]=u(!1);s(()=>{if(!r||!i||e!==void 0)return;t(!0),a(0);let n=Date.now(),h=setInterval(()=>{let b=Date.now()-n,c=Math.min(b/o*90,90);a(c)},16);return()=>{clearInterval(h)}},[r,i,e,o]),s(()=>{e!==void 0&&t(e>0&&e<100)},[e]),s(()=>{if(!r){let n=setTimeout(()=>{t(!1),a(0)},300);return()=>clearTimeout(n)}},[r]);let p=e??d;return!f||!g?null:m("div",{className:v(l),style:{position:"fixed",insetInlineStart:0,insetInlineEnd:0,zIndex:9999,height:"4px",backgroundColor:"transparent",top:"var(--header-height, 0px)"},role:"progressbar","aria-valuenow":Math.round(p),"aria-valuemin":0,"aria-valuemax":100,"aria-label":"Page loading progress",children:m("div",{style:{height:"100%",width:`${p}%`,background:"linear-gradient(to right, var(--primary), color-mix(in srgb, var(--primary) 80%, transparent), color-mix(in srgb, var(--primary) 60%, transparent))",transition:r?"width 0.3s ease-out":"width 0.2s ease-in",boxShadow:"var(--shadow-sm)"}})})},I=w;export{I as default};
|
|
@@ -1,243 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// packages/ui/src/components/common/RedirectOverlay.tsx
|
|
4
|
-
/**
|
|
5
|
-
* @fileoverview RedirectOverlay component
|
|
6
|
-
* @description Industry-standard fullscreen overlay for redirect operations (payments, OAuth, etc.).
|
|
7
|
-
* Features phase-based progress, 10s cancel timeout, i18n support, and browser event handling.
|
|
8
|
-
*
|
|
9
|
-
* @version 0.1.0
|
|
10
|
-
* @since 0.0.1
|
|
11
|
-
* @author AMBROISE PARK Consulting
|
|
12
|
-
*/
|
|
13
|
-
import { Lock, Shield } from 'lucide-react';
|
|
14
|
-
import { useEffect, useRef, useCallback } from 'react';
|
|
15
|
-
import { Portal, Spinner, Stack, Text, Button } from '@donotdev/components';
|
|
16
|
-
import { useTranslation, useOverlay, } from '@donotdev/core';
|
|
17
|
-
/** Phase progression timings (ms from start) */
|
|
18
|
-
const PHASE_TIMINGS = {
|
|
19
|
-
connecting: 0,
|
|
20
|
-
preparing: 2000,
|
|
21
|
-
redirecting: 5000,
|
|
22
|
-
};
|
|
23
|
-
/** Default timeout before showing cancel button (10 seconds) */
|
|
24
|
-
const DEFAULT_CANCEL_TIMEOUT = 10000;
|
|
25
|
-
/**
|
|
26
|
-
* Get icon component based on operation type
|
|
27
|
-
*/
|
|
28
|
-
function getOperationIcon(operation, configIcon) {
|
|
29
|
-
if (configIcon === 'none')
|
|
30
|
-
return null;
|
|
31
|
-
if (configIcon === 'shield')
|
|
32
|
-
return Shield;
|
|
33
|
-
if (configIcon === 'lock')
|
|
34
|
-
return Lock;
|
|
35
|
-
// Infer from operation
|
|
36
|
-
if (!operation)
|
|
37
|
-
return Lock;
|
|
38
|
-
if (operation.startsWith('stripe-') ||
|
|
39
|
-
operation.includes('payment') ||
|
|
40
|
-
operation.includes('checkout')) {
|
|
41
|
-
return Lock;
|
|
42
|
-
}
|
|
43
|
-
if (operation.startsWith('oauth-') || operation.startsWith('auth-')) {
|
|
44
|
-
return Shield;
|
|
45
|
-
}
|
|
46
|
-
return Lock;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Get i18n key for operation
|
|
50
|
-
*/
|
|
51
|
-
function getOperationKey(operation) {
|
|
52
|
-
if (!operation)
|
|
53
|
-
return 'default';
|
|
54
|
-
// Check if operation has a specific translation, otherwise use default
|
|
55
|
-
return operation;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* RedirectOverlay - Industry-standard redirect overlay with phase progression
|
|
59
|
-
*
|
|
60
|
-
* Features:
|
|
61
|
-
* - Phase-based progress: connecting → preparing → redirecting → timeout
|
|
62
|
-
* - Cancel button appears after 10s (configurable)
|
|
63
|
-
* - i18n support with operation-specific messaging
|
|
64
|
-
* - Browser event handling (popstate, visibilitychange)
|
|
65
|
-
* - Accessible (ARIA labels, role="status")
|
|
66
|
-
* - RTL-safe styling
|
|
67
|
-
*
|
|
68
|
-
* @example
|
|
69
|
-
* ```tsx
|
|
70
|
-
* // Include once in app root (layout.tsx or App.tsx)
|
|
71
|
-
* import { RedirectOverlay } from '@donotdev/ui';
|
|
72
|
-
*
|
|
73
|
-
* function RootLayout({ children }) {
|
|
74
|
-
* return (
|
|
75
|
-
* <>
|
|
76
|
-
* {children}
|
|
77
|
-
* <RedirectOverlay />
|
|
78
|
-
* </>
|
|
79
|
-
* );
|
|
80
|
-
* }
|
|
81
|
-
*
|
|
82
|
-
* // Hooks trigger it automatically
|
|
83
|
-
* const checkout = useStripeBilling('checkout', authState);
|
|
84
|
-
* await checkout({ priceId: 'price_123' }); // Shows overlay automatically
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
|
-
* @version 0.1.0
|
|
88
|
-
* @since 0.0.1
|
|
89
|
-
* @author AMBROISE PARK Consulting
|
|
90
|
-
*/
|
|
91
|
-
export function RedirectOverlay() {
|
|
92
|
-
const { t } = useTranslation('dndev');
|
|
93
|
-
// Subscribe to overlay store
|
|
94
|
-
const isOpen = useOverlay('isRedirectOverlayOpen');
|
|
95
|
-
const operation = useOverlay('redirectOperation');
|
|
96
|
-
const phase = useOverlay('redirectPhase');
|
|
97
|
-
const showCancelButton = useOverlay('showCancelButton');
|
|
98
|
-
const config = useOverlay('redirectConfig');
|
|
99
|
-
const startTime = useOverlay('redirectStartTime');
|
|
100
|
-
// Actions
|
|
101
|
-
const setRedirectPhase = useOverlay('setRedirectPhase');
|
|
102
|
-
const setShowCancelButton = useOverlay('setShowCancelButton');
|
|
103
|
-
const hideRedirectOverlay = useOverlay('hideRedirectOverlay');
|
|
104
|
-
// Refs for cleanup
|
|
105
|
-
const phaseTimersRef = useRef([]);
|
|
106
|
-
const cancelTimerRef = useRef(null);
|
|
107
|
-
// Cancel handler
|
|
108
|
-
const handleCancel = useCallback(() => {
|
|
109
|
-
hideRedirectOverlay();
|
|
110
|
-
}, [hideRedirectOverlay]);
|
|
111
|
-
// Setup phase progression and cancel timer when overlay opens
|
|
112
|
-
useEffect(() => {
|
|
113
|
-
if (!isOpen || !startTime)
|
|
114
|
-
return;
|
|
115
|
-
const cancelTimeout = config?.cancelTimeout ?? DEFAULT_CANCEL_TIMEOUT;
|
|
116
|
-
const elapsed = Date.now() - startTime;
|
|
117
|
-
// Clear any existing timers
|
|
118
|
-
phaseTimersRef.current.forEach(clearTimeout);
|
|
119
|
-
phaseTimersRef.current = [];
|
|
120
|
-
if (cancelTimerRef.current) {
|
|
121
|
-
clearTimeout(cancelTimerRef.current);
|
|
122
|
-
cancelTimerRef.current = null;
|
|
123
|
-
}
|
|
124
|
-
// Schedule phase transitions
|
|
125
|
-
const schedulePhase = (targetPhase, delay) => {
|
|
126
|
-
const adjustedDelay = Math.max(0, delay - elapsed);
|
|
127
|
-
if (adjustedDelay > 0) {
|
|
128
|
-
const timer = setTimeout(() => {
|
|
129
|
-
setRedirectPhase(targetPhase);
|
|
130
|
-
}, adjustedDelay);
|
|
131
|
-
phaseTimersRef.current.push(timer);
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
// Already past this phase
|
|
135
|
-
setRedirectPhase(targetPhase);
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
schedulePhase('preparing', PHASE_TIMINGS.preparing);
|
|
139
|
-
schedulePhase('redirecting', PHASE_TIMINGS.redirecting);
|
|
140
|
-
// Schedule cancel button
|
|
141
|
-
const cancelDelay = Math.max(0, cancelTimeout - elapsed);
|
|
142
|
-
cancelTimerRef.current = setTimeout(() => {
|
|
143
|
-
setShowCancelButton(true);
|
|
144
|
-
setRedirectPhase('timeout');
|
|
145
|
-
}, cancelDelay);
|
|
146
|
-
// Cleanup
|
|
147
|
-
return () => {
|
|
148
|
-
phaseTimersRef.current.forEach(clearTimeout);
|
|
149
|
-
phaseTimersRef.current = [];
|
|
150
|
-
if (cancelTimerRef.current) {
|
|
151
|
-
clearTimeout(cancelTimerRef.current);
|
|
152
|
-
cancelTimerRef.current = null;
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
}, [
|
|
156
|
-
isOpen,
|
|
157
|
-
startTime,
|
|
158
|
-
config?.cancelTimeout,
|
|
159
|
-
setRedirectPhase,
|
|
160
|
-
setShowCancelButton,
|
|
161
|
-
]);
|
|
162
|
-
// Handle browser back button (popstate)
|
|
163
|
-
useEffect(() => {
|
|
164
|
-
if (!isOpen)
|
|
165
|
-
return;
|
|
166
|
-
const handlePopState = () => {
|
|
167
|
-
// User pressed back - hide overlay
|
|
168
|
-
hideRedirectOverlay();
|
|
169
|
-
};
|
|
170
|
-
window.addEventListener('popstate', handlePopState);
|
|
171
|
-
return () => window.removeEventListener('popstate', handlePopState);
|
|
172
|
-
}, [isOpen, hideRedirectOverlay]);
|
|
173
|
-
// Handle tab visibility change
|
|
174
|
-
useEffect(() => {
|
|
175
|
-
if (!isOpen)
|
|
176
|
-
return;
|
|
177
|
-
const handleVisibilityChange = () => {
|
|
178
|
-
// If user switches away and comes back, the redirect probably failed
|
|
179
|
-
// We could add logic here to show a "retry" state, but for now we keep overlay visible
|
|
180
|
-
// This prevents the overlay from disappearing when user tabs away briefly
|
|
181
|
-
};
|
|
182
|
-
document.addEventListener('visibilitychange', handleVisibilityChange);
|
|
183
|
-
return () => document.removeEventListener('visibilitychange', handleVisibilityChange);
|
|
184
|
-
}, [isOpen]);
|
|
185
|
-
// Don't render if not open
|
|
186
|
-
if (!isOpen)
|
|
187
|
-
return null;
|
|
188
|
-
// Get operation-specific translations
|
|
189
|
-
const operationKey = getOperationKey(operation);
|
|
190
|
-
// Try operation-specific translation, fallback to default
|
|
191
|
-
const title = config?.title ??
|
|
192
|
-
t(`redirectOverlay.${operationKey}.title`, {
|
|
193
|
-
defaultValue: t('redirectOverlay.default.title'),
|
|
194
|
-
});
|
|
195
|
-
const message = config?.message ??
|
|
196
|
-
t(`redirectOverlay.${operationKey}.message`, {
|
|
197
|
-
defaultValue: t('redirectOverlay.default.message'),
|
|
198
|
-
});
|
|
199
|
-
const subtitle = config?.subtitle ??
|
|
200
|
-
t(`redirectOverlay.${operationKey}.subtitle`, {
|
|
201
|
-
defaultValue: t('redirectOverlay.default.subtitle'),
|
|
202
|
-
});
|
|
203
|
-
const ariaLabel = t(`redirectOverlay.${operationKey}.ariaLabel`, {
|
|
204
|
-
defaultValue: t('redirectOverlay.default.ariaLabel'),
|
|
205
|
-
});
|
|
206
|
-
// Get phase message
|
|
207
|
-
const phaseMessage = t(`redirectOverlay.phases.${phase}`);
|
|
208
|
-
// Get icon
|
|
209
|
-
const IconComponent = getOperationIcon(operation, config?.icon);
|
|
210
|
-
return (_jsx(Portal, { children: _jsx("div", { className: "dndev-spinner-overlay", role: "status", "aria-busy": "true", "aria-label": ariaLabel, style: {
|
|
211
|
-
// Ensure highest z-index for redirect overlay
|
|
212
|
-
zIndex: 'var(--z-overlay, 9999)',
|
|
213
|
-
}, children: _jsxs("div", { style: {
|
|
214
|
-
display: 'flex',
|
|
215
|
-
flexDirection: 'column',
|
|
216
|
-
alignItems: 'center',
|
|
217
|
-
justifyContent: 'center',
|
|
218
|
-
gap: 'var(--gap-md)',
|
|
219
|
-
textAlign: 'center',
|
|
220
|
-
maxWidth: '400px',
|
|
221
|
-
padding: 'var(--gap-lg)',
|
|
222
|
-
}, children: [_jsxs(Stack, { direction: "row", align: "center", children: [IconComponent && (_jsx(IconComponent, { style: {
|
|
223
|
-
width: '1.5rem',
|
|
224
|
-
height: '1.5rem',
|
|
225
|
-
color: 'var(--primary)',
|
|
226
|
-
}, "aria-hidden": "true" })), _jsx(Spinner, { variant: "primary" })] }), _jsx(Text, { as: "h3", style: {
|
|
227
|
-
color: 'var(--foreground)',
|
|
228
|
-
margin: 0,
|
|
229
|
-
}, children: title }), _jsx(Text, { variant: "muted", style: {
|
|
230
|
-
color: 'var(--foreground)',
|
|
231
|
-
minHeight: '1.5em',
|
|
232
|
-
}, children: phaseMessage }), _jsx(Text, { variant: "muted", level: "small", style: {
|
|
233
|
-
opacity: 0.8,
|
|
234
|
-
}, children: message }), _jsx(Text, { variant: "muted", level: "small", style: {
|
|
235
|
-
opacity: 0.6,
|
|
236
|
-
}, children: subtitle }), _jsx(Text, { variant: "muted", level: "small", style: {
|
|
237
|
-
opacity: 0.5,
|
|
238
|
-
marginTop: 'var(--gap-sm)',
|
|
239
|
-
}, children: t('redirectOverlay.doNotRefresh') }), showCancelButton && (_jsx(Button, { variant: "ghost", onClick: handleCancel, style: {
|
|
240
|
-
marginTop: 'var(--gap-md)',
|
|
241
|
-
}, children: t('redirectOverlay.cancel') }))] }) }) }));
|
|
242
|
-
}
|
|
243
|
-
export default RedirectOverlay;
|
|
1
|
+
"use client";import{Lock as m,Shield as b}from"lucide-react";import{useEffect as y,useRef as R,useCallback as A}from"react";import{Portal as N,Spinner as W,Stack as _,Text as c,Button as z}from"@donotdev/components";import{useTranslation as H,useOverlay as n}from"@donotdev/core";import{jsx as r,jsxs as w}from"react/jsx-runtime";var C={connecting:0,preparing:2e3,redirecting:5e3},K=1e4;function U(e,t){return t==="none"?null:t==="shield"?b:t==="lock"?m:e?e.startsWith("stripe-")||e.includes("payment")||e.includes("checkout")?m:e.startsWith("oauth-")||e.startsWith("auth-")?b:m:m}function j(e){return e||"default"}function F(){let{t:e}=H("dndev"),t=n("isRedirectOverlayOpen"),p=n("redirectOperation"),E=n("redirectPhase"),L=n("showCancelButton"),l=n("redirectConfig"),v=n("redirectStartTime"),o=n("setRedirectPhase"),f=n("setShowCancelButton"),u=n("hideRedirectOverlay"),s=R([]),a=R(null),S=A(()=>{u()},[u]);if(y(()=>{if(!t||!v)return;let i=l?.cancelTimeout??K,g=Date.now()-v;s.current.forEach(clearTimeout),s.current=[],a.current&&(clearTimeout(a.current),a.current=null);let T=(O,V)=>{let x=Math.max(0,V-g);if(x>0){let $=setTimeout(()=>{o(O)},x);s.current.push($)}else o(O)};T("preparing",C.preparing),T("redirecting",C.redirecting);let M=Math.max(0,i-g);return a.current=setTimeout(()=>{f(!0),o("timeout")},M),()=>{s.current.forEach(clearTimeout),s.current=[],a.current&&(clearTimeout(a.current),a.current=null)}},[t,v,l?.cancelTimeout,o,f]),y(()=>{if(!t)return;let i=()=>{u()};return window.addEventListener("popstate",i),()=>window.removeEventListener("popstate",i)},[t,u]),y(()=>{if(!t)return;let i=()=>{};return document.addEventListener("visibilitychange",i),()=>document.removeEventListener("visibilitychange",i)},[t]),!t)return null;let d=j(p),P=l?.title??e(`redirectOverlay.${d}.title`,{defaultValue:e("redirectOverlay.default.title")}),k=l?.message??e(`redirectOverlay.${d}.message`,{defaultValue:e("redirectOverlay.default.message")}),B=l?.subtitle??e(`redirectOverlay.${d}.subtitle`,{defaultValue:e("redirectOverlay.default.subtitle")}),D=e(`redirectOverlay.${d}.ariaLabel`,{defaultValue:e("redirectOverlay.default.ariaLabel")}),I=e(`redirectOverlay.phases.${E}`),h=U(p,l?.icon);return r(N,{children:r("div",{className:"dndev-spinner-overlay",role:"status","aria-busy":"true","aria-label":D,style:{zIndex:"var(--z-overlay, 9999)"},children:w("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"var(--gap-md)",textAlign:"center",maxWidth:"400px",padding:"var(--gap-lg)"},children:[w(_,{direction:"row",align:"center",children:[h&&r(h,{style:{width:"1.5rem",height:"1.5rem",color:"var(--primary)"},"aria-hidden":"true"}),r(W,{variant:"primary"})]}),r(c,{as:"h3",style:{color:"var(--foreground)",margin:0},children:P}),r(c,{variant:"muted",style:{color:"var(--foreground)",minHeight:"1.5em"},children:I}),r(c,{variant:"muted",level:"small",style:{opacity:.8},children:k}),r(c,{variant:"muted",level:"small",style:{opacity:.6},children:B}),r(c,{variant:"muted",level:"small",style:{opacity:.5,marginTop:"var(--gap-sm)"},children:e("redirectOverlay.doNotRefresh")}),L&&r(z,{variant:"ghost",onClick:S,style:{marginTop:"var(--gap-md)"},children:e("redirectOverlay.cancel")})]})})})}var X=F;export{F as RedirectOverlay,X as default};
|
|
@@ -1,144 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { cn, Stack } from '@donotdev/components';
|
|
4
|
-
/**
|
|
5
|
-
* Skeleton - A loading placeholder component
|
|
6
|
-
*
|
|
7
|
-
* Features:
|
|
8
|
-
* - Multiple variants for different content types
|
|
9
|
-
* - Configurable dimensions via escape hatch props
|
|
10
|
-
* - Accessibility support
|
|
11
|
-
* - Smooth animations
|
|
12
|
-
*
|
|
13
|
-
* STYLING APPROACH:
|
|
14
|
-
* - Prefer: <Skeleton className="h-4 w-[250px]" /> (utility classes)
|
|
15
|
-
* - Escape hatch: <Skeleton width={dynamicWidth} height={40} /> (when programmatic)
|
|
16
|
-
*
|
|
17
|
-
* @version 0.1.0
|
|
18
|
-
* @since 0.0.1
|
|
19
|
-
* @author AMBROISE PARK Consulting
|
|
20
|
-
*/
|
|
21
|
-
const Skeleton = ({ variant = 'text', width, height, lines = 1, show = true, className, animation = 'pulse', style, // Destructure style prop
|
|
22
|
-
}) => {
|
|
23
|
-
if (!show)
|
|
24
|
-
return null;
|
|
25
|
-
const baseStyles = {
|
|
26
|
-
backgroundColor: 'var(--muted)',
|
|
27
|
-
opacity: 'var(--opacity-muted)',
|
|
28
|
-
borderRadius: 'var(--radius)',
|
|
29
|
-
animation: animation === 'pulse' || animation === 'wave'
|
|
30
|
-
? 'pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite'
|
|
31
|
-
: 'none',
|
|
32
|
-
...(animation === 'wave' && {
|
|
33
|
-
background: 'linear-gradient(to right, color-mix(in srgb, var(--muted) 50%, transparent), color-mix(in srgb, var(--muted) 30%, transparent), color-mix(in srgb, var(--muted) 50%, transparent))',
|
|
34
|
-
}),
|
|
35
|
-
};
|
|
36
|
-
const getSkeletonStyles = () => {
|
|
37
|
-
const styles = {};
|
|
38
|
-
if (width) {
|
|
39
|
-
styles.width = typeof width === 'number' ? `${width}px` : width;
|
|
40
|
-
}
|
|
41
|
-
if (height) {
|
|
42
|
-
styles.height = typeof height === 'number' ? `${height}px` : height;
|
|
43
|
-
}
|
|
44
|
-
return styles;
|
|
45
|
-
};
|
|
46
|
-
// Text skeleton with multiple lines
|
|
47
|
-
if (variant === 'text') {
|
|
48
|
-
return (_jsx(Stack, { gap: "tight", children: Array.from({ length: lines }).map((_, index) => (_jsx("div", { className: cn('dndev-skeleton', className), style: {
|
|
49
|
-
...baseStyles,
|
|
50
|
-
height: 'var(--gap-md)',
|
|
51
|
-
width: index === lines - 1 ? '75%' : '100%',
|
|
52
|
-
...getSkeletonStyles(),
|
|
53
|
-
...style,
|
|
54
|
-
} }, index))) }));
|
|
55
|
-
}
|
|
56
|
-
// Circular skeleton
|
|
57
|
-
if (variant === 'circular') {
|
|
58
|
-
return (_jsx("div", { className: cn('dndev-skeleton', className), style: {
|
|
59
|
-
...baseStyles,
|
|
60
|
-
borderRadius: 'var(--radius-full)',
|
|
61
|
-
width: width || height || '40px',
|
|
62
|
-
height: height || width || '40px',
|
|
63
|
-
...getSkeletonStyles(),
|
|
64
|
-
...style,
|
|
65
|
-
} }));
|
|
66
|
-
}
|
|
67
|
-
// Rectangular skeleton
|
|
68
|
-
if (variant === 'rectangular') {
|
|
69
|
-
return (_jsx("div", { className: cn('dndev-skeleton', className), style: {
|
|
70
|
-
...baseStyles,
|
|
71
|
-
width: width || '100%',
|
|
72
|
-
height: height || '200px',
|
|
73
|
-
...getSkeletonStyles(),
|
|
74
|
-
...style,
|
|
75
|
-
} }));
|
|
76
|
-
}
|
|
77
|
-
// Rounded skeleton (default)
|
|
78
|
-
return (_jsx("div", { className: cn('dndev-skeleton', className), style: {
|
|
79
|
-
...baseStyles,
|
|
80
|
-
borderRadius: 'var(--radius-lg)',
|
|
81
|
-
width: width || '100%',
|
|
82
|
-
height: height || '20px',
|
|
83
|
-
...getSkeletonStyles(),
|
|
84
|
-
...style,
|
|
85
|
-
} }));
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Text skeleton component
|
|
89
|
-
*
|
|
90
|
-
* @version 0.1.0
|
|
91
|
-
* @since 0.0.1
|
|
92
|
-
* @author AMBROISE PARK Consulting
|
|
93
|
-
*/
|
|
94
|
-
export const SkeletonText = (props) => _jsx(Skeleton, { variant: "text", ...props });
|
|
95
|
-
/**
|
|
96
|
-
* Avatar skeleton component
|
|
97
|
-
*
|
|
98
|
-
* @version 0.1.0
|
|
99
|
-
* @since 0.0.1
|
|
100
|
-
* @author AMBROISE PARK Consulting
|
|
101
|
-
*/
|
|
102
|
-
export const SkeletonAvatar = ({ size = 40, ...props }) => (_jsx(Skeleton, { variant: "circular", width: size, height: size, ...props }));
|
|
103
|
-
/**
|
|
104
|
-
* Image skeleton component
|
|
105
|
-
*
|
|
106
|
-
* @version 0.1.0
|
|
107
|
-
* @since 0.0.1
|
|
108
|
-
* @author AMBROISE PARK Consulting
|
|
109
|
-
*/
|
|
110
|
-
export const SkeletonImage = ({ aspectRatio = '16/9', width = '100%', ...props }) => (_jsx("div", { style: { aspectRatio }, children: _jsx(Skeleton, { variant: "rectangular", width: width, height: "100%", ...props }) }));
|
|
111
|
-
/**
|
|
112
|
-
* Button skeleton component
|
|
113
|
-
*
|
|
114
|
-
* @version 0.1.0
|
|
115
|
-
* @since 0.0.1
|
|
116
|
-
* @author AMBROISE PARK Consulting
|
|
117
|
-
*/
|
|
118
|
-
export const SkeletonButton = ({ size = 'md', ...props }) => {
|
|
119
|
-
const heightMap = { sm: 32, md: 40, lg: 48 };
|
|
120
|
-
return (_jsx(Skeleton, { variant: "rounded", height: heightMap[size], width: "auto", style: { minWidth: '80px' }, ...props }));
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Card skeleton component
|
|
124
|
-
*
|
|
125
|
-
* @version 0.1.0
|
|
126
|
-
* @since 0.0.1
|
|
127
|
-
* @author AMBROISE PARK Consulting
|
|
128
|
-
*/
|
|
129
|
-
export const SkeletonCard = ({ showImage = true, showTitle = true, showDescription = true, className, ...props }) => (_jsxs("div", { className: cn('dndev-surface', className), style: {
|
|
130
|
-
display: 'grid',
|
|
131
|
-
gap: 'var(--gap-md)',
|
|
132
|
-
border: '1px solid var(--border)',
|
|
133
|
-
borderRadius: 'var(--radius-lg)',
|
|
134
|
-
padding: 'var(--gap-lg)',
|
|
135
|
-
}, children: [showImage && _jsx(SkeletonImage, { ...props }), _jsxs(Stack, { gap: "tight", children: [showTitle && _jsx(SkeletonText, { lines: 1, ...props }), showDescription && _jsx(SkeletonText, { lines: 2, ...props })] })] }));
|
|
136
|
-
/**
|
|
137
|
-
* Table skeleton component
|
|
138
|
-
*
|
|
139
|
-
* @version 0.1.0
|
|
140
|
-
* @since 0.0.1
|
|
141
|
-
* @author AMBROISE PARK Consulting
|
|
142
|
-
*/
|
|
143
|
-
export const SkeletonTable = ({ rows = 5, columns = 4, ...props }) => (_jsxs(Stack, { gap: "tight", children: [_jsx(Stack, { direction: "row", style: { gap: 'var(--gap-sm)' }, children: Array.from({ length: columns }).map((_, index) => (_jsx(Skeleton, { variant: "rounded", height: 20, style: { flex: 1 }, ...props }, `header-${index}`))) }), Array.from({ length: rows }).map((_, rowIndex) => (_jsx(Stack, { direction: "row", style: { gap: 'var(--gap-sm)' }, children: Array.from({ length: columns }).map((_, colIndex) => (_jsx(Skeleton, { variant: "rounded", height: 16, style: { flex: 1 }, ...props }, `cell-${rowIndex}-${colIndex}`))) }, `row-${rowIndex}`)))] }));
|
|
144
|
-
export default Skeleton;
|
|
1
|
+
"use client";import{cn as p,Stack as d}from"@donotdev/components";import{jsx as t,jsxs as v}from"react/jsx-runtime";var o=({variant:r="text",width:e,height:n,lines:i=1,show:a=!0,className:s,animation:l="pulse",style:m})=>{if(!a)return null;let u={backgroundColor:"var(--muted)",opacity:"var(--opacity-muted)",borderRadius:"var(--radius)",animation:l==="pulse"||l==="wave"?"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite":"none",...l==="wave"&&{background:"linear-gradient(to right, color-mix(in srgb, var(--muted) 50%, transparent), color-mix(in srgb, var(--muted) 30%, transparent), color-mix(in srgb, var(--muted) 50%, transparent))"}},c=()=>{let g={};return e&&(g.width=typeof e=="number"?`${e}px`:e),n&&(g.height=typeof n=="number"?`${n}px`:n),g};return r==="text"?t(d,{gap:"tight",children:Array.from({length:i}).map((g,y)=>t("div",{className:p("dndev-skeleton",s),style:{...u,height:"var(--gap-md)",width:y===i-1?"75%":"100%",...c(),...m}},y))}):r==="circular"?t("div",{className:p("dndev-skeleton",s),style:{...u,borderRadius:"var(--radius-full)",width:e||n||"40px",height:n||e||"40px",...c(),...m}}):r==="rectangular"?t("div",{className:p("dndev-skeleton",s),style:{...u,width:e||"100%",height:n||"200px",...c(),...m}}):t("div",{className:p("dndev-skeleton",s),style:{...u,borderRadius:"var(--radius-lg)",width:e||"100%",height:n||"20px",...c(),...m}})},k=r=>t(o,{variant:"text",...r}),h=({size:r=40,...e})=>t(o,{variant:"circular",width:r,height:r,...e}),S=({aspectRatio:r="16/9",width:e="100%",...n})=>t("div",{style:{aspectRatio:r},children:t(o,{variant:"rectangular",width:e,height:"100%",...n})}),x=({size:r="md",...e})=>t(o,{variant:"rounded",height:{sm:32,md:40,lg:48}[r],width:"auto",style:{minWidth:"80px"},...e}),f=({showImage:r=!0,showTitle:e=!0,showDescription:n=!0,className:i,...a})=>v("div",{className:p("dndev-surface",i),style:{display:"grid",gap:"var(--gap-md)",border:"1px solid var(--border)",borderRadius:"var(--radius-lg)",padding:"var(--gap-lg)"},children:[r&&t(S,{...a}),v(d,{gap:"tight",children:[e&&t(k,{lines:1,...a}),n&&t(k,{lines:2,...a})]})]}),C=({rows:r=5,columns:e=4,...n})=>v(d,{gap:"tight",children:[t(d,{direction:"row",style:{gap:"var(--gap-sm)"},children:Array.from({length:e}).map((i,a)=>t(o,{variant:"rounded",height:20,style:{flex:1},...n},`header-${a}`))}),Array.from({length:r}).map((i,a)=>t(d,{direction:"row",style:{gap:"var(--gap-sm)"},children:Array.from({length:e}).map((s,l)=>t(o,{variant:"rounded",height:16,style:{flex:1},...n},`cell-${a}-${l}`))},`row-${a}`))]}),w=o;export{h as SkeletonAvatar,x as SkeletonButton,f as SkeletonCard,S as SkeletonImage,C as SkeletonTable,k as SkeletonText,w as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TechBento.d.ts","sourceRoot":"","sources":["../../../src/components/common/TechBento.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TechBento.d.ts","sourceRoot":"","sources":["../../../src/components/common/TechBento.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAEV,QAAQ,EACR,WAAW,EACX,cAAc,EACd,IAAI,EACL,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAa,KAAK,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAG/D,yCAAyC;AACzC,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,OAAO,CAAC;QACd,IAAI,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;QAC3C,OAAO,CAAC,EAAE,WAAW,CAAC;KACvB,CAAC,CAAC;IACH;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC;IAC/B,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,uEAAuE;IACvE,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,0CAA0C;IAC1C,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACnC,yCAAyC;IACzC,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,+CAA+C;IAC/C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,0DAA0D;IAC1D,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,0DAA0D;IAC1D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA0CF,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,IAAQ,EACR,GAAc,EACd,SAAiB,EACjB,IAAiB,EACjB,KAAK,EACL,WAAW,EACX,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,SAAS,GACV,EAAE,cAAc,+BA0DhB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,53 +1 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// packages/ui/src/components/common/TechBento.tsx
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { Bento, Card, Section, Stack, Text, TONE, cn, } from '@donotdev/components';
|
|
5
|
-
import { techLogos } from '../../data/techLogos';
|
|
6
|
-
import { sanitizeSvg } from '../../utils/sanitizeSvg';
|
|
7
|
-
function TechCard({ techKey, variant, }) {
|
|
8
|
-
const logo = techLogos[techKey];
|
|
9
|
-
const [isHovered, setIsHovered] = useState(false);
|
|
10
|
-
if (!logo)
|
|
11
|
-
return null;
|
|
12
|
-
const rawSvg = decodeURIComponent(logo.svg.replace('data:image/svg+xml,', ''));
|
|
13
|
-
const decodedSvg = sanitizeSvg(rawSvg);
|
|
14
|
-
return (_jsx(Card, { variant: variant, className: "dndev-tech-card", style: { '--tech-color': logo.color }, "data-hover": isHovered, onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: _jsxs(Stack, { direction: "column", align: "center", gap: "tight", children: [_jsx("div", { className: "dndev-tech-card-logo", "data-tech": techKey, dangerouslySetInnerHTML: { __html: decodedSvg } }), _jsx(Text, { as: "span", level: "small", children: logo.name })] }) }));
|
|
15
|
-
}
|
|
16
|
-
export function TechBento({ title, techs, cols = 3, gap = 'medium', separator = false, tone = TONE.GHOST, align, collapsible, open, onOpenChange, defaultOpen, className, }) {
|
|
17
|
-
// Convert Grid's cols format to Bento's columns format
|
|
18
|
-
// Grid: [mobile, tablet, laptop, desktop]
|
|
19
|
-
// Bento: { mobile, tablet, desktop, wide }
|
|
20
|
-
const bentoColumns = typeof cols === 'number'
|
|
21
|
-
? {
|
|
22
|
-
mobile: cols,
|
|
23
|
-
tablet: cols,
|
|
24
|
-
desktop: cols,
|
|
25
|
-
wide: cols,
|
|
26
|
-
}
|
|
27
|
-
: {
|
|
28
|
-
mobile: cols[0],
|
|
29
|
-
tablet: cols[1],
|
|
30
|
-
desktop: cols[2], // Grid's laptop → Bento's desktop
|
|
31
|
-
wide: cols[3], // Grid's desktop → Bento's wide
|
|
32
|
-
};
|
|
33
|
-
const getSpan = (size) => {
|
|
34
|
-
if (size === 'long')
|
|
35
|
-
return { cols: 2, rows: 1 };
|
|
36
|
-
if (size === 'high')
|
|
37
|
-
return { cols: 1, rows: 2 };
|
|
38
|
-
if (size === 'huge')
|
|
39
|
-
return { cols: 2, rows: 2 };
|
|
40
|
-
return undefined;
|
|
41
|
-
};
|
|
42
|
-
const items = techs
|
|
43
|
-
.filter((tech) => techLogos[tech.name])
|
|
44
|
-
.map((tech) => ({
|
|
45
|
-
id: tech.name,
|
|
46
|
-
content: _jsx(TechCard, { techKey: tech.name, variant: tech.variant }),
|
|
47
|
-
span: getSpan(tech.size),
|
|
48
|
-
}));
|
|
49
|
-
const bento = (_jsx(Bento, { items: items, columns: bentoColumns, gap: gap, ariaLabel: "Technology stack" }));
|
|
50
|
-
// Always use Section - TechBento is a Section with a Bento grid
|
|
51
|
-
return (_jsx(Section, { title: title, separator: separator, tone: tone, align: align, collapsible: collapsible, open: open, onOpenChange: onOpenChange, defaultOpen: defaultOpen, className: cn('dndev-tech-bento', className), children: _jsx("div", { className: "dndev-tech-bento-grid", children: bento }) }));
|
|
52
|
-
}
|
|
53
|
-
export default TechBento;
|
|
1
|
+
"use client";import{useState as C}from"react";import{Bento as S,Card as T,Section as y,Stack as B,Text as w,TONE as N,cn as O}from"@donotdev/components";import{techLogos as c}from"../../data/techLogos.js";import{sanitizeSvg as k}from"../../utils/sanitizeSvg.js";import{jsx as t,jsxs as K}from"react/jsx-runtime";function x({techKey:o,variant:r}){let e=c[o],[s,a]=C(!1);if(!e)return null;let i=decodeURIComponent(e.svg.replace("data:image/svg+xml,","")),l=k(i);return t(T,{variant:r,className:"dndev-tech-card",style:{"--tech-color":e.color},"data-hover":s,onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:K(B,{direction:"column",align:"center",gap:"tight",children:[t("div",{className:"dndev-tech-card-logo","data-tech":o,dangerouslySetInnerHTML:{__html:l}}),t(w,{as:"span",level:"small",children:e.name})]})})}function H({title:o,techs:r,cols:e=3,gap:s="medium",separator:a=!1,tone:i=N.GHOST,align:l,collapsible:d,open:p,onOpenChange:m,defaultOpen:g,className:u}){let v=typeof e=="number"?{mobile:e,tablet:e,desktop:e,wide:e}:{mobile:e[0],tablet:e[1],desktop:e[2],wide:e[3]},h=n=>{if(n==="long")return{cols:2,rows:1};if(n==="high")return{cols:1,rows:2};if(n==="huge")return{cols:2,rows:2}},f=r.filter(n=>c[n.name]).map(n=>({id:n.name,content:t(x,{techKey:n.name,variant:n.variant}),span:h(n.size)})),b=t(S,{items:f,columns:v,gap:s,ariaLabel:"Technology stack"});return t(y,{title:o,separator:a,tone:i,align:l,collapsible:d,open:p,onOpenChange:m,defaultOpen:g,className:O("dndev-tech-bento",u),children:t("div",{className:"dndev-tech-bento-grid",children:b})})}var M=H;export{H as TechBento,M as default};
|
|
@@ -8,7 +8,7 @@ export interface IconProps {
|
|
|
8
8
|
* **SUPPORTS ALL FORMATS:**
|
|
9
9
|
* - ✅ Lucide components: `<Rocket />` (function)
|
|
10
10
|
* - ✅ Emoji strings: `"🚀"`
|
|
11
|
-
* - ✅ Lucide icon name strings: `"Rocket"` (
|
|
11
|
+
* - ✅ Lucide icon name strings: `"Rocket"` (theme icons render statically; any other name loads as its own chunk, with a same-size placeholder meanwhile and none in server HTML; unknown names show `Palette`)
|
|
12
12
|
* - ✅ Custom ReactNode: Any custom component or element
|
|
13
13
|
*
|
|
14
14
|
* **NOTE:** This is the flexible runtime Icon component. For PageMeta.icon, only lucide-react JSX components are supported (see PageMeta type).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/components/common/icon.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/components/common/icon.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMtD,oCAAoC;AACpC,MAAM,WAAW,SAAS;IACxB;;;;;;;;;;OAUG;IACH,IAAI,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC;IACvD,kEAAkE;IAClE,QAAQ,CAAC,EAAE,aAAa,CAAC,WAAW,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,QAAA,MAAM,IAAI,EAAE,aAAa,CAAC,SAAS,CAyFlC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,CAAC"}
|