@donotdev/ui 0.2.2 → 0.3.0
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/ChildRowsPicker-63M4EQUQ.js +1 -0
- package/dist/ChildRowsPicker-ISP365ON.js +1 -0
- package/dist/ChildRowsPicker-PQFE6NCR.js +1 -0
- package/dist/ChildRowsPicker-XXFFSMWY.js +1 -0
- package/dist/{GoToDialog-CICRYHHG.js → GoToDialog-KSBGOIWO.js} +1 -1
- package/dist/{GoToDialog-YGBON6FR.js → GoToDialog-XBK5EZF4.js} +1 -1
- package/dist/chunk-3CIZFGST.js +1 -0
- package/dist/chunk-LHMKU342.js +1 -0
- package/dist/chunk-MS7ZIW5Z.js +1 -0
- package/dist/chunk-P2DHZWPY.js +1 -0
- package/dist/components/auth/AuthHeader.d.ts.map +1 -1
- package/dist/components/auth/AuthHeader.js +0 -2
- package/dist/components/auth/AuthMenu.d.ts.map +1 -1
- package/dist/components/auth/AuthMenu.js +6 -40
- package/dist/components/common/icon.d.ts.map +1 -1
- package/dist/components/common/icon.js +2 -1
- package/dist/components/common/lucideIconByName.d.ts +9 -0
- package/dist/components/common/lucideIconByName.d.ts.map +1 -0
- package/dist/components/common/lucideIconByName.js +32 -0
- package/dist/components/layout/GameFlow.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.js +18 -12
- package/dist/components/layout/components/header/CacheSettings.d.ts.map +1 -1
- package/dist/components/layout/components/header/CacheSettings.js +6 -4
- package/dist/components/layout/components/header/SettingsMenu.d.ts.map +1 -1
- package/dist/components/layout/components/header/SettingsMenu.js +4 -3
- package/dist/components/layout/components/header/ThemeToggle.d.ts.map +1 -1
- package/dist/components/layout/components/header/ThemeToggle.js +2 -1
- package/dist/crud/components/ChildRowsPicker.d.ts +21 -0
- package/dist/crud/components/ChildRowsPicker.d.ts.map +1 -0
- package/dist/crud/components/ChildRowsPicker.js +68 -0
- package/dist/crud/components/CrudCardLink.d.ts +6 -6
- package/dist/crud/components/CrudCardLink.d.ts.map +1 -1
- package/dist/crud/components/CrudCardLink.js +3 -9
- package/dist/crud/components/EntityCardList.d.ts.map +1 -1
- package/dist/crud/components/EntityCardList.js +10 -26
- package/dist/crud/components/EntityDisplayRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityDisplayRenderer.js +6 -3
- package/dist/crud/components/EntityFormRenderer.d.ts +4 -2
- package/dist/crud/components/EntityFormRenderer.d.ts.map +1 -1
- package/dist/crud/components/EntityFormRenderer.js +160 -56
- package/dist/crud/components/EntityList.d.ts +6 -4
- package/dist/crud/components/EntityList.d.ts.map +1 -1
- package/dist/crud/components/EntityList.js +437 -92
- package/dist/crud/components/EntityRecommendations.js +1 -1
- package/dist/crud/components/EntityWorkflow.d.ts.map +1 -1
- package/dist/crud/components/EntityWorkflow.js +6 -4
- package/dist/crud/components/Form.d.ts +1 -1
- package/dist/crud/components/Form.d.ts.map +1 -1
- package/dist/crud/components/Form.js +2 -2
- package/dist/crud/components/cellEditFor.d.ts +43 -0
- package/dist/crud/components/cellEditFor.d.ts.map +1 -0
- package/dist/crud/components/cellEditFor.js +74 -0
- package/dist/crud/components/entityParent.d.ts +33 -0
- package/dist/crud/components/entityParent.d.ts.map +1 -0
- package/dist/crud/components/entityParent.js +76 -0
- package/dist/crud/components/useRecordBreadcrumb.d.ts +11 -0
- package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -0
- package/dist/crud/components/useRecordBreadcrumb.js +43 -0
- package/dist/crud/crudImports.d.ts +12 -1
- package/dist/crud/crudImports.d.ts.map +1 -1
- package/dist/crud/crudImports.js +11 -0
- package/dist/dndev-next.css +782 -193
- package/dist/dndev.css +784 -193
- package/dist/index.js +4 -4
- package/dist/internal/common/RouteErrorFallback.d.ts.map +1 -1
- package/dist/internal/common/RouteErrorFallback.js +2 -4
- package/dist/internal/devtools/components/ConfigTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/ConfigTab.js +1 -1
- package/dist/internal/devtools/components/CookieTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/CookieTab.js +1 -5
- package/dist/internal/devtools/components/DesignTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/DesignTab.js +18 -7
- package/dist/internal/devtools/components/StoresTab.d.ts.map +1 -1
- package/dist/internal/devtools/components/StoresTab.js +17 -3
- package/dist/internal/devtools/types.d.ts +3 -3
- package/dist/internal/devtools/types.d.ts.map +1 -1
- package/dist/internal/devtools/utils/maskSensitive.d.ts +1 -1
- package/dist/internal/devtools/utils/maskSensitive.d.ts.map +1 -1
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts +3 -0
- package/dist/internal/initializers/NextJsStoresInitializer.d.ts.map +1 -1
- package/dist/internal/initializers/NextJsStoresInitializer.js +8 -1
- package/dist/internal/layout/DnDevLayout.d.ts.map +1 -1
- package/dist/internal/layout/DnDevLayout.js +21 -21
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +42 -38
- package/dist/internal/layout/components/FontPreloadLinks.d.ts +7 -4
- package/dist/internal/layout/components/FontPreloadLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/FontPreloadLinks.js +12 -25
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts +2 -0
- package/dist/internal/layout/components/footer/FooterCopyright.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/FooterCopyright.js +4 -0
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts +2 -1
- package/dist/internal/layout/components/footer/useLegalLinks.d.ts.map +1 -1
- package/dist/internal/layout/components/footer/useLegalLinks.js +4 -3
- package/dist/internal/layout/components/i18nSeoMeta.d.ts.map +1 -1
- package/dist/internal/layout/components/i18nSeoMeta.js +1 -0
- package/dist/internal/layout/zones/DnDevMergedBar.js +3 -3
- package/dist/internal/providers/UIProviders.d.ts +0 -8
- package/dist/internal/providers/UIProviders.d.ts.map +1 -1
- package/dist/internal/providers/UIProviders.js +45 -2
- package/dist/providers/NextJsAppProviders.d.ts +5 -1
- package/dist/providers/NextJsAppProviders.d.ts.map +1 -1
- package/dist/providers/NextJsAppProviders.js +36 -6
- package/dist/providers/ViteAppProviders.d.ts.map +1 -1
- package/dist/providers/ViteAppProviders.js +42 -7
- package/dist/routing/404.d.ts +8 -1
- package/dist/routing/404.d.ts.map +1 -1
- package/dist/routing/404.js +9 -5
- package/dist/routing/AuthGuardFallback.d.ts.map +1 -1
- package/dist/routing/AuthGuardFallback.js +1 -2
- package/dist/routing/AuthReturnTo.d.ts.map +1 -1
- package/dist/routing/AuthReturnTo.js +9 -2
- package/dist/routing/GoTo.d.ts +0 -6
- package/dist/routing/GoTo.d.ts.map +1 -1
- package/dist/routing/GoTo.js +5 -8
- package/dist/routing/Link.d.ts +4 -2
- package/dist/routing/Link.d.ts.map +1 -1
- package/dist/routing/Link.js +8 -5
- package/dist/routing/SignedInRedirect.d.ts +27 -0
- package/dist/routing/SignedInRedirect.d.ts.map +1 -0
- package/dist/routing/SignedInRedirect.js +47 -0
- package/dist/routing/hooks/hooks.next.d.ts +2 -0
- package/dist/routing/hooks/hooks.next.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.next.js +1 -1
- package/dist/routing/hooks/hooks.vite.d.ts +2 -0
- package/dist/routing/hooks/hooks.vite.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/useLocation.next.d.ts +12 -0
- package/dist/routing/hooks/useLocation.next.d.ts.map +1 -1
- package/dist/routing/hooks/useLocation.next.js +17 -4
- package/dist/routing/hooks/useMatch.next.d.ts +6 -0
- package/dist/routing/hooks/useMatch.next.d.ts.map +1 -1
- package/dist/routing/hooks/useMatch.next.js +8 -2
- package/dist/routing/hooks/useNavigate.next.d.ts +6 -1
- package/dist/routing/hooks/useNavigate.next.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.next.js +13 -4
- package/dist/routing/hooks/useNavigate.vite.d.ts +7 -1
- package/dist/routing/hooks/useNavigate.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.vite.js +20 -4
- package/dist/routing/hooks/useRedirectGuard.next.d.ts +3 -1
- package/dist/routing/hooks/useRedirectGuard.next.d.ts.map +1 -1
- package/dist/routing/hooks/useRedirectGuard.next.js +18 -10
- package/dist/routing/hooks/useRedirectGuard.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useRedirectGuard.vite.js +7 -1
- package/dist/routing/hooks/useRoutePath.next.d.ts +23 -0
- package/dist/routing/hooks/useRoutePath.next.d.ts.map +1 -0
- package/dist/routing/hooks/useRoutePath.next.js +36 -0
- package/dist/routing/hooks/useRoutePath.vite.d.ts +13 -0
- package/dist/routing/hooks/useRoutePath.vite.d.ts.map +1 -0
- package/dist/routing/hooks/useRoutePath.vite.js +25 -0
- package/dist/routing/hooks/useUrlLanguage.next.d.ts +28 -0
- package/dist/routing/hooks/useUrlLanguage.next.d.ts.map +1 -0
- package/dist/routing/hooks/useUrlLanguage.next.js +50 -0
- package/dist/routing/hooks/useUrlLanguage.vite.d.ts +22 -0
- package/dist/routing/hooks/useUrlLanguage.vite.d.ts.map +1 -0
- package/dist/routing/hooks/useUrlLanguage.vite.js +41 -0
- package/dist/routing/index.d.ts +3 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +2 -1
- package/dist/routing/parentRoute.d.ts +27 -0
- package/dist/routing/parentRoute.d.ts.map +1 -0
- package/dist/routing/parentRoute.js +43 -0
- package/dist/routing/useNavigation.d.ts.map +1 -1
- package/dist/routing/useNavigation.js +8 -27
- package/dist/routing/useRouteDiscovery.d.ts +2 -2
- package/dist/routing/useRouteDiscovery.d.ts.map +1 -1
- package/dist/routing/useRouteDiscovery.js +6 -5
- package/dist/styles/index.css +781 -192
- package/dist/symbol-index.json +1 -1
- package/dist/utils/assetResolver.d.ts.map +1 -1
- package/dist/utils/assetResolver.js +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -0
- package/dist/utils/useDeleteAccountSafe.d.ts +17 -0
- package/dist/utils/useDeleteAccountSafe.d.ts.map +1 -0
- package/dist/utils/useDeleteAccountSafe.js +52 -0
- package/dist/utils/useFormStoreSafe.d.ts.map +1 -1
- package/dist/utils/useFormStoreSafe.js +1 -0
- package/dist/utils/useSeo.d.ts +10 -2
- package/dist/utils/useSeo.d.ts.map +1 -1
- package/dist/utils/useSeo.js +44 -9
- package/dist/vite-routing/AppRoutes.d.ts.map +1 -1
- package/dist/vite-routing/AppRoutes.js +37 -4
- package/guidelines/COMPONENTS.md +2 -1
- package/guidelines/GOTCHAS.md +2 -0
- package/guidelines/LAYOUTS.md +4 -0
- package/guidelines/PAGES.md +30 -3
- package/guidelines/ROUTING.md +29 -0
- package/guidelines/SEO.md +52 -0
- package/package.json +9 -9
- package/dist/CookieConsent-5NH5DNTP.js +0 -1
- package/dist/CookieConsent-W7UE647Y.js +0 -1
- package/dist/chunk-DRFM6WXH.js +0 -1
- package/dist/chunk-MIPTBUWY.js +0 -1
- package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts +0 -57
- package/dist/internal/layout/components/NextJsAutoMetaTags.d.ts.map +0 -1
- package/dist/internal/layout/components/NextJsAutoMetaTags.js +0 -182
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{g as p,n as u,t as g,v as m,w as f}from"./chunk-P2DHZWPY.js";import"./chunk-O2XFH626.js";import{useState as I}from"react";import{Button as k,DataTable as L,Dialog as D,Stack as P,Text as E}from"@donotdev/components";import{useTranslation as w}from"@donotdev/core";import{jsx as i,jsxs as R}from"react/jsx-runtime";function F({entity:t,excludedIds:h,onPick:b,onClose:l}){let{t:s}=w([t.namespace,"crud"]),{t:o}=w("crud"),a=p(t,{pagination:"client"}),y=u(t),[r,v]=I([]),c=a.processed.filter(e=>!h.has(e.id)),d=t.listFields||Object.keys(t.fields),C=d.flatMap(e=>{let n=t.fields[e];return n?[{key:e,title:m(e,n,s),dataIndex:e,sortable:!0,render:(x,S)=>f(x,n,s,{compact:!0,referenceData:y,item:S})}]:[]}),T=s("name",{defaultValue:t.name});return i(D,{open:!0,onOpenChange:e=>{e||l()},title:o("childRows.pickTitle",{entity:T}),footer:R(P,{direction:"row",gap:"tight",justify:"end",children:[i(k,{variant:"outline",onClick:l,children:o("actions.cancel")}),i(k,{intent:"add",disabled:r.length===0,onClick:()=>{b(r),l()},children:o("childRows.pickConfirm",{count:r.length})})]}),children:R(P,{children:[i(g,{entity:t,data:a.items,fieldsToFilter:d}),!a.loading&&c.length===0?i(E,{level:"body",children:o("childRows.pickEmpty")}):i(L,{data:c,columns:C,sortable:!0,searchable:!1,pagination:!0,loading:a.loading,selectable:!0,getRowId:e=>e.id,onSelect:e=>v(e.map(n=>n.id)),showingLabel:o("pagination.showing"),paginationPreviousLabel:o("pagination.previous"),paginationNextLabel:o("pagination.next"),paginationItemsPerPagePlaceholder:o("pagination.itemsPerPagePlaceholder")})]})})}export{F as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{A as b,g as m,k as f,n as h,t as k,v as w,w as P,z as R}from"./chunk-P2DHZWPY.js";import"./chunk-O2XFH626.js";import{Search as V}from"lucide-react";import{useState as v}from"react";import{Button as y,DataTable as j,Dialog as M,Input as U,Stack as C,Text as _}from"@donotdev/components";import{useTranslation as S}from"@donotdev/core";import{jsx as i,jsxs as T}from"react/jsx-runtime";var $="deleted";function q({entity:t,excludedIds:x,viewerRole:E,onPick:I,onClose:a}){let{t:l}=S([t.namespace,"crud"]),{t:o}=S("crud"),r=m(t,{pagination:"client"}),D=h(t),[s,F]=v([]),[c,L]=v(""),d=`${t.collection}#picker`,{filters:A}=f({collection:d}),p=r.items.filter(e=>e.status!==$&&!x.has(e.id)),u=b(R(p,A,t),c,t),g=t.listFields||Object.keys(t.fields),B=g.flatMap(e=>{let n=t.fields[e];return n?[{key:e,title:w(e,n,l),dataIndex:e,sortable:!0,render:(O,Q)=>P(O,n,l,{compact:!0,referenceData:D,item:Q})}]:[]}),K=l("name",{defaultValue:t.name});return i(M,{open:!0,onOpenChange:e=>{e||a()},title:o("childRows.pickTitle",{entity:K}),footer:T(C,{direction:"row",gap:"tight",justify:"end",children:[i(y,{variant:"outline",onClick:a,children:o("actions.cancel")}),i(y,{intent:"add",disabled:s.length===0,onClick:()=>{I(s),a()},children:o("childRows.pickConfirm",{count:s.length})})]}),children:T(C,{children:[i(k,{entity:t,data:p,fieldsToFilter:g,viewerRole:E,filterKey:d}),i(U,{placeholder:o("actions.searchPlaceholder"),value:c,onChange:e=>L(e.target.value),icon:V,className:"dndev-w-full"}),!r.loading&&u.length===0?i(_,{level:"body",children:o("childRows.pickEmpty")}):i(j,{data:u,columns:B,sortable:!0,searchable:!1,pagination:!0,loading:r.loading,selectable:!0,getRowId:e=>e.id,onSelect:e=>F(e.map(n=>n.id)),showingLabel:o("pagination.showing"),paginationPreviousLabel:o("pagination.previous"),paginationNextLabel:o("pagination.next"),paginationItemsPerPagePlaceholder:o("pagination.itemsPerPagePlaceholder")})]})})}export{q as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{g as m,k as f,n as h,t as k,v as P,w as R,y as w,z as v}from"./chunk-LHMKU342.js";import"./chunk-O2XFH626.js";import{Search as V}from"lucide-react";import{useState as b}from"react";import{Button as y,DataTable as j,Dialog as M,Input as $,Stack as C,Text as q}from"@donotdev/components";import{statusCan as z,useTranslation as S}from"@donotdev/core";import{jsx as i,jsxs as T}from"react/jsx-runtime";function G({entity:t,excludedIds:x,viewerRole:I,onPick:F,onClose:a}){let{t:l}=S([t.namespace,"crud"]),{t:o}=S("crud"),s=m(t,{pagination:"client"}),L=h(t),[r,D]=b([]),[c,E]=b(""),d=`${t.collection}#picker`,{filters:B}=f({collection:d}),u=s.items.filter(e=>!z(typeof e.status=="string"?e.status:null,"isRemoved")&&!x.has(e.id)),p=v(w(u,B,t),c,t),g=t.listFields||Object.keys(t.fields),A=g.flatMap(e=>{let n=t.fields[e];return n?[{key:e,title:P(e,n,l),dataIndex:e,sortable:!0,render:(O,Q)=>R(O,n,l,{compact:!0,referenceData:L,item:Q})}]:[]}),K=l("name",{defaultValue:t.name});return i(M,{open:!0,onOpenChange:e=>{e||a()},title:o("childRows.pickTitle",{entity:K}),footer:T(C,{direction:"row",gap:"tight",justify:"end",children:[i(y,{variant:"outline",onClick:a,children:o("actions.cancel")}),i(y,{intent:"add",disabled:r.length===0,onClick:()=>{F(r),a()},children:o("childRows.pickConfirm",{count:r.length})})]}),children:T(C,{children:[i(k,{entity:t,data:u,fieldsToFilter:g,viewerRole:I,filterKey:d}),i($,{placeholder:o("actions.searchPlaceholder"),value:c,onChange:e=>E(e.target.value),icon:V,className:"dndev-w-full"}),!s.loading&&p.length===0?i(q,{level:"body",children:o("childRows.pickEmpty")}):i(j,{data:p,columns:A,sortable:!0,searchable:!1,pagination:!0,loading:s.loading,selectable:!0,getRowId:e=>e.id,onSelect:e=>D(e.map(n=>n.id)),showingLabel:o("pagination.showing"),paginationPreviousLabel:o("pagination.previous"),paginationNextLabel:o("pagination.next"),paginationItemsPerPagePlaceholder:o("pagination.itemsPerPagePlaceholder")})]})})}export{G as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{g as m,k as f,n as h,t as k,v as w,w as P,y as R,z as b}from"./chunk-LHMKU342.js";import"./chunk-O2XFH626.js";import{Search as V}from"lucide-react";import{useState as v}from"react";import{Button as y,DataTable as j,Dialog as M,Input as U,Stack as C,Text as _}from"@donotdev/components";import{useTranslation as S}from"@donotdev/core";import{jsx as i,jsxs as T}from"react/jsx-runtime";var $="deleted";function q({entity:t,excludedIds:x,viewerRole:E,onPick:I,onClose:a}){let{t:l}=S([t.namespace,"crud"]),{t:o}=S("crud"),r=m(t,{pagination:"client"}),D=h(t),[s,F]=v([]),[c,L]=v(""),d=`${t.collection}#picker`,{filters:A}=f({collection:d}),p=r.items.filter(e=>e.status!==$&&!x.has(e.id)),u=b(R(p,A,t),c,t),g=t.listFields||Object.keys(t.fields),B=g.flatMap(e=>{let n=t.fields[e];return n?[{key:e,title:w(e,n,l),dataIndex:e,sortable:!0,render:(O,Q)=>P(O,n,l,{compact:!0,referenceData:D,item:Q})}]:[]}),K=l("name",{defaultValue:t.name});return i(M,{open:!0,onOpenChange:e=>{e||a()},title:o("childRows.pickTitle",{entity:K}),footer:T(C,{direction:"row",gap:"tight",justify:"end",children:[i(y,{variant:"outline",onClick:a,children:o("actions.cancel")}),i(y,{intent:"add",disabled:s.length===0,onClick:()=>{I(s),a()},children:o("childRows.pickConfirm",{count:s.length})})]}),children:T(C,{children:[i(k,{entity:t,data:p,fieldsToFilter:g,viewerRole:E,filterKey:d}),i(U,{placeholder:o("actions.searchPlaceholder"),value:c,onChange:e=>L(e.target.value),icon:V,className:"dndev-w-full"}),!r.loading&&u.length===0?i(_,{level:"body",children:o("childRows.pickEmpty")}):i(j,{data:u,columns:B,sortable:!0,searchable:!1,pagination:!0,loading:r.loading,selectable:!0,getRowId:e=>e.id,onSelect:e=>F(e.map(n=>n.id)),showingLabel:o("pagination.showing"),paginationPreviousLabel:o("pagination.previous"),paginationNextLabel:o("pagination.next"),paginationItemsPerPagePlaceholder:o("pagination.itemsPerPagePlaceholder")})]})})}export{q as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as u,i as T}from"./chunk-MS7ZIW5Z.js";import"./chunk-O2XFH626.js";import{Link as G,Star as I}from"lucide-react";import{useCallback as k,useEffect as D,useRef as O}from"react";import{Badge as S,Command as R,CommandDialog as F}from"@donotdev/components";import{useOverlayStore as v,useTranslation as A}from"@donotdev/core";import{jsx as o,jsxs as t}from"react/jsx-runtime";var E=()=>{let{t:e}=A("dndev"),d=O(null),m=v(a=>a.isCommandDialogOpen),r=v(a=>a.closeCommandDialog),{navigationItems:f,favoriteItems:s,recentItems:i,toggleFavorite:b,isFavorite:c,navigateToItem:h}=T();D(()=>{m&&requestAnimationFrame(()=>{d.current?.focus()})},[m]);let C=k(a=>{h(a),r()},[h,r]),p=k((a,g=!0)=>a.map(n=>({label:n.label,value:n.path,description:n.path!==n.label?n.path:void 0,icon:o(u,{icon:n.icon,fallback:G}),badge:n.badge?o(S,{children:n.badge}):void 0,onSelect:()=>C(n.path),rightSlot:g?o("button",{type:"button",onClick:y=>{y.stopPropagation(),b(n.path)},className:"dndev-command-favorite-button","data-favorited":c(n.path),"aria-label":c(n.path)?e("globalGoTo.unfavorite","Remove from favorites"):e("globalGoTo.favorite","Add to favorites"),children:o(u,{icon:I,className:"dndev-size-sm"})}):void 0})),[C,b,c,e]),l=[];if(s.length>0&&l.push({heading:e("globalGoTo.favorites","Favorites"),items:p(s,!1)}),i.length>0){let a=i.flatMap(g=>p([g],!0));a.length>0&&l.push({heading:e("globalGoTo.recent","Recent"),separator:s.length>0,items:a})}l.push({heading:e("globalGoTo.allPages","All Pages"),separator:s.length>0||i.length>0,items:p(f)});let N=f.length>0;return t(F,{open:m,onOpenChange:a=>a?null:r(),children:[o(R,{placeholder:e("globalGoTo.placeholder","Search pages..."),emptyMessage:N?e("globalGoTo.noResults","No results found."):e("globalGoTo.empty","No pages available."),groups:l}),o("div",{className:"dndev-command-footer",children:t("div",{className:"dndev-command-footer-shortcuts",children:[t("div",{className:"dndev-command-footer-shortcut",children:[o("kbd",{className:"dndev-command-footer-key",children:"\u2318K"}),o("span",{children:e("globalGoTo.shortcutOpen","Open")})]}),t("div",{className:"dndev-command-footer-shortcut",children:[o("kbd",{className:"dndev-command-footer-key",children:"\u2191"}),o("kbd",{className:"dndev-command-footer-key",children:"\u2193"}),o("span",{children:e("globalGoTo.shortcutNavigate","Navigate")})]}),t("div",{className:"dndev-command-footer-shortcut",children:[o("kbd",{className:"dndev-command-footer-key",children:"\u21B5"}),o("span",{children:e("globalGoTo.shortcutSelect","Select")})]}),t("div",{className:"dndev-command-footer-shortcut",children:[o("kbd",{className:"dndev-command-footer-key",children:"Esc"}),o("span",{children:e("globalGoTo.shortcutClose","Close")})]})]})})]})},L=()=>v(d=>d.isCommandDialogOpen)?o(E,{}):null,K=L;export{K as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{b as u,i as T}from"./chunk-3CIZFGST.js";import"./chunk-O2XFH626.js";import{Link as G,Star as I}from"lucide-react";import{useCallback as k,useEffect as D,useRef as O}from"react";import{Badge as S,Command as R,CommandDialog as F}from"@donotdev/components";import{useOverlayStore as v,useTranslation as A}from"@donotdev/core";import{jsx as o,jsxs as t}from"react/jsx-runtime";var E=()=>{let{t:e}=A("dndev"),d=O(null),m=v(a=>a.isCommandDialogOpen),r=v(a=>a.closeCommandDialog),{navigationItems:f,favoriteItems:s,recentItems:i,toggleFavorite:b,isFavorite:c,navigateToItem:h}=T();D(()=>{m&&requestAnimationFrame(()=>{d.current?.focus()})},[m]);let C=k(a=>{h(a),r()},[h,r]),p=k((a,g=!0)=>a.map(n=>({label:n.label,value:n.path,description:n.path!==n.label?n.path:void 0,icon:o(u,{icon:n.icon,fallback:G}),badge:n.badge?o(S,{children:n.badge}):void 0,onSelect:()=>C(n.path),rightSlot:g?o("button",{type:"button",onClick:y=>{y.stopPropagation(),b(n.path)},className:"dndev-command-favorite-button","data-favorited":c(n.path),"aria-label":c(n.path)?e("globalGoTo.unfavorite","Remove from favorites"):e("globalGoTo.favorite","Add to favorites"),children:o(u,{icon:I,className:"dndev-size-sm"})}):void 0})),[C,b,c,e]),l=[];if(s.length>0&&l.push({heading:e("globalGoTo.favorites","Favorites"),items:p(s,!1)}),i.length>0){let a=i.flatMap(g=>p([g],!0));a.length>0&&l.push({heading:e("globalGoTo.recent","Recent"),separator:s.length>0,items:a})}l.push({heading:e("globalGoTo.allPages","All Pages"),separator:s.length>0||i.length>0,items:p(f)});let N=f.length>0;return t(F,{open:m,onOpenChange:a=>a?null:r(),children:[o(R,{placeholder:e("globalGoTo.placeholder","Search pages..."),emptyMessage:N?e("globalGoTo.noResults","No results found."):e("globalGoTo.empty","No pages available."),groups:l}),o("div",{className:"dndev-command-footer",children:t("div",{className:"dndev-command-footer-shortcuts",children:[t("div",{className:"dndev-command-footer-shortcut",children:[o("kbd",{className:"dndev-command-footer-key",children:"\u2318K"}),o("span",{children:e("globalGoTo.shortcutOpen","Open")})]}),t("div",{className:"dndev-command-footer-shortcut",children:[o("kbd",{className:"dndev-command-footer-key",children:"\u2191"}),o("kbd",{className:"dndev-command-footer-key",children:"\u2193"}),o("span",{children:e("globalGoTo.shortcutNavigate","Navigate")})]}),t("div",{className:"dndev-command-footer-shortcut",children:[o("kbd",{className:"dndev-command-footer-key",children:"\u21B5"}),o("span",{children:e("globalGoTo.shortcutSelect","Select")})]}),t("div",{className:"dndev-command-footer-shortcut",children:[o("kbd",{className:"dndev-command-footer-key",children:"Esc"}),o("span",{children:e("globalGoTo.shortcutClose","Close")})]})]})})]})},L=()=>v(d=>d.isCommandDialogOpen)?o(E,{}):null,K=L;export{K as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as p from"lucide-react";import{isValidElement as P}from"react";import{cn as f}from"@donotdev/components";import*as b from"lucide-react";var x=b;function C(e){return typeof e=="function"||typeof e=="object"&&e!==null&&"render"in e}function y(e){let t=x[e];return C(t)?t:void 0}import{jsx as c}from"react/jsx-runtime";function S(e){if(!e)return p.Palette;let t=e.replace(/['"]/g,"");return y(t)||p.Palette}var k=({icon:e,fallback:t,className:i,ariaHidden:s=!1})=>{let o=e||t;if(!o)return null;let a="dndev-size-md";if(typeof o=="function"||typeof o=="object"&&o!==null&&"render"in o)return c(o,{className:f(a,i),style:{flexShrink:0},"aria-hidden":s});if(typeof o=="string"){if(!/^[a-zA-Z0-9_-]+$/.test(o))return c("span",{className:f(a,i),style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o});let d=S(o);return c(d,{className:f(a,i),style:{flexShrink:0},"aria-hidden":s})}return P(o)?c("span",{className:i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o}):c("span",{className:i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o})},W=k;import*as h from"@donotdev/auth";import{DEGRADED_AUTH_API as T}from"@donotdev/core";var m=h?.useAuth;function E(e){return T[e]}function v(e){return m?m(e):E(e)}var B=typeof m=="function",J=h?.PasswordResetCallback??(()=>null);import{useMemo as A}from"react";import{filterNavigationRoutes as K,useNavigationStore as j,useTranslation as F}from"@donotdev/core";import{USER_ROLES as w}from"@donotdev/core";import{useRoutePath as U}from"@donotdev/ui/routing/hooks";function g(){let e=U(),t=v("user"),i=!!t,{t:s}=F(),o=t?.role||w.GUEST,a=j(r=>r.cache.allRoutes);return A(()=>K(a,{authenticated:i,role:o}).map(r=>({...r,label:_(r,s),isActive:D(r.path,e),hasChildren:!1,children:void 0})).sort((r,l)=>r.label.localeCompare(l.label,void 0,{sensitivity:"base"})),[a,i,o,e,s])}function oe(e){let t=g();return A(()=>t.find(i=>i.path===e),[t,e])}function _(e,t){let i=e.meta?.namespace;return typeof i!="string"||i===""?e.label:t(`${i}:title`,{defaultValue:e.label})}function D(e,t){return e==="/"?t==="/":t===e?!0:t.startsWith(e+"/")}import{useCallback as V}from"react";import{useNavigationStore as u}from"@donotdev/core";import{useNavigate as z}from"@donotdev/ui/routing/hooks";var ue=()=>{let e=z(),t=g()??[],i=u(n=>n.favorites),s=u(n=>n.recent),o=u(n=>n.toggleFavorite),a=u(n=>n.isFavorite),r=u(n=>n.addRecent),l=t.length?t.filter(n=>i.includes(n.path)):[],d=t.length?t.filter(n=>s.includes(n.path)).slice(0,5):[],R=n=>{o(n)},L=n=>a(n),I=n=>{r(n)},N=V(n=>{I(n),e(n)},[e,I]);return{navigationItems:t,favoriteItems:l,recentItems:d,toggleFavorite:R,isFavorite:L,navigateToItem:N}};export{y as a,k as b,W as c,v as d,B as e,J as f,g,oe as h,ue as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"@donotdev/crud";var r=typeof e?.useCrud=="function",o=e?.useEntityForm,t=e?.useFormStore,s=e?.FormNavigationProvider,n=e?.useFormError,u=e?.useFieldConditions,i=e?.useCrud,d=e?.useCrudList,l=e?.useCrudDoc,a=e?.useCrudCardList,p=e?.useEntityFavorites,c=e?.useCrudFilters,F=e?.useCrudPageSize,x=e?.useEntityWorkflow,C=e?.useReferenceResolver,m=e?.useChildRows,y=e?.useJoinedForm,v=e?.DisplayFieldRenderer,E=e?.FormFieldRenderer,R=e?.UploadProvider,f=e?.EntityFilters,L=e?.CrudCard,P=e?.translateFieldLabel,S=e?.formatValue,b=e?.translateLabel,g=e?.applyFilters,h=e?.applySearch;export{r as a,o as b,t as c,n as d,u as e,i as f,d as g,l as h,a as i,p as j,c as k,F as l,x as m,C as n,m as o,y as p,v as q,E as r,R as s,f as t,L as u,P as v,S as w,b as x,g as y,h as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as p from"lucide-react";import{isValidElement as P}from"react";import{cn as f}from"@donotdev/components";import*as b from"lucide-react";var x=b;function C(e){return typeof e=="function"||typeof e=="object"&&e!==null&&"render"in e}function y(e){let t=x[e];return C(t)?t:void 0}import{jsx as c}from"react/jsx-runtime";function E(e){if(!e)return p.Palette;let t=e.replace(/['"]/g,"");return y(t)||p.Palette}var S=({icon:e,fallback:t,className:i,ariaHidden:s=!1})=>{let o=e||t;if(!o)return null;let a="dndev-size-md";if(typeof o=="function"||typeof o=="object"&&o!==null&&"render"in o)return c(o,{className:f(a,i),style:{flexShrink:0},"aria-hidden":s});if(typeof o=="string"){if(!/^[a-zA-Z0-9_-]+$/.test(o))return c("span",{className:f(a,i),style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o});let d=E(o);return c(d,{className:f(a,i),style:{flexShrink:0},"aria-hidden":s})}return P(o)?c("span",{className:i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o}):c("span",{className:i,style:{display:"inline-flex",alignItems:"center",justifyContent:"center"},"aria-hidden":s,children:o})},$=S;import*as v from"@donotdev/auth";import{DEGRADED_AUTH_API as k}from"@donotdev/core";var m=v?.useAuth;function T(e){return k[e]}function h(e){return m?m(e):T(e)}var q=typeof m=="function",B=v?.PasswordResetCallback??(()=>null);import{useMemo as A}from"react";import{useNavigationStore as K,useTranslation as F}from"@donotdev/core";import{USER_ROLES as w}from"@donotdev/core";import{useRoutePath as _}from"@donotdev/ui/routing/hooks";function g(){let e=_(),t=h("user"),i=!!t,{t:s}=F(),o=t?.role||w.GUEST,a=K(r=>!r||typeof r.getFilteredRoutes!="function"?[]:r.getFilteredRoutes({authenticated:i,role:o}));return A(()=>Array.isArray(a)?a.map(r=>({...r,label:j(r,s),isActive:D(r.path,e),hasChildren:!1,children:void 0})).sort((r,l)=>r.label.localeCompare(l.label,void 0,{sensitivity:"base"})):[],[a,e,s])}function ne(e){let t=g();return A(()=>t.find(i=>i.path===e),[t,e])}function j(e,t){let i=e.meta?.namespace;return typeof i!="string"||i===""?e.label:t(`${i}:title`,{defaultValue:e.label})}function D(e,t){return e==="/"?t==="/":t===e?!0:t.startsWith(e+"/")}import{useCallback as V}from"react";import{useNavigationStore as u}from"@donotdev/core";import{useNavigate as U}from"@donotdev/ui/routing/hooks";var ce=()=>{let e=U(),t=g()??[],i=u(n=>n.favorites),s=u(n=>n.recent),o=u(n=>n.toggleFavorite),a=u(n=>n.isFavorite),r=u(n=>n.addRecent),l=t.length?t.filter(n=>i.includes(n.path)):[],d=t.length?t.filter(n=>s.includes(n.path)).slice(0,5):[],R=n=>{o(n)},N=n=>a(n),I=n=>{r(n)},L=V(n=>{I(n),e(n)},[e,I]);return{navigationItems:t,favoriteItems:l,recentItems:d,toggleFavorite:R,isFavorite:N,navigateToItem:L}};export{y as a,S as b,$ as c,h as d,q as e,B as f,g,ne as h,ce as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as e from"@donotdev/crud";var r=typeof e?.useCrud=="function",o=e?.useEntityForm,t=e?.useFormStore,s=e?.FormNavigationProvider,i=e?.useFormError,n=e?.useFieldConditions,u=e?.useCrud,d=e?.useCrudList,l=e?.useCrudDoc,a=e?.useCrudCardList,p=e?.useEntityFavorites,c=e?.useCrudFilters,F=e?.useCrudPageSize,x=e?.useEntityWorkflow,C=e?.useReferenceResolver,m=e?.useChildRows,y=e?.useJoinedForm,E=e?.DisplayFieldRenderer,v=e?.FormFieldRenderer,R=e?.UploadProvider,f=e?.EntityFilters,L=e?.CrudCard,b=e?.translateFieldLabel,P=e?.formatValue,S=e?.translateLabel,g=e?.isFieldEditable,h=e?.applyFilters,w=e?.applySearch;export{r as a,o as b,t as c,i as d,n as e,u as f,d as g,l as h,a as i,p as j,c as k,F as l,x as m,C as n,m as o,y as p,E as q,v as r,R as s,f as t,L as u,b as v,P as w,S as x,g as y,h as z,w as A};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthHeader.d.ts","sourceRoot":"","sources":["../../../src/components/auth/AuthHeader.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"AuthHeader.d.ts","sourceRoot":"","sources":["../../../src/components/auth/AuthHeader.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAEL,cAAc,EAGd,OAAO,EACR,MAAM,sBAAsB,CAAC;AAuE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;IAC/D,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,eAAe,CAqJrD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -23,7 +23,6 @@ const NullComponent = () => null;
|
|
|
23
23
|
function SignInButton({ display, variant = BUTTON_VARIANT.OUTLINE, signInLabel, className, style, children, ...props }) {
|
|
24
24
|
return (_jsx(Button, { variant: variant, icon: User, display: display, tooltip: signInLabel, className: className, style: style, ...props, children: children ?? signInLabel }));
|
|
25
25
|
}
|
|
26
|
-
// @ts-expect-error - lazy() type doesn't account for graceful degradation fallback
|
|
27
26
|
const AuthPartnerButton = lazy(async () => {
|
|
28
27
|
try {
|
|
29
28
|
const module = await import('@donotdev/auth');
|
|
@@ -33,7 +32,6 @@ const AuthPartnerButton = lazy(async () => {
|
|
|
33
32
|
return { default: NullComponent };
|
|
34
33
|
}
|
|
35
34
|
});
|
|
36
|
-
// @ts-expect-error - lazy() type doesn't account for graceful degradation fallback
|
|
37
35
|
const MultipleAuthProviders = lazy(async () => {
|
|
38
36
|
try {
|
|
39
37
|
const module = await import('@donotdev/auth');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthMenu.d.ts","sourceRoot":"","sources":["../../../src/components/auth/AuthMenu.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AuthMenu.d.ts","sourceRoot":"","sources":["../../../src/components/auth/AuthMenu.tsx"],"names":[],"mappings":"AAyEA,OAAO,KAAkC,MAAM,OAAO,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,EAML,OAAO,EACR,MAAM,sBAAsB,CAAC;AAwC9B;;;;;;;;;GASG;AACH,MAAM,WAAW,kBAAkB;IACjC,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,GAAG,aAAa,CAAC;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACtD,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+BAA+B;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,mBAAmB;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,qFAAqF;IACrF,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IAEjD,sBAAsB;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;OAIG;IACH,WAAW,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAEnC,gDAAgD;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AA4BD,eAAO,MAAM,QAAQ,GAAI,iFAOtB,aAAa,6BAyOf,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -70,17 +70,17 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
70
70
|
* @author AMBROISE PARK Consulting
|
|
71
71
|
*/
|
|
72
72
|
import { User, LogOut, Settings, UserCheck, Trash2 } from 'lucide-react';
|
|
73
|
-
import * as LucideIcons from 'lucide-react';
|
|
74
73
|
import React, { useMemo, lazy, Suspense } from 'react';
|
|
75
74
|
import { Avatar, Button, BUTTON_VARIANT, DropdownMenu, Text, DISPLAY, } from '@donotdev/components';
|
|
76
75
|
import { useTranslation } from '@donotdev/core';
|
|
77
|
-
import { getEnabledAuthPartners, useAuthConfig
|
|
76
|
+
import { getEnabledAuthPartners, useAuthConfig } from '@donotdev/core';
|
|
78
77
|
import { useBreakpoint } from '@donotdev/core';
|
|
79
78
|
import { useNavigate } from '@donotdev/ui/routing/hooks';
|
|
80
79
|
import { useNavigationItems } from '../../routing';
|
|
81
80
|
import { useAuthSafe, useAuthVisibility } from '../../utils';
|
|
81
|
+
import { useDeleteAccountSafe } from '../../utils/useDeleteAccountSafe';
|
|
82
|
+
import { findLucideIcon } from '../common/lucideIconByName';
|
|
82
83
|
const NullComponent = () => null;
|
|
83
|
-
// @ts-expect-error - lazy() type doesn't account for graceful degradation fallback
|
|
84
84
|
const ReauthDialog = lazy(async () => {
|
|
85
85
|
try {
|
|
86
86
|
const module = await import('@donotdev/auth');
|
|
@@ -90,7 +90,6 @@ const ReauthDialog = lazy(async () => {
|
|
|
90
90
|
return { default: NullComponent };
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
|
-
// @ts-expect-error - lazy() type doesn't account for graceful degradation fallback
|
|
94
93
|
const ConfirmDeleteDialog = lazy(async () => {
|
|
95
94
|
try {
|
|
96
95
|
const module = await import('@donotdev/auth');
|
|
@@ -100,39 +99,6 @@ const ConfirmDeleteDialog = lazy(async () => {
|
|
|
100
99
|
return { default: NullComponent };
|
|
101
100
|
}
|
|
102
101
|
});
|
|
103
|
-
// Graceful degradation for useDeleteAccount hook
|
|
104
|
-
// Resolved at module level (not render level) to avoid Rules of Hooks violation.
|
|
105
|
-
// Once set, useDeleteAccount never changes identity during the app lifecycle.
|
|
106
|
-
let useDeleteAccount = () => {
|
|
107
|
-
// Fallback: always call useState to maintain stable hook order
|
|
108
|
-
const [showConfirmDialog] = React.useState(false);
|
|
109
|
-
const [showPasswordDialog] = React.useState(false);
|
|
110
|
-
const [isDeleting] = React.useState(false);
|
|
111
|
-
const [error] = React.useState(null);
|
|
112
|
-
return {
|
|
113
|
-
showConfirmDialog,
|
|
114
|
-
showPasswordDialog,
|
|
115
|
-
isDeleting,
|
|
116
|
-
error,
|
|
117
|
-
startDeleteFlow: () => { },
|
|
118
|
-
confirmDelete: async () => { },
|
|
119
|
-
cancel: () => { },
|
|
120
|
-
};
|
|
121
|
-
};
|
|
122
|
-
// Preload useDeleteAccount (non-blocking)
|
|
123
|
-
// The hook reference is swapped before the first render in practice,
|
|
124
|
-
// but if the import resolves after first render, the fallback remains
|
|
125
|
-
// stable for that session to avoid hook order changes mid-lifecycle.
|
|
126
|
-
if (isClient()) {
|
|
127
|
-
import('@donotdev/auth')
|
|
128
|
-
.then((module) => {
|
|
129
|
-
useDeleteAccount = module.useDeleteAccount;
|
|
130
|
-
})
|
|
131
|
-
.catch((e) => {
|
|
132
|
-
if (process.env.NODE_ENV === 'development')
|
|
133
|
-
console.warn('Failed to load @donotdev/auth:', e);
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
102
|
/**
|
|
137
103
|
* Resolves Lucide icon component from string name or component reference
|
|
138
104
|
*
|
|
@@ -150,7 +116,7 @@ const getIcon = (iconName) => {
|
|
|
150
116
|
if (typeof iconName === 'function')
|
|
151
117
|
return iconName;
|
|
152
118
|
const cleanIconName = iconName.replace(/['"]/g, '');
|
|
153
|
-
const resolved =
|
|
119
|
+
const resolved = findLucideIcon(cleanIconName);
|
|
154
120
|
if (!resolved && process.env.NODE_ENV === 'development') {
|
|
155
121
|
console.warn(`[AuthMenu] Icon name "${cleanIconName}" not found in Lucide icons, falling back to Settings.`);
|
|
156
122
|
}
|
|
@@ -170,8 +136,8 @@ export const AuthMenu = ({ loginPath, display = DISPLAY.AUTO, 'no-tooltip': noTo
|
|
|
170
136
|
const configMenuItems = authConfig.authMenuItems || [];
|
|
171
137
|
// Extract role from user (declared early so getUserTooltip can reference it)
|
|
172
138
|
const role = user?.role;
|
|
173
|
-
// Account deletion flow - managed by
|
|
174
|
-
const deletion =
|
|
139
|
+
// Account deletion flow - managed by useDeleteAccountSafe hook
|
|
140
|
+
const deletion = useDeleteAccountSafe();
|
|
175
141
|
/**
|
|
176
142
|
* Get user display name with fallbacks
|
|
177
143
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/components/common/icon.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/components/common/icon.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAYtD,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"}
|
|
@@ -11,11 +11,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
11
11
|
import * as LucideIcons from 'lucide-react';
|
|
12
12
|
import { isValidElement } from 'react';
|
|
13
13
|
import { cn } from '@donotdev/components';
|
|
14
|
+
import { findLucideIcon } from './lucideIconByName';
|
|
14
15
|
function getLucideIcon(name) {
|
|
15
16
|
if (!name)
|
|
16
17
|
return LucideIcons.Palette;
|
|
17
18
|
const cleanIconName = name.replace(/['"]/g, '');
|
|
18
|
-
return
|
|
19
|
+
return findLucideIcon(cleanIconName) || LucideIcons.Palette;
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
21
22
|
* Icon - Unified icon component (FLEXIBLE RUNTIME COMPONENT)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LucideIcon } from 'lucide-react';
|
|
2
|
+
/**
|
|
3
|
+
* Finds a Lucide icon component by its export name (e.g. `"Rocket"`).
|
|
4
|
+
*
|
|
5
|
+
* @param name - Lucide export name
|
|
6
|
+
* @returns The icon component, or undefined when no icon export has that name
|
|
7
|
+
*/
|
|
8
|
+
export declare function findLucideIcon(name: string): LucideIcon | undefined;
|
|
9
|
+
//# sourceMappingURL=lucideIconByName.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lucideIconByName.d.ts","sourceRoot":"","sources":["../../../src/components/common/lucideIconByName.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAkB/C;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS,CAGnE"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// packages/ui/src/components/common/lucideIconByName.ts
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Runtime Lucide icon lookup by export name
|
|
4
|
+
* @description Typed replacement for `(LucideIcons as any)[name]`. Internal to @donotdev/ui (not re-exported).
|
|
5
|
+
*
|
|
6
|
+
* @version 0.1.0
|
|
7
|
+
* @since 0.2.2
|
|
8
|
+
* @author AMBROISE PARK Consulting
|
|
9
|
+
*/
|
|
10
|
+
import * as LucideIcons from 'lucide-react';
|
|
11
|
+
/** The lucide-react namespace viewed as a name-indexed lookup table. */
|
|
12
|
+
const LUCIDE_EXPORTS = LucideIcons;
|
|
13
|
+
/**
|
|
14
|
+
* Narrows a lucide-react export to an icon component (function or forwardRef object).
|
|
15
|
+
*
|
|
16
|
+
* @param value - Any lucide-react export
|
|
17
|
+
* @returns True when the export is renderable as an icon component
|
|
18
|
+
*/
|
|
19
|
+
function isLucideIcon(value) {
|
|
20
|
+
return (typeof value === 'function' ||
|
|
21
|
+
(typeof value === 'object' && value !== null && 'render' in value));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Finds a Lucide icon component by its export name (e.g. `"Rocket"`).
|
|
25
|
+
*
|
|
26
|
+
* @param name - Lucide export name
|
|
27
|
+
* @returns The icon component, or undefined when no icon export has that name
|
|
28
|
+
*/
|
|
29
|
+
export function findLucideIcon(name) {
|
|
30
|
+
const candidate = LUCIDE_EXPORTS[name];
|
|
31
|
+
return isLucideIcon(candidate) ? candidate : undefined;
|
|
32
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GameFlow.d.ts","sourceRoot":"","sources":["../../../src/components/layout/GameFlow.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CACjC,MAAM,
|
|
1
|
+
{"version":3,"file":"GameFlow.d.ts","sourceRoot":"","sources":["../../../src/components/layout/GameFlow.tsx"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AAEH,OAAO,EAIL,KAAK,aAAa,EAClB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,MAAM,CACjC,MAAM,EAEN,MAAM,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,CAAC,GAAG,CAAC,CAAA;CAAE,CAAC,CAC/C,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,6DAA6D;IAC7D,cAAc,EAAE,cAAc,CAAC;IAC/B,oCAAoC;IACpC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iDAAiD;IACjD,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAsCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,QAAQ,CAAC,EACvB,cAAc,EACd,aAAa,EACb,UAAU,EACV,QAAe,GAChB,EAAE,aAAa,sCAgCf"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/components/Breadcrumbs.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/components/Breadcrumbs.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAW3C,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;;;;;;;;GAQG;AACH,QAAA,MAAM,WAAW,EAAE,aAAa,CAAC,gBAAgB,CAqFhD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -19,10 +19,11 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
import { ChevronRight } from 'lucide-react';
|
|
20
20
|
import { useMemo } from 'react';
|
|
21
21
|
import { cn } from '@donotdev/components';
|
|
22
|
-
import { useTranslation } from '@donotdev/core';
|
|
22
|
+
import { useLayout, useTranslation } from '@donotdev/core';
|
|
23
23
|
// Platform-specific hooks via conditional exports
|
|
24
|
-
import {
|
|
24
|
+
import { useRoutePath } from '@donotdev/ui/routing/hooks';
|
|
25
25
|
import { Link } from '../../../routing/Link';
|
|
26
|
+
import { getPathPrefixes } from '../../../routing/parentRoute';
|
|
26
27
|
import { useAllRoutes } from '../../../routing/useRouteDiscovery';
|
|
27
28
|
/**
|
|
28
29
|
* Breadcrumbs component for navigation
|
|
@@ -35,8 +36,10 @@ import { useAllRoutes } from '../../../routing/useRouteDiscovery';
|
|
|
35
36
|
*/
|
|
36
37
|
const Breadcrumbs = ({ items, separator: Separator = ChevronRight, showHome = true, homeHref = '/', variant = 'default', className, }) => {
|
|
37
38
|
const { t } = useTranslation('dndev');
|
|
38
|
-
const
|
|
39
|
+
const pathname = useRoutePath();
|
|
39
40
|
const allRoutes = useAllRoutes();
|
|
41
|
+
// Record shown by the page (set by EntityFormRenderer / EntityDisplayRenderer)
|
|
42
|
+
const recordLabel = useLayout('routeRecordLabel');
|
|
40
43
|
// Build set of valid route paths for existence checking
|
|
41
44
|
const validRoutes = useMemo(() => {
|
|
42
45
|
return new Set(allRoutes.map((route) => route.path));
|
|
@@ -45,15 +48,18 @@ const Breadcrumbs = ({ items, separator: Separator = ChevronRight, showHome = tr
|
|
|
45
48
|
const breadcrumbItems = items
|
|
46
49
|
? items
|
|
47
50
|
: (() => {
|
|
48
|
-
const pathSegments =
|
|
51
|
+
const pathSegments = pathname.split('/').filter(Boolean);
|
|
52
|
+
const prefixes = getPathPrefixes(pathname);
|
|
49
53
|
const breadcrumbs = [];
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const label = segment
|
|
54
|
-
.
|
|
55
|
-
|
|
56
|
-
|
|
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(' ');
|
|
57
63
|
// Only add href if route actually exists
|
|
58
64
|
const href = validRoutes.has(currentPath) ? currentPath : undefined;
|
|
59
65
|
breadcrumbs.push({ label, href });
|
|
@@ -69,7 +75,7 @@ const Breadcrumbs = ({ items, separator: Separator = ChevronRight, showHome = tr
|
|
|
69
75
|
: breadcrumbItems;
|
|
70
76
|
// Smart variant: Hide breadcrumbs on simple pages (root or single segment)
|
|
71
77
|
if (variant === 'smart') {
|
|
72
|
-
const segments =
|
|
78
|
+
const segments = pathname.split('/').filter(Boolean);
|
|
73
79
|
if (segments.length < 2) {
|
|
74
80
|
return null; // Don't render breadcrumbs on simple pages
|
|
75
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheSettings.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/CacheSettings.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CacheSettings.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/CacheSettings.tsx"],"names":[],"mappings":"AAqDA;;;;;;;;;GASG;AACH,iBAAS,aAAa,gCAgQrB;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -15,6 +15,7 @@ import { Button, BUTTON_VARIANT, Checkbox, Stack, useToast, } from '@donotdev/co
|
|
|
15
15
|
import { useTranslation } from '@donotdev/core';
|
|
16
16
|
// Platform-specific hooks via conditional exports
|
|
17
17
|
import { useRefresh } from '@donotdev/ui/routing/hooks';
|
|
18
|
+
const legacyGlobals = globalThis;
|
|
18
19
|
/**
|
|
19
20
|
* CacheSettings - Cache settings component for clearing various caches
|
|
20
21
|
*
|
|
@@ -91,9 +92,10 @@ function CacheSettings() {
|
|
|
91
92
|
}
|
|
92
93
|
if (cacheOptions.webSQL &&
|
|
93
94
|
typeof window !== 'undefined' &&
|
|
94
|
-
'openDatabase' in window
|
|
95
|
+
'openDatabase' in window &&
|
|
96
|
+
typeof legacyGlobals.openDatabase === 'function') {
|
|
95
97
|
try {
|
|
96
|
-
const db =
|
|
98
|
+
const db = legacyGlobals.openDatabase('', '', '', '');
|
|
97
99
|
if (db && db.transaction) {
|
|
98
100
|
db.transaction((tx) => {
|
|
99
101
|
tx.executeSql('SELECT name FROM sqlite_master WHERE type="table"', [], (tx, results) => {
|
|
@@ -171,8 +173,8 @@ function CacheSettings() {
|
|
|
171
173
|
if (cacheOptions.memoryCache) {
|
|
172
174
|
try {
|
|
173
175
|
// Force garbage collection if available (Chrome DevTools)
|
|
174
|
-
if ('gc' in window && typeof
|
|
175
|
-
|
|
176
|
+
if ('gc' in window && typeof legacyGlobals.gc === 'function') {
|
|
177
|
+
legacyGlobals.gc();
|
|
176
178
|
}
|
|
177
179
|
clearedItems.push('Memory Cache');
|
|
178
180
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/SettingsMenu.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"SettingsMenu.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/SettingsMenu.tsx"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,aAAa,EAAwB,MAAM,sBAAsB,CAAC;AAahF,4CAA4C;AAC5C,MAAM,WAAW,iBAAiB;IAChC,qBAAqB;IACrB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED;;;;;;GAMG;AACH,iBAAS,YAAY,CAAC,EACpB,OAAgC,GACjC,GAAE,iBAAsB,+BA+FxB;AAED,eAAe,YAAY,CAAC"}
|
|
@@ -14,6 +14,7 @@ import { Button, BUTTON_VARIANT, DropdownMenu, Stack, DISPLAY, } from '@donotdev
|
|
|
14
14
|
import { useTranslation } from '@donotdev/core';
|
|
15
15
|
import { useLanguageSelector, useTheme, Flag, } from '@donotdev/core';
|
|
16
16
|
import CacheSettings from './CacheSettings';
|
|
17
|
+
import { findLucideIcon } from '../../../common/lucideIconByName';
|
|
17
18
|
import { AuthHeader } from '../../../auth/AuthHeader';
|
|
18
19
|
/**
|
|
19
20
|
* SettingsMenu with fixed hooks order and error protection
|
|
@@ -32,7 +33,7 @@ function SettingsMenu({ variant = BUTTON_VARIANT.OUTLINE, } = {}) {
|
|
|
32
33
|
if (!iconName)
|
|
33
34
|
return LucideIcons.Palette;
|
|
34
35
|
const cleanIconName = iconName.replace(/['"]/g, '');
|
|
35
|
-
return
|
|
36
|
+
return findLucideIcon(cleanIconName) || LucideIcons.Palette;
|
|
36
37
|
};
|
|
37
38
|
const themeItems = availableThemes.map((themeInfo) => {
|
|
38
39
|
const Icon = getIcon(themeInfo.meta?.icon);
|
|
@@ -47,13 +48,13 @@ function SettingsMenu({ variant = BUTTON_VARIANT.OUTLINE, } = {}) {
|
|
|
47
48
|
const languageItems = languages.map((language) => {
|
|
48
49
|
const isActive = language.id === currentLanguage;
|
|
49
50
|
return {
|
|
50
|
-
label: language.
|
|
51
|
+
label: language.nativeName,
|
|
51
52
|
onClick: () => changeLanguage(language.id),
|
|
52
53
|
disabled: isLoading,
|
|
53
54
|
checked: isActive,
|
|
54
55
|
className: isActive ? 'bg-accent' : undefined,
|
|
55
56
|
iconEnd: isActive && !isLoading ? Check : undefined,
|
|
56
|
-
children: (_jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [_jsx(Flag, { code: language.flagCode || language.id, title:
|
|
57
|
+
children: (_jsxs(Stack, { direction: "row", align: "center", gap: "tight", children: [_jsx(Flag, { code: language.flagCode || language.id, title: language.nativeName }), _jsx("span", { children: language.nativeName }), isLoading && isActive && (_jsx("div", { style: { marginInlineStart: 'auto' }, children: _jsx("div", { style: {
|
|
57
58
|
width: '0.5rem',
|
|
58
59
|
height: '0.5rem',
|
|
59
60
|
borderRadius: '50%',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/ThemeToggle.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;AAEtD,OAAO,EAIL,OAAO,EACR,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeToggle.d.ts","sourceRoot":"","sources":["../../../../../src/components/layout/components/header/ThemeToggle.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAa,MAAM,OAAO,CAAC;AAEtD,OAAO,EAIL,OAAO,EACR,MAAM,sBAAsB,CAAC;AAQ9B,UAAU,gBAAgB;IACxB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,OAAO,CAAC,CAAC,MAAM,OAAO,OAAO,CAAC,CAAC;IACjD,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAUD;;;;;;;;;GASG;AACH,QAAA,MAAM,WAAW,EAAE,aAAa,CAAC,gBAAgB,CA8FhD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -13,11 +13,12 @@ import * as LucideIcons from 'lucide-react';
|
|
|
13
13
|
import { Button, BUTTON_VARIANT, DropdownMenu, DISPLAY, } from '@donotdev/components';
|
|
14
14
|
import { useTranslation } from '@donotdev/core';
|
|
15
15
|
import { useTheme } from '@donotdev/core';
|
|
16
|
+
import { findLucideIcon } from '../../../common/lucideIconByName';
|
|
16
17
|
const getIcon = (iconName) => {
|
|
17
18
|
if (!iconName)
|
|
18
19
|
return LucideIcons.Palette;
|
|
19
20
|
const cleanIconName = iconName.replace(/['"]/g, '');
|
|
20
|
-
return
|
|
21
|
+
return findLucideIcon(cleanIconName) || LucideIcons.Palette;
|
|
21
22
|
};
|
|
22
23
|
/**
|
|
23
24
|
* ThemeToggle - Theme switching component
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { AnyEntity } from '@donotdev/core';
|
|
2
|
+
/** Props of {@link ChildRowsPicker}. */
|
|
3
|
+
export interface ChildRowsPickerProps {
|
|
4
|
+
/** Entity of the other side of the link table (the records to pick) */
|
|
5
|
+
entity: AnyEntity;
|
|
6
|
+
/** Records already linked (not offered) */
|
|
7
|
+
excludedIds: ReadonlySet<string>;
|
|
8
|
+
/** The viewer's role: which fields the filters offer (`visibility`) */
|
|
9
|
+
viewerRole: string;
|
|
10
|
+
/** Called with the picked record ids */
|
|
11
|
+
onPick: (ids: string[]) => void;
|
|
12
|
+
/** Closes the dialog */
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Pick records of the other side of a link table: filters, text search,
|
|
17
|
+
* selectable list (deleted and already-linked records excluded), multi-select,
|
|
18
|
+
* "Add selected".
|
|
19
|
+
*/
|
|
20
|
+
export default function ChildRowsPicker({ entity, excludedIds, viewerRole, onPick, onClose, }: ChildRowsPickerProps): import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=ChildRowsPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChildRowsPicker.d.ts","sourceRoot":"","sources":["../../../src/crud/components/ChildRowsPicker.tsx"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAehD,wCAAwC;AACxC,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,MAAM,EAAE,SAAS,CAAC;IAClB,2CAA2C;IAC3C,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,uEAAuE;IACvE,UAAU,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAChC,wBAAwB;IACxB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,EACtC,MAAM,EACN,WAAW,EACX,UAAU,EACV,MAAM,EACN,OAAO,GACR,EAAE,oBAAoB,+BA6GtB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
// packages/ui/src/crud/components/ChildRowsPicker.tsx
|
|
4
|
+
/**
|
|
5
|
+
* @fileoverview Link table picker
|
|
6
|
+
* @description Dialog of a joined `EntityList` on a link table (the child has
|
|
7
|
+
* one reference besides the parent's): the other side's records with
|
|
8
|
+
* `EntityFilters` (for the viewer's role, own filter state: the lists of that
|
|
9
|
+
* collection keep theirs) and a text search over a selectable list; deleted and
|
|
10
|
+
* already-linked records excluded; multi-select. Picked records become unsaved
|
|
11
|
+
* rows. Loaded lazily by EntityList.
|
|
12
|
+
*
|
|
13
|
+
* @version 0.1.0
|
|
14
|
+
* @since 0.2.5
|
|
15
|
+
* @author AMBROISE PARK Consulting
|
|
16
|
+
*/
|
|
17
|
+
import { Search } from 'lucide-react';
|
|
18
|
+
import { useState } from 'react';
|
|
19
|
+
import { Button, DataTable, Dialog, Input, Stack, Text, } from '@donotdev/components';
|
|
20
|
+
import { statusCan, useTranslation } from '@donotdev/core';
|
|
21
|
+
import { EntityFilters, applyFilters, applySearch, formatValue, translateFieldLabel, useCrudFilters, useCrudList, useReferenceResolver, } from '../crudImports';
|
|
22
|
+
/**
|
|
23
|
+
* Pick records of the other side of a link table: filters, text search,
|
|
24
|
+
* selectable list (deleted and already-linked records excluded), multi-select,
|
|
25
|
+
* "Add selected".
|
|
26
|
+
*/
|
|
27
|
+
export default function ChildRowsPicker({ entity, excludedIds, viewerRole, onPick, onClose, }) {
|
|
28
|
+
const { t } = useTranslation([entity.namespace, 'crud']);
|
|
29
|
+
const { t: tCrud } = useTranslation('crud');
|
|
30
|
+
const list = useCrudList(entity, { pagination: 'client' });
|
|
31
|
+
const referenceData = useReferenceResolver(entity);
|
|
32
|
+
const [selectedIds, setSelectedIds] = useState([]);
|
|
33
|
+
const [searchQuery, setSearchQuery] = useState('');
|
|
34
|
+
// Own filter state: picking must not filter the lists of this collection.
|
|
35
|
+
const filterKey = `${entity.collection}#picker`;
|
|
36
|
+
const { filters } = useCrudFilters({ collection: filterKey });
|
|
37
|
+
// Removed records (STATUS_MATRIX `isRemoved`) are never offered.
|
|
38
|
+
const candidates = list.items.filter((row) => !statusCan(typeof row.status === 'string' ? row.status : null, 'isRemoved') &&
|
|
39
|
+
!excludedIds.has(row.id));
|
|
40
|
+
const available = applySearch(applyFilters(candidates, filters, entity), searchQuery, entity);
|
|
41
|
+
const fields = entity.listFields || Object.keys(entity.fields);
|
|
42
|
+
const columns = fields.flatMap((fieldName) => {
|
|
43
|
+
const config = entity.fields[fieldName];
|
|
44
|
+
if (!config)
|
|
45
|
+
return [];
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
key: fieldName,
|
|
49
|
+
title: translateFieldLabel(fieldName, config, t),
|
|
50
|
+
dataIndex: fieldName,
|
|
51
|
+
sortable: true,
|
|
52
|
+
render: (value, record) => formatValue(value, config, t, {
|
|
53
|
+
compact: true,
|
|
54
|
+
referenceData,
|
|
55
|
+
item: record,
|
|
56
|
+
}),
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
});
|
|
60
|
+
const entityName = t('name', { defaultValue: entity.name });
|
|
61
|
+
return (_jsx(Dialog, { open: true, onOpenChange: (open) => {
|
|
62
|
+
if (!open)
|
|
63
|
+
onClose();
|
|
64
|
+
}, title: tCrud('childRows.pickTitle', { entity: entityName }), footer: _jsxs(Stack, { direction: "row", gap: "tight", justify: "end", children: [_jsx(Button, { variant: "outline", onClick: onClose, children: tCrud('actions.cancel') }), _jsx(Button, { intent: "add", disabled: selectedIds.length === 0, onClick: () => {
|
|
65
|
+
onPick(selectedIds);
|
|
66
|
+
onClose();
|
|
67
|
+
}, children: tCrud('childRows.pickConfirm', { count: selectedIds.length }) })] }), children: _jsxs(Stack, { children: [_jsx(EntityFilters, { entity: entity, data: candidates, fieldsToFilter: fields, viewerRole: viewerRole, filterKey: filterKey }), _jsx(Input, { placeholder: tCrud('actions.searchPlaceholder'), value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), icon: Search, className: "dndev-w-full" }), !list.loading && available.length === 0 ? (_jsx(Text, { level: "body", children: tCrud('childRows.pickEmpty') })) : (_jsx(DataTable, { data: available, columns: columns, sortable: true, searchable: false, pagination: true, loading: list.loading, selectable: true, getRowId: (row) => row.id, onSelect: (rows) => setSelectedIds(rows.map((row) => row.id)), showingLabel: tCrud('pagination.showing'), paginationPreviousLabel: tCrud('pagination.previous'), paginationNextLabel: tCrud('pagination.next'), paginationItemsPerPagePlaceholder: tCrud('pagination.itemsPerPagePlaceholder') }))] }) }));
|
|
68
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview UI CrudCard wrapper
|
|
3
|
-
* @description Thin wrapper around @donotdev/crud CrudCard
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @version 0.
|
|
3
|
+
* @description Thin wrapper around @donotdev/crud CrudCard for web navigation.
|
|
4
|
+
* detailHref becomes the card's `href`: a real `<a href>` rendered through the app
|
|
5
|
+
* router's link (registered by UIProviders), with controls kept outside the link.
|
|
6
|
+
* @version 0.2.0
|
|
7
7
|
* @since 0.0.1
|
|
8
8
|
* @author AMBROISE PARK Consulting
|
|
9
9
|
*/
|
|
10
10
|
import type { CrudCardProps } from '@donotdev/core';
|
|
11
11
|
/**
|
|
12
|
-
* CrudCard with
|
|
13
|
-
* When detailHref is provided,
|
|
12
|
+
* CrudCard with link navigation.
|
|
13
|
+
* When detailHref is provided, the card links to it (crawlable, client-side navigation).
|
|
14
14
|
*/
|
|
15
15
|
export declare function CrudCard({ detailHref, onClick, ...rest }: CrudCardProps & {
|
|
16
16
|
detailHref?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CrudCardLink.d.ts","sourceRoot":"","sources":["../../../src/crud/components/CrudCardLink.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"CrudCardLink.d.ts","sourceRoot":"","sources":["../../../src/crud/components/CrudCardLink.tsx"],"names":[],"mappings":"AAGA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAOpD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,EACvB,UAAU,EACV,OAAO,EACP,GAAG,IAAI,EACR,EAAE,aAAa,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,sCAUzC;AAED,eAAe,QAAQ,CAAC"}
|