@donotdev/ui 0.3.4 → 0.3.5
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/cookie-consent/CookieConsent.d.ts.map +1 -1
- package/dist/components/cookie-consent/CookieConsent.js +1 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts +8 -1
- package/dist/components/layout/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/components/layout/components/Breadcrumbs.js +1 -1
- package/dist/crud/components/useRecordBreadcrumb.d.ts +1 -1
- package/dist/crud/components/useRecordBreadcrumb.d.ts.map +1 -1
- package/dist/dndev.css +591 -99
- package/dist/internal/common/DnDevErrorBoundary.d.ts +3 -1
- package/dist/internal/common/DnDevErrorBoundary.d.ts.map +1 -1
- package/dist/internal/common/DnDevErrorBoundary.js +1 -1
- package/dist/internal/devtools/DebugTools.d.ts.map +1 -1
- package/dist/internal/devtools/DebugTools.js +1 -1
- package/dist/internal/layout/components/AutoMetaTags.d.ts.map +1 -1
- package/dist/internal/layout/components/AutoMetaTags.js +1 -1
- package/dist/internal/providers/UIProviders.d.ts.map +1 -1
- package/dist/internal/providers/UIProviders.js +1 -1
- package/dist/routing/AuthGuard.d.ts +3 -0
- package/dist/routing/AuthGuard.d.ts.map +1 -1
- package/dist/routing/AuthGuard.js +1 -1
- package/dist/routing/hooks/hooks.next.d.ts +1 -1
- 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 +1 -1
- package/dist/routing/hooks/hooks.vite.d.ts.map +1 -1
- package/dist/routing/hooks/hooks.vite.js +1 -1
- package/dist/routing/hooks/types.d.ts +10 -0
- package/dist/routing/hooks/types.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.next.d.ts +9 -3
- package/dist/routing/hooks/useNavigate.next.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.next.js +1 -1
- package/dist/routing/hooks/useNavigate.vite.d.ts +9 -3
- package/dist/routing/hooks/useNavigate.vite.d.ts.map +1 -1
- package/dist/routing/hooks/useNavigate.vite.js +1 -1
- package/dist/routing/index.d.ts +1 -1
- package/dist/routing/index.d.ts.map +1 -1
- package/dist/routing/index.js +1 -1
- package/dist/routing/parentRoute.d.ts +7 -21
- package/dist/routing/parentRoute.d.ts.map +1 -1
- package/dist/routing/parentRoute.js +1 -1
- package/dist/styles/index.css +591 -99
- package/dist/symbol-index.json +1 -1
- package/guidelines/COMPONENTS.md +1 -1
- package/guidelines/LAYOUTS.md +2 -0
- package/guidelines/PAGES.md +3 -0
- package/guidelines/ROUTING.md +41 -0
- package/guidelines/SEO.md +5 -5
- package/package.json +5 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CookieConsent.d.ts","sourceRoot":"","sources":["../../../src/components/cookie-consent/CookieConsent.tsx"],"names":[],"mappings":"AA8BA,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,iBAAS,aAAa,CAAC,EACrB,QAAmB,EACnB,SAAc,GACf,EAAE,kBAAkB,
|
|
1
|
+
{"version":3,"file":"CookieConsent.d.ts","sourceRoot":"","sources":["../../../src/components/cookie-consent/CookieConsent.tsx"],"names":[],"mappings":"AA8BA,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,qDAAqD;IACrD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAID,iBAAS,aAAa,CAAC,EACrB,QAAmB,EACnB,SAAc,GACf,EAAE,kBAAkB,sCA+UpB;AAED,eAAe,aAAa,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Cookie as w,Settings as W,Shield as G,BarChart3 as K,Target as V}from"lucide-react";import{useState as v,useEffect as y,useRef as q}from"react";import{Accordion as X,Button as m,BUTTON_VARIANT as f,Card as $,Switch as J,Text as u,cn as Q,Stack as s}from"@donotdev/components";import{handleError as Z,useConsent as d,getCookieExamples as S,hasOptionalCookies as ee}from"@donotdev/core";import{CONSENT_CATEGORY as r}from"@donotdev/core";import{useTranslation as te}from"@donotdev/core";import{isClient as ne}from"@donotdev/core";import{Fragment as se,jsx as n,jsxs as a}from"react/jsx-runtime";var oe=480;function ie({position:N="bottom",className:O=""}){let p=d("hasConsented"),g=d("categories"),D=d("acceptAll"),B=d("declineAll"),I=d("updateCategory"),k=d("showBanner"),{t:e}=te("cookies"),[C,E]=v(!1),[h,l]=v(!p||k),[A,b]=v(g),T=q(null),[L,P]=v(!1);y(()=>P(!0),[]),y(()=>{k&&l(!0)},[k]);let R=Object.keys(g),U=[{id:r.NECESSARY,icon:G,title:e("essentialCookies"),description:e("essentialDescription"),examples:S("necessary")||e("essentialExamples"),locked:!0},{id:r.FUNCTIONAL,icon:w,title:e("functionalCookies"),description:e("functionalDescription"),examples:S("functional")||e("functionalExamples"),legalNotice:e("functionalLegalNotice"),locked:!1},{id:r.ANALYTICS,icon:K,title:e("analyticsCookies"),description:e("analyticsDescription"),examples:S("analytics")||e("analyticsExamples"),locked:!1},{id:r.MARKETING,icon:V,title:e("marketingCookies"),description:e("marketingDescription"),examples:S("marketing")||e("marketingExamples"),locked:!1}].filter(t=>R.includes(t.id)),x=ee(),c=!x;if(y(()=>{let t={...g};if(C){let o=t;Object.keys(o).forEach(i=>{i!==r.NECESSARY&&o[i]===!1&&(o[i]=!0)})}b(t)},[g,C]),y(()=>{if(!ne()||p||!h||c)return;let t=i=>{T.current&&!T.current.contains(i.target)&&l(!1)},o=setTimeout(()=>{document.addEventListener("mousedown",t)},100);return()=>{clearTimeout(o),document.removeEventListener("mousedown",t)}},[p,h,c]),!L||p&&!k)return null;let M=()=>{try{Object.entries(A).forEach(([t,o])=>{if(t!==r.NECESSARY&&o!==void 0){let i=t;Object.values(r).includes(i)&&I(i,!!o)}}),E(!1),l(!1)}catch(t){Z(t,{userMessage:"Error saving preferences",context:{operation:"save_preferences"},severity:"warning",log:!0,reportToSentry:!1,showNotification:!1})}},z=()=>{D(),l(!1)},H=()=>{B(),l(!1)},Y=a(s,{gap:"medium",children:[n(u,{as:"p",variant:"muted",level:"small",style:{lineHeight:1.55},children:e(c?"necessaryOnlyDescription":"cookieBannerDescription")}),x&&n(X,{type:"single",collapsible:!0,value:C?"preferences":"",onValueChange:t=>E(t==="preferences"),items:[{value:"preferences",trigger:a(s,{direction:"row",align:"center",gap:"tight",children:[n(W,{className:"dndev-size-sm"}),n(u,{as:"span",level:"small",weight:"medium",children:e("customize")})]}),content:n(s,{gap:"tight",children:U.map(t=>{let o=t.icon,i=A[t.id]??!1;return a(s,{direction:"row",align:"start",justify:"between",gap:"medium",style:{padding:"0.75rem",borderRadius:"var(--radius-surface, 0.5rem)",background:"var(--muted)"},children:[a(s,{direction:"row",align:"start",gap:"tight",style:{flex:1,minWidth:0},children:[n(o,{className:"dndev-size-sm",style:{color:"var(--primary)",marginTop:"0.15rem",flexShrink:0}}),a(s,{gap:"none",style:{minWidth:0},children:[n(u,{as:"span",level:"small",weight:"semibold",children:t.title}),n(u,{as:"span",variant:"muted",level:"caption",style:{lineHeight:1.45},children:t.description})]})]}),t.locked?n(u,{as:"span",variant:"muted",level:"caption",weight:"medium",style:{flexShrink:0},children:e("alwaysOn")}):n(J,{checked:i,onCheckedChange:F=>b(_=>({..._,[t.id]:F}))})]},t.id)})})}]})]}),j=C?a(s,{direction:"row",gap:"tight",style:{width:"100%"},children:[n(m,{onClick:()=>E(!1),variant:f.OUTLINE,style:{flex:1},children:e("form.cancel","Cancel")}),n(m,{onClick:M,variant:f.DEFAULT,style:{flex:1},children:e("savePreferences","Save Preferences")})]}):a(s,{direction:"row",gap:"tight",style:{width:"100%"},children:[x&&n(m,{onClick:H,variant:f.OUTLINE,style:{flex:1},children:e("declineOptional")}),n(m,{onClick:z,variant:f.DEFAULT,style:{flex:1},children:e(c?"acknowledge":"acceptAll")})]});return a(se,{children:[h&&n($,{ref:T,elevated:!0,icon:w,title:e(c?"necessaryOnlyTitle":"cookiePreferences"),content:Y,footer:j,className:Q("dndev-fixed dndev-z-modal",O),style:{[N==="top"?"top":"bottom"]:"var(--gap-md)",insetInlineStart:"var(--gap-md)",width:`min(${oe}px, calc(100vw - var(--gap-md) * 2))`,height:"auto"}}),!h&&!p&&!c&&n(m,{onClick:()=>l(!0),variant:f.OUTLINE,
|
|
1
|
+
"use client";import{Cookie as w,Settings as W,Shield as G,BarChart3 as K,Target as V}from"lucide-react";import{useState as v,useEffect as y,useRef as q}from"react";import{Accordion as X,Button as m,BUTTON_VARIANT as f,Card as $,Switch as J,Text as u,cn as Q,Stack as s}from"@donotdev/components";import{handleError as Z,useConsent as d,getCookieExamples as S,hasOptionalCookies as ee}from"@donotdev/core";import{CONSENT_CATEGORY as r}from"@donotdev/core";import{useTranslation as te}from"@donotdev/core";import{isClient as ne}from"@donotdev/core";import{Fragment as se,jsx as n,jsxs as a}from"react/jsx-runtime";var oe=480;function ie({position:N="bottom",className:O=""}){let p=d("hasConsented"),g=d("categories"),D=d("acceptAll"),B=d("declineAll"),I=d("updateCategory"),k=d("showBanner"),{t:e}=te("cookies"),[C,E]=v(!1),[h,l]=v(!p||k),[A,b]=v(g),T=q(null),[L,P]=v(!1);y(()=>P(!0),[]),y(()=>{k&&l(!0)},[k]);let R=Object.keys(g),U=[{id:r.NECESSARY,icon:G,title:e("essentialCookies"),description:e("essentialDescription"),examples:S("necessary")||e("essentialExamples"),locked:!0},{id:r.FUNCTIONAL,icon:w,title:e("functionalCookies"),description:e("functionalDescription"),examples:S("functional")||e("functionalExamples"),legalNotice:e("functionalLegalNotice"),locked:!1},{id:r.ANALYTICS,icon:K,title:e("analyticsCookies"),description:e("analyticsDescription"),examples:S("analytics")||e("analyticsExamples"),locked:!1},{id:r.MARKETING,icon:V,title:e("marketingCookies"),description:e("marketingDescription"),examples:S("marketing")||e("marketingExamples"),locked:!1}].filter(t=>R.includes(t.id)),x=ee(),c=!x;if(y(()=>{let t={...g};if(C){let o=t;Object.keys(o).forEach(i=>{i!==r.NECESSARY&&o[i]===!1&&(o[i]=!0)})}b(t)},[g,C]),y(()=>{if(!ne()||p||!h||c)return;let t=i=>{T.current&&!T.current.contains(i.target)&&l(!1)},o=setTimeout(()=>{document.addEventListener("mousedown",t)},100);return()=>{clearTimeout(o),document.removeEventListener("mousedown",t)}},[p,h,c]),!L||p&&!k)return null;let M=()=>{try{Object.entries(A).forEach(([t,o])=>{if(t!==r.NECESSARY&&o!==void 0){let i=t;Object.values(r).includes(i)&&I(i,!!o)}}),E(!1),l(!1)}catch(t){Z(t,{userMessage:"Error saving preferences",context:{operation:"save_preferences"},severity:"warning",log:!0,reportToSentry:!1,showNotification:!1})}},z=()=>{D(),l(!1)},H=()=>{B(),l(!1)},Y=a(s,{gap:"medium",children:[n(u,{as:"p",variant:"muted",level:"small",style:{lineHeight:1.55},children:e(c?"necessaryOnlyDescription":"cookieBannerDescription")}),x&&n(X,{type:"single",collapsible:!0,value:C?"preferences":"",onValueChange:t=>E(t==="preferences"),items:[{value:"preferences",trigger:a(s,{direction:"row",align:"center",gap:"tight",children:[n(W,{className:"dndev-size-sm"}),n(u,{as:"span",level:"small",weight:"medium",children:e("customize")})]}),content:n(s,{gap:"tight",children:U.map(t=>{let o=t.icon,i=A[t.id]??!1;return a(s,{direction:"row",align:"start",justify:"between",gap:"medium",style:{padding:"0.75rem",borderRadius:"var(--radius-surface, 0.5rem)",background:"var(--muted)"},children:[a(s,{direction:"row",align:"start",gap:"tight",style:{flex:1,minWidth:0},children:[n(o,{className:"dndev-size-sm",style:{color:"var(--primary)",marginTop:"0.15rem",flexShrink:0}}),a(s,{gap:"none",style:{minWidth:0},children:[n(u,{as:"span",level:"small",weight:"semibold",children:t.title}),n(u,{as:"span",variant:"muted",level:"caption",style:{lineHeight:1.45},children:t.description})]})]}),t.locked?n(u,{as:"span",variant:"muted",level:"caption",weight:"medium",style:{flexShrink:0},children:e("alwaysOn")}):n(J,{checked:i,onCheckedChange:F=>b(_=>({..._,[t.id]:F}))})]},t.id)})})}]})]}),j=C?a(s,{direction:"row",gap:"tight",style:{width:"100%"},children:[n(m,{onClick:()=>E(!1),variant:f.OUTLINE,style:{flex:1},children:e("form.cancel","Cancel")}),n(m,{onClick:M,variant:f.DEFAULT,style:{flex:1},children:e("savePreferences","Save Preferences")})]}):a(s,{direction:"row",gap:"tight",style:{width:"100%"},children:[x&&n(m,{onClick:H,variant:f.OUTLINE,style:{flex:1},children:e("declineOptional")}),n(m,{onClick:z,variant:f.DEFAULT,style:{flex:1},children:e(c?"acknowledge":"acceptAll")})]});return a(se,{children:[h&&n($,{ref:T,elevated:!0,icon:w,title:e(c?"necessaryOnlyTitle":"cookiePreferences"),content:Y,footer:j,className:Q("dndev-fixed dndev-z-modal",O),style:{[N==="top"?"top":"bottom"]:"var(--gap-md)",insetInlineStart:"var(--gap-md)",width:`min(${oe}px, calc(100vw - var(--gap-md) * 2))`,height:"auto"}}),!h&&!p&&!c&&n(m,{onClick:()=>l(!0),variant:f.OUTLINE,icon:w,display:"compact",tooltip:e("cookiePreferences"),"aria-label":e("cookiePreferences"),className:"dndev-fixed dndev-z-toast",style:{[N==="top"?"top":"bottom"]:"var(--gap-md)",insetInlineStart:"var(--gap-md)"}})]})}var fe=ie;export{fe as default};
|
|
@@ -32,7 +32,14 @@ export interface BreadcrumbsProps {
|
|
|
32
32
|
* @author AMBROISE PARK Consulting
|
|
33
33
|
*
|
|
34
34
|
* Automatically generates breadcrumbs from current route or accepts custom items.
|
|
35
|
-
*
|
|
35
|
+
* Generated trail: home, the page's ancestors (`routeAncestors`, the chain of the
|
|
36
|
+
* BreadcrumbList JSON-LD and the forms' parent path), linked, then the page, each named by
|
|
37
|
+
* its route's title (`routeLabel`: `seo.title`, else `<namespace>:title`, as its
|
|
38
|
+
* `<title>`); the page reads as the shown record's name (`useRecordBreadcrumb`) when its
|
|
39
|
+
* last URL segment names it. A URL prefix that is no route is no crumb. Routes are the
|
|
40
|
+
* build's route manifest (not auth-filtered): the server render and the browser build the
|
|
41
|
+
* same trail. Renders no generated trail inside a NotFoundDocument (the 404, served for
|
|
42
|
+
* any URL).
|
|
36
43
|
*/
|
|
37
44
|
declare const Breadcrumbs: ComponentType<BreadcrumbsProps>;
|
|
38
45
|
export default Breadcrumbs;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/components/Breadcrumbs.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Breadcrumbs.d.ts","sourceRoot":"","sources":["../../../../src/components/layout/components/Breadcrumbs.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AA6B3C,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;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,WAAW,EAAE,aAAa,CAAC,gBAAgB,CA+FhD,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{ChevronRight as
|
|
1
|
+
"use client";import{ChevronRight as y}from"lucide-react";import{useMemo as L}from"react";import{cn as R}from"@donotdev/components";import{breadcrumbNamespaces as T,getRoutes as k,matchRoute as A,routeAncestors as D,routeLabel as f,useAppConfig as F,useLayout as H,useSeoConfig as P,useTranslation as S}from"@donotdev/core";import{useRoutePath as z}from"@donotdev/ui/routing/hooks";import{Link as M}from"../../../routing/Link.js";import{useIsNotFoundDocument as w}from"../../../routing/NotFoundDocument.js";import{jsx as o,jsxs as x}from"react/jsx-runtime";function U(t){try{return decodeURIComponent(t)}catch{return t}}var q=({items:t,separator:g=y,showHome:h=!0,homeHref:N="/",variant:v="default",className:B})=>{let a=z(),n=k(),C=L(()=>T(a,n),[a,n]),{t:u}=S(["dndev",...C]),s=P(),I=F("app"),c=H("routeRecordLabel");if(w()&&!t)return null;let i=t||(()=>{let e={t:u,defaultNs:s&&s.defaultNamespace||"home",siteName:s&&s.siteName||I?.name||""},r=D(a,n).map(b=>({label:f(b,e),href:b.path})),l=A(n,a)?.route,m=a.split("/").filter(Boolean).at(-1),d=c&&m&&U(m)===c.id?c.label:l?f(l,e):void 0;return d&&r.push({label:d}),r})(),p=h?[{label:u("navigation.home","Home"),href:N},...i]:i;return v==="smart"&&a.split("/").filter(Boolean).length<2?null:o("nav",{role:"navigation","aria-label":"Breadcrumb navigation",className:R("breadcrumbs",B),children:p.map((e,r)=>{let m=r===p.length-1||!e.href;return x("span",{className:"breadcrumb-item",children:[r>0&&o(g,{className:"dndev-size-md separator"}),e.icon&&o(e.icon,{className:"dndev-size-md icon"}),e.href&&!m?o(M,{path:e.href,className:"breadcrumb-link",children:e.label}):o("span",{className:"breadcrumb-label",children:e.label})]},r)})})},X=q;export{X as default};
|
|
@@ -4,7 +4,7 @@ import type { AnyEntity } from '@donotdev/core';
|
|
|
4
4
|
* the card (the same title `deriveEntitySeo` gives the entity page's metadata and the last
|
|
5
5
|
* BreadcrumbList item), on the segment naming the record ({@link recordSegment}: its slug
|
|
6
6
|
* on `/produits/:slug`, its id on `/products/:id`). Cleared when the page unmounts or the record
|
|
7
|
-
* has no title, unless another component replaced it meanwhile (its label stays). Client effect: the server render
|
|
7
|
+
* has no title, unless another component replaced it meanwhile (its label stays). Client effect: the server render names the page by its route title (`routeLabel`).
|
|
8
8
|
*
|
|
9
9
|
* @param entity - Entity of the record
|
|
10
10
|
* @param record - Loaded record (`undefined` / `null` while loading)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRecordBreadcrumb.d.ts","sourceRoot":"","sources":["../../../src/crud/components/useRecordBreadcrumb.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useRecordBreadcrumb.d.ts","sourceRoot":"","sources":["../../../src/crud/components/useRecordBreadcrumb.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAoChD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,GACjD,IAAI,CAuBN"}
|