@patterninc/pattern-ui 0.0.0-main.202611050447.20eee6ff23dc → 0.0.0-main.202611050504.c31d6bfb5e4c

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.
@@ -1,4 +1,4 @@
1
- import{a as e}from"../../../_chunks/rolldown-runtime-BWaJ3C7D.js";import{t}from"../../../_chunks/react-CUaU2Z9V.js";import{t as n}from"../../../_chunks/compiler-runtime-B3BlmaWz.js";import{t as r}from"../../../_chunks/jsx-runtime-Dgn0yPdi.js";import{t as i}from"../../../_chunks/dist-BNSTMZct.js";import{t as ee}from"../../../_chunks/FileFavicon-xvov3R-9.js";import{t as te}from"../../../_chunks/Button-C1osBFEU.js";import{i as a}from"../../../_chunks/dist-BRMXKypj.js";import{t as o}from"../../../_chunks/ButtonInset-Dz2ZlrCm.js";import{u as s}from"../../../_chunks/dist-CPlSvWC_.js";import{t as c}from"../../../_chunks/Divider-DsSqNbiK.js";import{t as ne}from"../../../_chunks/ChevronDownIcon-D7DkVAiv.js";import{t as re}from"../../../_chunks/ChevronUpIcon-BP7uAoxk.js";import{t as ie}from"../../../_chunks/CheckmarkIcon-D7Um35Ej.js";import{t as l}from"../../../_chunks/CopyIcon-D-81sk8F.js";import{n as u,t as d}from"../../../_chunks/prism-D9VGK0GA.js";import{t as f}from"../../../_chunks/Block-jIQV8pec.js";import{t as p}from"../../../_chunks/DownloadIcon-IBxOELNe.js";import{a as m,i as h,n as ae,r as g}from"../../../_chunks/textBlockContent-DXP-vU2-.js";var _=n(),v=/* @__PURE__ */ e(t(),1),y=/* @__PURE__ */ e(r(),1),b=d();const x={text:`plain`,env:`plain`,code:`viewer`,log:`viewer`},oe={plain:288,viewer:320},se={text:`text/plain`,env:`text/plain`,code:`text/plain`,log:`text/plain`},S={margin:0,padding:0,background:`transparent`,fontFamily:`inherit`,fontSize:`inherit`,lineHeight:`inherit`,overflow:`visible`},ce={style:{fontFamily:`inherit`}};function le(e){let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()}function C(){return document.documentElement.classList.contains(`dark`)?`dark`:`light`}function w(){return(0,v.useSyncExternalStore)(le,C,ue)}function ue(){return`light`}function de(e,t,n){let r=URL.createObjectURL(new Blob([e],{type:n})),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}function T(e){let t=(0,_.c)(141),{content:n,variant:r,filename:d,label:le,language:C,maxHeight:ue,defaultExpanded:T,streaming:D,className:O,qaTestId:k}=e,A=r===void 0?`text`:r,j=T!==void 0&&T,M=D!==void 0&&D,N=k===void 0?`text-block`:k,{_:P}=a(),F=w(),I=(0,v.useId)(),[L,pe]=(0,v.useState)(!1),[R,me]=(0,v.useState)(j),[he,ge]=(0,v.useState)(!1),z;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>pe(!1),t[0]=z):z=t[0],s(z,L?2e3:null);let B=x[A],V;t[1]!==n||t[2]!==A?(V=A===`env`?g(n):n,t[1]=n,t[2]=A,t[3]=V):V=t[3];let H=V,U,W,G,K,q,J;if(t[4]!==P||t[5]!==I||t[6]!==O||t[7]!==L||t[8]!==R||t[9]!==d||t[10]!==B||t[11]!==le||t[12]!==C||t[13]!==ue||t[14]!==he||t[15]!==N||t[16]!==H||t[17]!==M||t[18]!==A){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ae(H);W=ue??oe[B],G=W!==`none`;let n;t[25]===P?n=t[26]:(n=P({id:`xeiujy`}),t[25]=P,t[26]=n);let r;t[27]===P?r=t[28]:(r=P({id:`AVlZoM`}),t[27]=P,t[28]=r);let a;t[29]!==P||t[30]!==C?(a=C??P({id:`EWPtMO`}),t[29]=P,t[30]=C,t[31]=a):a=t[31];let s;t[32]===P?s=t[33]:(s=P({id:`FOw3tu`}),t[32]=P,t[33]=s);let c;t[34]!==a||t[35]!==s||t[36]!==n||t[37]!==r?(c={text:n,env:r,code:a,log:s},t[34]=a,t[35]=s,t[36]=n,t[37]=r,t[38]=c):c=t[38],q=d??le??c[A];let u=P({id:`zGviei`,values:{lineCount:e}}),h;t[39]!==d||t[40]!==C||t[41]!==A?(h=m({filename:d,variant:A,language:C}),t[39]=d,t[40]=C,t[41]=A,t[42]=h):h=t[42];let g=h,_;t[43]===H?_=t[44]:(_=async()=>{try{await navigator.clipboard.writeText(H),pe(!0)}catch(e){console.error(`Failed to copy text:`,e)}},t[43]=H,t[44]=_);let v=_,b;t[45]!==R||t[46]!==B||t[47]!==G?(b=e=>{if(!e||B!==`plain`||!G||R||typeof ResizeObserver>`u`)return;let t=()=>ge(e.scrollHeight>e.clientHeight+1);t();let n=new ResizeObserver(t);return n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild),()=>n.disconnect()},t[45]=R,t[46]=B,t[47]=G,t[48]=b):b=t[48];let x=b,S;t[49]!==P||t[50]!==d||t[51]!==N||t[52]!==H||t[53]!==M||t[54]!==A?(S=d?/* @__PURE__ */ (0,y.jsx)(o,{variant:`inverse`,icon:p,"aria-label":P({id:`qnTwse`,values:{filename:d}}),disabled:M,onClick:()=>de(H,d,se[A]),qaTestId:`${N}-download`}):null,t[49]=P,t[50]=d,t[51]=N,t[52]=H,t[53]=M,t[54]=A,t[55]=S):S=t[55];let ce=L?ie:l,w;t[56]!==P||t[57]!==L?(w=P(L?{id:`6V3Ea3`}:{id:`VsHxv-`}),t[56]=P,t[57]=L,t[58]=w):w=t[58];let T=`${N}-copy`,E;t[59]!==v||t[60]!==M||t[61]!==ce||t[62]!==w||t[63]!==T?(E=/* @__PURE__ */ (0,y.jsx)(o,{variant:`inverse`,icon:ce,"aria-label":w,disabled:M,onClick:v,qaTestId:T}),t[59]=v,t[60]=M,t[61]=ce,t[62]=w,t[63]=T,t[64]=E):E=t[64];let D;t[65]!==P||t[66]!==L?(D=L?P({id:`FxVG_l`}):``,t[65]=P,t[66]=L,t[67]=D):D=t[67];let k;t[68]===D?k=t[69]:(k=/* @__PURE__ */ (0,y.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:D}),t[68]=D,t[69]=k);let j;t[70]!==S||t[71]!==E||t[72]!==k?(j=/* @__PURE__ */ (0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[S,E,k]}),t[70]=S,t[71]=E,t[72]=k,t[73]=j):j=t[73],U=j;let F=`${N}-favicon`,z;t[74]!==g.label||t[75]!==g.type||t[76]!==F?(z=/* @__PURE__ */ (0,y.jsx)(ee,{type:g.type,label:g.label,"aria-hidden":!0,qaTestId:F}),t[74]=g.label,t[75]=g.type,t[76]=F,t[77]=z):z=t[77];let V;if(t[78]===q?V=t[79]:(V=/* @__PURE__ */ (0,y.jsx)(`span`,{className:`pui-text-body-medium-compact truncate text-text-sub`,children:q}),t[78]=q,t[79]=V),J=/* @__PURE__ */ (0,y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[z,V,/* @__PURE__ */ (0,y.jsxs)(`span`,{className:`pui-text-body-medium-compact shrink-0 text-text-soft`,children:[`· `,u]})]}),B===`plain`){let n=G&&(R||he),r=G&&!R,ee=M||void 0,a;t[80]===O?a=t[81]:(a=i(`w-full`,O),t[80]=O,t[81]=a);let o=`${N}-header`,s;t[82]!==U||t[83]!==o||t[84]!==J?(s=/* @__PURE__ */ (0,y.jsxs)(f.Header,{qaTestId:o,children:[J,U]}),t[82]=U,t[83]=o,t[84]=J,t[85]=s):s=t[85];let c=n&&`pb-3`,ie=r&&`overflow-hidden`,l=r&&he&&`mask-b-from-70%`,u;t[86]!==c||t[87]!==ie||t[88]!==l?(u=i(`pt-3`,c,ie,l),t[86]=c,t[87]=ie,t[88]=l,t[89]=u):u=t[89];let d;t[90]!==W||t[91]!==r?(d=r?{maxHeight:W}:void 0,t[90]=W,t[91]=r,t[92]=d):d=t[92];let p=`${N}-body`,m;t[93]===H?m=t[94]:(m=/* @__PURE__ */ (0,y.jsx)(`pre`,{className:`pui-text-mono-small-loose m-0 wrap-break-word whitespace-pre-wrap text-text-sub`,children:H}),t[93]=H,t[94]=m);let h;t[95]!==I||t[96]!==x||t[97]!==u||t[98]!==d||t[99]!==p||t[100]!==m?(h=/* @__PURE__ */ (0,y.jsx)(f.Content,{id:I,ref:x,className:u,style:d,qaTestId:p,children:m}),t[95]=I,t[96]=x,t[97]=u,t[98]=d,t[99]=p,t[100]=m,t[101]=h):h=t[101];let ae=n?/* @__PURE__ */ (0,y.jsx)(f.Footer,{children:/* @__PURE__ */ (0,y.jsx)(te,{variant:`inverse`,size:`small`,className:`-ml-1.5 aria-expanded:not-hover:not-focus:bg-depth-black-0`,prefix:{icon:R?re:ne},"aria-expanded":R,"aria-controls":I,onClick:()=>me(fe),qaTestId:`${N}-toggle`,children:P(R?{id:`6lGV3K`}:{id:`Zicnt-`,values:{lineCount:e}})})}):null,g;t[102]!==N||t[103]!==ee||t[104]!==a||t[105]!==s||t[106]!==h||t[107]!==ae||t[108]!==q?(g=/* @__PURE__ */ (0,y.jsxs)(f,{as:`section`,variant:`weak`,density:`small`,sectioned:!0,"aria-label":q,"aria-busy":ee,className:a,qaTestId:N,children:[s,h,ae]}),t[102]=N,t[103]=ee,t[104]=a,t[105]=s,t[106]=h,t[107]=ae,t[108]=q,t[109]=g):g=t[109],K=g;break bb0}}t[4]=P,t[5]=I,t[6]=O,t[7]=L,t[8]=R,t[9]=d,t[10]=B,t[11]=le,t[12]=C,t[13]=ue,t[14]=he,t[15]=N,t[16]=H,t[17]=M,t[18]=A,t[19]=U,t[20]=W,t[21]=G,t[22]=K,t[23]=q,t[24]=J}else U=t[19],W=t[20],G=t[21],K=t[22],q=t[23],J=t[24];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let _e;if(t[110]!==n||t[111]!==C||t[112]!==F||t[113]!==A){let e=h(n);_e=/* @__PURE__ */ (0,y.jsxs)(`div`,{className:`pui-text-mono-small-loose flex w-max min-w-full py-3`,children:[/* @__PURE__ */ (0,y.jsx)(`div`,{"aria-hidden":!0,className:`shrink-0 pr-4 pl-4 text-right whitespace-pre text-text-disabled select-none`,children:e.map(E).join(`
1
+ import{a as e}from"../../../_chunks/rolldown-runtime-BWaJ3C7D.js";import{t}from"../../../_chunks/react-CUaU2Z9V.js";import{t as n}from"../../../_chunks/compiler-runtime-B3BlmaWz.js";import{t as r}from"../../../_chunks/jsx-runtime-Dgn0yPdi.js";import{t as i}from"../../../_chunks/dist-BNSTMZct.js";import{t as ee}from"../../../_chunks/FileFavicon-xvov3R-9.js";import{t as te}from"../../../_chunks/Button-C1osBFEU.js";import{i as a}from"../../../_chunks/dist-BRMXKypj.js";import{t as o}from"../../../_chunks/ButtonInset-Dz2ZlrCm.js";import{u as s}from"../../../_chunks/dist-CPlSvWC_.js";import{t as c}from"../../../_chunks/Divider-DsSqNbiK.js";import{t as ne}from"../../../_chunks/ChevronDownIcon-D7DkVAiv.js";import{t as re}from"../../../_chunks/ChevronUpIcon-BP7uAoxk.js";import{t as ie}from"../../../_chunks/CheckmarkIcon-D7Um35Ej.js";import{t as l}from"../../../_chunks/CopyIcon-D-81sk8F.js";import{n as u,t as d}from"../../../_chunks/prism-D9VGK0GA.js";import{t as f}from"../../../_chunks/Block-Dd32-trE.js";import{t as p}from"../../../_chunks/DownloadIcon-IBxOELNe.js";import{a as m,i as h,n as ae,r as g}from"../../../_chunks/textBlockContent-DXP-vU2-.js";var _=n(),v=/* @__PURE__ */ e(t(),1),y=/* @__PURE__ */ e(r(),1),b=d();const x={text:`plain`,env:`plain`,code:`viewer`,log:`viewer`},oe={plain:288,viewer:320},se={text:`text/plain`,env:`text/plain`,code:`text/plain`,log:`text/plain`},S={margin:0,padding:0,background:`transparent`,fontFamily:`inherit`,fontSize:`inherit`,lineHeight:`inherit`,overflow:`visible`},ce={style:{fontFamily:`inherit`}};function le(e){let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()}function C(){return document.documentElement.classList.contains(`dark`)?`dark`:`light`}function w(){return(0,v.useSyncExternalStore)(le,C,ue)}function ue(){return`light`}function de(e,t,n){let r=URL.createObjectURL(new Blob([e],{type:n})),i=document.createElement(`a`);i.href=r,i.download=t,i.click(),URL.revokeObjectURL(r)}function T(e){let t=(0,_.c)(141),{content:n,variant:r,filename:d,label:le,language:C,maxHeight:ue,defaultExpanded:T,streaming:D,className:O,qaTestId:k}=e,A=r===void 0?`text`:r,j=T!==void 0&&T,M=D!==void 0&&D,N=k===void 0?`text-block`:k,{_:P}=a(),F=w(),I=(0,v.useId)(),[L,pe]=(0,v.useState)(!1),[R,me]=(0,v.useState)(j),[he,ge]=(0,v.useState)(!1),z;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(z=()=>pe(!1),t[0]=z):z=t[0],s(z,L?2e3:null);let B=x[A],V;t[1]!==n||t[2]!==A?(V=A===`env`?g(n):n,t[1]=n,t[2]=A,t[3]=V):V=t[3];let H=V,U,W,G,K,q,J;if(t[4]!==P||t[5]!==I||t[6]!==O||t[7]!==L||t[8]!==R||t[9]!==d||t[10]!==B||t[11]!==le||t[12]!==C||t[13]!==ue||t[14]!==he||t[15]!==N||t[16]!==H||t[17]!==M||t[18]!==A){K=Symbol.for(`react.early_return_sentinel`);bb0:{let e=ae(H);W=ue??oe[B],G=W!==`none`;let n;t[25]===P?n=t[26]:(n=P({id:`xeiujy`}),t[25]=P,t[26]=n);let r;t[27]===P?r=t[28]:(r=P({id:`AVlZoM`}),t[27]=P,t[28]=r);let a;t[29]!==P||t[30]!==C?(a=C??P({id:`EWPtMO`}),t[29]=P,t[30]=C,t[31]=a):a=t[31];let s;t[32]===P?s=t[33]:(s=P({id:`FOw3tu`}),t[32]=P,t[33]=s);let c;t[34]!==a||t[35]!==s||t[36]!==n||t[37]!==r?(c={text:n,env:r,code:a,log:s},t[34]=a,t[35]=s,t[36]=n,t[37]=r,t[38]=c):c=t[38],q=d??le??c[A];let u=P({id:`zGviei`,values:{lineCount:e}}),h;t[39]!==d||t[40]!==C||t[41]!==A?(h=m({filename:d,variant:A,language:C}),t[39]=d,t[40]=C,t[41]=A,t[42]=h):h=t[42];let g=h,_;t[43]===H?_=t[44]:(_=async()=>{try{await navigator.clipboard.writeText(H),pe(!0)}catch(e){console.error(`Failed to copy text:`,e)}},t[43]=H,t[44]=_);let v=_,b;t[45]!==R||t[46]!==B||t[47]!==G?(b=e=>{if(!e||B!==`plain`||!G||R||typeof ResizeObserver>`u`)return;let t=()=>ge(e.scrollHeight>e.clientHeight+1);t();let n=new ResizeObserver(t);return n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild),()=>n.disconnect()},t[45]=R,t[46]=B,t[47]=G,t[48]=b):b=t[48];let x=b,S;t[49]!==P||t[50]!==d||t[51]!==N||t[52]!==H||t[53]!==M||t[54]!==A?(S=d?/* @__PURE__ */ (0,y.jsx)(o,{variant:`inverse`,icon:p,"aria-label":P({id:`qnTwse`,values:{filename:d}}),disabled:M,onClick:()=>de(H,d,se[A]),qaTestId:`${N}-download`}):null,t[49]=P,t[50]=d,t[51]=N,t[52]=H,t[53]=M,t[54]=A,t[55]=S):S=t[55];let ce=L?ie:l,w;t[56]!==P||t[57]!==L?(w=P(L?{id:`6V3Ea3`}:{id:`VsHxv-`}),t[56]=P,t[57]=L,t[58]=w):w=t[58];let T=`${N}-copy`,E;t[59]!==v||t[60]!==M||t[61]!==ce||t[62]!==w||t[63]!==T?(E=/* @__PURE__ */ (0,y.jsx)(o,{variant:`inverse`,icon:ce,"aria-label":w,disabled:M,onClick:v,qaTestId:T}),t[59]=v,t[60]=M,t[61]=ce,t[62]=w,t[63]=T,t[64]=E):E=t[64];let D;t[65]!==P||t[66]!==L?(D=L?P({id:`FxVG_l`}):``,t[65]=P,t[66]=L,t[67]=D):D=t[67];let k;t[68]===D?k=t[69]:(k=/* @__PURE__ */ (0,y.jsx)(`span`,{className:`sr-only`,"aria-live":`polite`,children:D}),t[68]=D,t[69]=k);let j;t[70]!==S||t[71]!==E||t[72]!==k?(j=/* @__PURE__ */ (0,y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[S,E,k]}),t[70]=S,t[71]=E,t[72]=k,t[73]=j):j=t[73],U=j;let F=`${N}-favicon`,z;t[74]!==g.label||t[75]!==g.type||t[76]!==F?(z=/* @__PURE__ */ (0,y.jsx)(ee,{type:g.type,label:g.label,"aria-hidden":!0,qaTestId:F}),t[74]=g.label,t[75]=g.type,t[76]=F,t[77]=z):z=t[77];let V;if(t[78]===q?V=t[79]:(V=/* @__PURE__ */ (0,y.jsx)(`span`,{className:`pui-text-body-medium-compact truncate text-text-sub`,children:q}),t[78]=q,t[79]=V),J=/* @__PURE__ */ (0,y.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[z,V,/* @__PURE__ */ (0,y.jsxs)(`span`,{className:`pui-text-body-medium-compact shrink-0 text-text-soft`,children:[`· `,u]})]}),B===`plain`){let n=G&&(R||he),r=G&&!R,ee=M||void 0,a;t[80]===O?a=t[81]:(a=i(`w-full`,O),t[80]=O,t[81]=a);let o=`${N}-header`,s;t[82]!==U||t[83]!==o||t[84]!==J?(s=/* @__PURE__ */ (0,y.jsxs)(f.Header,{qaTestId:o,children:[J,U]}),t[82]=U,t[83]=o,t[84]=J,t[85]=s):s=t[85];let c=n&&`pb-3`,ie=r&&`overflow-hidden`,l=r&&he&&`mask-b-from-70%`,u;t[86]!==c||t[87]!==ie||t[88]!==l?(u=i(`pt-3`,c,ie,l),t[86]=c,t[87]=ie,t[88]=l,t[89]=u):u=t[89];let d;t[90]!==W||t[91]!==r?(d=r?{maxHeight:W}:void 0,t[90]=W,t[91]=r,t[92]=d):d=t[92];let p=`${N}-body`,m;t[93]===H?m=t[94]:(m=/* @__PURE__ */ (0,y.jsx)(`pre`,{className:`pui-text-mono-small-loose m-0 wrap-break-word whitespace-pre-wrap text-text-sub`,children:H}),t[93]=H,t[94]=m);let h;t[95]!==I||t[96]!==x||t[97]!==u||t[98]!==d||t[99]!==p||t[100]!==m?(h=/* @__PURE__ */ (0,y.jsx)(f.Content,{id:I,ref:x,className:u,style:d,qaTestId:p,children:m}),t[95]=I,t[96]=x,t[97]=u,t[98]=d,t[99]=p,t[100]=m,t[101]=h):h=t[101];let ae=n?/* @__PURE__ */ (0,y.jsx)(f.Footer,{children:/* @__PURE__ */ (0,y.jsx)(te,{variant:`inverse`,size:`small`,className:`-ml-1.5 aria-expanded:not-hover:not-focus:bg-depth-black-0`,prefix:{icon:R?re:ne},"aria-expanded":R,"aria-controls":I,onClick:()=>me(fe),qaTestId:`${N}-toggle`,children:P(R?{id:`6lGV3K`}:{id:`Zicnt-`,values:{lineCount:e}})})}):null,g;t[102]!==N||t[103]!==ee||t[104]!==a||t[105]!==s||t[106]!==h||t[107]!==ae||t[108]!==q?(g=/* @__PURE__ */ (0,y.jsxs)(f,{as:`section`,variant:`weak`,density:`small`,sectioned:!0,"aria-label":q,"aria-busy":ee,className:a,qaTestId:N,children:[s,h,ae]}),t[102]=N,t[103]=ee,t[104]=a,t[105]=s,t[106]=h,t[107]=ae,t[108]=q,t[109]=g):g=t[109],K=g;break bb0}}t[4]=P,t[5]=I,t[6]=O,t[7]=L,t[8]=R,t[9]=d,t[10]=B,t[11]=le,t[12]=C,t[13]=ue,t[14]=he,t[15]=N,t[16]=H,t[17]=M,t[18]=A,t[19]=U,t[20]=W,t[21]=G,t[22]=K,t[23]=q,t[24]=J}else U=t[19],W=t[20],G=t[21],K=t[22],q=t[23],J=t[24];if(K!==Symbol.for(`react.early_return_sentinel`))return K;let _e;if(t[110]!==n||t[111]!==C||t[112]!==F||t[113]!==A){let e=h(n);_e=/* @__PURE__ */ (0,y.jsxs)(`div`,{className:`pui-text-mono-small-loose flex w-max min-w-full py-3`,children:[/* @__PURE__ */ (0,y.jsx)(`div`,{"aria-hidden":!0,className:`shrink-0 pr-4 pl-4 text-right whitespace-pre text-text-disabled select-none`,children:e.map(E).join(`
2
2
  `)}),A===`code`?/* @__PURE__ */ (0,y.jsx)(u,{language:C??`text`,style:F===`dark`?b.vscDarkPlus:b.prism,customStyle:S,codeTagProps:ce,className:`pr-4`,children:e.join(`
3
3
  `)}):/* @__PURE__ */ (0,y.jsx)(`pre`,{className:`m-0 pr-4 whitespace-pre text-text-sub`,children:e.join(`
4
4
  `)})]}),t[110]=n,t[111]=C,t[112]=F,t[113]=A,t[114]=_e}else _e=t[114];let ve=_e,ye=M||void 0,Y;t[115]===O?Y=t[116]:(Y=i(`w-full overflow-hidden`,O),t[115]=O,t[116]=Y);let be=`${N}-header`,X;t[117]!==U||t[118]!==be||t[119]!==J?(X=/* @__PURE__ */ (0,y.jsxs)(f.Header,{className:`min-h-10 py-2`,qaTestId:be,children:[J,U]}),t[117]=U,t[118]=be,t[119]=J,t[120]=X):X=t[120];let xe;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(xe=/* @__PURE__ */ (0,y.jsx)(c,{type:`line`}),t[121]=xe):xe=t[121];let Z;t[122]!==P||t[123]!==q?(Z=P({id:`m3w0qr`,values:{title:q}}),t[122]=P,t[123]=q,t[124]=Z):Z=t[124];let Q;t[125]!==W||t[126]!==G?(Q=G?{maxHeight:W}:void 0,t[125]=W,t[126]=G,t[127]=Q):Q=t[127];let Se=`${N}-body`,$;t[128]!==ve||t[129]!==I||t[130]!==Z||t[131]!==Q||t[132]!==Se?($=/* @__PURE__ */ (0,y.jsx)(`div`,{id:I,role:`region`,"aria-label":Z,tabIndex:0,className:`min-w-0 overflow-auto rounded-b-20 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-primary-base`,style:Q,"qa-test-id":Se,children:ve}),t[128]=ve,t[129]=I,t[130]=Z,t[131]=Q,t[132]=Se,t[133]=$):$=t[133];let Ce;return t[134]!==N||t[135]!==Y||t[136]!==X||t[137]!==$||t[138]!==ye||t[139]!==q?(Ce=/* @__PURE__ */ (0,y.jsxs)(f,{as:`section`,variant:`stroke`,density:`small`,sectioned:!0,"aria-label":q,"aria-busy":ye,className:Y,qaTestId:N,children:[X,xe,$]}),t[134]=N,t[135]=Y,t[136]=X,t[137]=$,t[138]=ye,t[139]=q,t[140]=Ce):Ce=t[140],Ce}function E(e,t){return t+1}function fe(e){return!e}export{T as TextBlock};
@@ -1 +1 @@
1
- export{t as Block,n as BlockContent,r as BlockContext,i as BlockFooter,a as BlockHeader,o as DENSITY_RADIUS_PX,s as contentInsetClasses,c as footerInsetClasses,l as gapClassFor,u as headerInsetClasses,d as useBlockContext}from"../../_chunks/Block-jIQV8pec.js";
1
+ export{t as Block,n as BlockContent,r as BlockContext,i as BlockFooter,a as BlockHeader,o as DENSITY_RADIUS_PX,s as contentInsetClasses,c as footerInsetClasses,l as gapClassFor,u as headerInsetClasses,d as useBlockContext}from"../../_chunks/Block-Dd32-trE.js";
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./react-CUaU2Z9V.js";import{t as n}from"./compiler-runtime-B3BlmaWz.js";import{t as r}from"./jsx-runtime-Dgn0yPdi.js";import{t as i}from"./dist-BNSTMZct.js";import{n as a}from"./react-B3hSlcN2.js";var o=n(),s=/* @__PURE__ */ e(t(),1),c=/* @__PURE__ */ e(r(),1);const l=s.createContext({density:`medium`,scopedSlots:!1});function u(){return s.useContext(l)}const d=/* @__PURE__ */ new Set([`section`,`article`,`aside`]);function f(e,t){typeof e==`function`?e(t):e&&(e.current=t)}function p(e,t){let n=(0,o.c)(5),[r,i]=s.useState(!!e),a;n[0]===t?a=n[1]:(a=e=>{e&&i(e.parentElement?.closest(`article, aside, main, nav, section`)!=null),f(t,e)},n[0]=t,n[1]=a);let c=a,l=r?void 0:`none`,u;return n[2]!==c||n[3]!==l?(u={role:l,ref:c},n[2]=c,n[3]=l,n[4]=u):u=n[4],u}const m={div:a.div,section:a.section,article:a.article,aside:a.aside,header:a.header,footer:a.footer},h={weak:`bg-depth-black-4`,stroke:`border-inner-depth-black-4`},g={small:`pl-4 pr-4 pt-4 pb-4`,medium:`pl-6 pr-6 pt-6 pb-6`,large:`pl-8 pr-8 pt-8 pb-8`},_={small:`px-4`,medium:`px-6`,large:`px-8`},v={small:`pt-4`,medium:`pt-6`,large:`pt-8`},y={small:`pb-4`,medium:`pb-6`,large:`pb-8`},b={small:20,medium:24,large:28},x={small:`rounded-20`,medium:`rounded-3xl`,large:`rounded-28`};function S(e){switch(e){case`none`:return`gap-0`;case`tight`:return`gap-1`;case`small`:return`gap-2`;case`snug`:return`gap-3`;case`medium`:return`gap-4`;case`large`:return`gap-6`;case`xlarge`:return`gap-8`;default:return e}}const C=`pui-text-label-medium-loose text-text-strong`,w=`pui-text-body-small-alt text-text-sub`;function T(e){return i(_[e],v[e])}function E(e){return i(_[e],y[e])}function D(e){return g[e]}function O({className:e,children:t,qaTestId:n=`block-header`,ref:r,...a}){let{density:o,scopedSlots:s}=u(),l=p(s,r);return/* @__PURE__ */ (0,c.jsx)(`header`,{ref:l.ref,role:l.role,className:i(`flex min-w-0 items-center justify-between gap-2`,C,T(o),e),"qa-test-id":n,...a,children:t})}function k(e){let t=(0,o.c)(13),n,r,a,s;t[0]===e?(n=t[1],r=t[2],a=t[3],s=t[4]):({className:r,children:n,qaTestId:s,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=s);let l=s===void 0?`block-content`:s,{density:d}=u(),f;t[5]!==r||t[6]!==d?(f=i(`min-w-0`,D(d),r),t[5]=r,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==n||t[9]!==a||t[10]!==l||t[11]!==f?(p=/* @__PURE__ */ (0,c.jsx)(`div`,{className:f,"qa-test-id":l,...a,children:n}),t[8]=n,t[9]=a,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function A({className:e,children:t,qaTestId:n=`block-footer`,ref:r,...a}){let{density:o,scopedSlots:s}=u(),l=p(s,r);return/* @__PURE__ */ (0,c.jsx)(`footer`,{ref:l.ref,role:l.role,className:i(w,`min-w-0`,E(o),e),"qa-test-id":n,...a,children:t})}function j({children:e,className:t,variant:n=`weak`,density:r=`medium`,gap:a=`none`,header:o,footer:s,headerClassName:u,contentClassName:f,footerClassName:_,sectioned:v=!1,style:y,as:b=`div`,qaTestId:O=`block`,...k}){let A=o!=null,j=s!=null,M=A||j,N=M||v?i(`flex min-h-0 min-w-0 flex-col`,S(a)):``,P=m[b],F=d.has(b),I=p(F),L=p(F);return/* @__PURE__ */ (0,c.jsx)(P,{className:i(h[n],x[r],N,`min-w-0`,t),style:y,"qa-test-id":O,...k,children:/* @__PURE__ */ (0,c.jsx)(l.Provider,{value:{density:r,scopedSlots:F},children:M?/* @__PURE__ */ (0,c.jsxs)(c.Fragment,{children:[A&&/* @__PURE__ */ (0,c.jsx)(`header`,{ref:I.ref,role:I.role,className:i(`flex min-w-0 shrink-0 items-center justify-between gap-2`,C,T(r),u),children:o}),/* @__PURE__ */ (0,c.jsx)(`div`,{className:i(`flex min-h-0 min-w-0 flex-1 flex-col`,D(r),f),children:e}),j&&/* @__PURE__ */ (0,c.jsx)(`footer`,{ref:L.ref,role:L.role,className:i(w,`min-w-0 shrink-0`,E(r),_),children:s})]}):v?e:/* @__PURE__ */ (0,c.jsx)(`div`,{className:i(`min-w-0`,g[r]),children:e})})})}j.Header=O,j.Content=k,j.Footer=A;export{O as a,E as c,u as d,A as i,S as l,k as n,b as o,l as r,D as s,j as t,T as u};
@@ -23,10 +23,54 @@ import { cn } from "cn";
23
23
  * Motion: the root is a `motion` host so `initial` / `animate` / `transition` / `whileHover` work
24
24
  * directly on `<Block>`. Choose the underlying element with `as` (`section`, `aside`, …).
25
25
  */
26
- const BlockContext = React$1.createContext({ density: "medium" });
26
+ const BlockContext = React$1.createContext({
27
+ density: "medium",
28
+ scopedSlots: false
29
+ });
27
30
  function useBlockContext() {
28
31
  return React$1.useContext(BlockContext);
29
32
  }
33
+ const SECTIONING_SHELLS = /* @__PURE__ */ new Set([
34
+ "section",
35
+ "article",
36
+ "aside"
37
+ ]);
38
+ const SECTIONING_ANCESTOR_SELECTOR = "article, aside, main, nav, section";
39
+ function assignRef(ref, node) {
40
+ if (typeof ref === "function") ref(node);
41
+ else if (ref) ref.current = node;
42
+ }
43
+ /**
44
+ * Neutral role for header/footer slots that would otherwise become page-level landmarks. Starts
45
+ * from the shell tag (so SSR markup is right for `as="section"` etc.), then checks the rendered
46
+ * slot's real ancestors so a `div` Block nested in `main` / `section` keeps native semantics.
47
+ */
48
+ function useSlotRole(scopedByShell, forwardedRef) {
49
+ const $ = c(5);
50
+ const [scoped, setScoped] = React$1.useState(Boolean(scopedByShell));
51
+ let t0;
52
+ if ($[0] !== forwardedRef) {
53
+ t0 = (node) => {
54
+ if (node) setScoped(node.parentElement?.closest(SECTIONING_ANCESTOR_SELECTOR) != null);
55
+ assignRef(forwardedRef, node);
56
+ };
57
+ $[0] = forwardedRef;
58
+ $[1] = t0;
59
+ } else t0 = $[1];
60
+ const ref = t0;
61
+ const t1 = scoped ? void 0 : "none";
62
+ let t2;
63
+ if ($[2] !== ref || $[3] !== t1) {
64
+ t2 = {
65
+ role: t1,
66
+ ref
67
+ };
68
+ $[2] = ref;
69
+ $[3] = t1;
70
+ $[4] = t2;
71
+ } else t2 = $[4];
72
+ return t2;
73
+ }
30
74
  const MOTION_SHELL = {
31
75
  div: motion.div,
32
76
  section: motion.section,
@@ -89,6 +133,8 @@ function gapClassFor(gap) {
89
133
  default: return gap;
90
134
  }
91
135
  }
136
+ const HEADER_TYPOGRAPHY_CLASS = "pui-text-label-medium-loose text-text-strong";
137
+ const FOOTER_TYPOGRAPHY_CLASS = "pui-text-body-small-alt text-text-sub";
92
138
  function headerInsetClasses(density) {
93
139
  return cn(DENSITY_HORIZONTAL[density], DENSITY_HEADER_TOP[density]);
94
140
  }
@@ -98,49 +144,17 @@ function footerInsetClasses(density) {
98
144
  function contentInsetClasses(density) {
99
145
  return DENSITY_PADDING[density];
100
146
  }
101
- function BlockHeader(t0) {
102
- const $ = c(13);
103
- let children;
104
- let className;
105
- let props;
106
- let t1;
107
- if ($[0] !== t0) {
108
- ({className, children, qaTestId: t1, ...props} = t0);
109
- $[0] = t0;
110
- $[1] = children;
111
- $[2] = className;
112
- $[3] = props;
113
- $[4] = t1;
114
- } else {
115
- children = $[1];
116
- className = $[2];
117
- props = $[3];
118
- t1 = $[4];
119
- }
120
- const qaTestId = t1 === void 0 ? "block-header" : t1;
121
- const { density } = useBlockContext();
122
- let t2;
123
- if ($[5] !== className || $[6] !== density) {
124
- t2 = cn("flex min-w-0 items-center justify-between gap-2.5", headerInsetClasses(density), className);
125
- $[5] = className;
126
- $[6] = density;
127
- $[7] = t2;
128
- } else t2 = $[7];
129
- let t3;
130
- if ($[8] !== children || $[9] !== props || $[10] !== qaTestId || $[11] !== t2) {
131
- t3 = /* @__PURE__ */ jsx("header", {
132
- className: t2,
133
- "qa-test-id": qaTestId,
134
- ...props,
135
- children
136
- });
137
- $[8] = children;
138
- $[9] = props;
139
- $[10] = qaTestId;
140
- $[11] = t2;
141
- $[12] = t3;
142
- } else t3 = $[12];
143
- return t3;
147
+ function BlockHeader({ className, children, qaTestId = "block-header", ref, ...props }) {
148
+ const { density, scopedSlots } = useBlockContext();
149
+ const slot = useSlotRole(scopedSlots, ref);
150
+ return /* @__PURE__ */ jsx("header", {
151
+ ref: slot.ref,
152
+ role: slot.role,
153
+ className: cn("flex min-w-0 items-center justify-between gap-2", HEADER_TYPOGRAPHY_CLASS, headerInsetClasses(density), className),
154
+ "qa-test-id": qaTestId,
155
+ ...props,
156
+ children
157
+ });
144
158
  }
145
159
  function BlockContent(t0) {
146
160
  const $ = c(13);
@@ -186,196 +200,60 @@ function BlockContent(t0) {
186
200
  } else t3 = $[12];
187
201
  return t3;
188
202
  }
189
- function BlockFooter(t0) {
190
- const $ = c(13);
191
- let children;
192
- let className;
193
- let props;
194
- let t1;
195
- if ($[0] !== t0) {
196
- ({className, children, qaTestId: t1, ...props} = t0);
197
- $[0] = t0;
198
- $[1] = children;
199
- $[2] = className;
200
- $[3] = props;
201
- $[4] = t1;
202
- } else {
203
- children = $[1];
204
- className = $[2];
205
- props = $[3];
206
- t1 = $[4];
207
- }
208
- const qaTestId = t1 === void 0 ? "block-footer" : t1;
209
- const { density } = useBlockContext();
210
- let t2;
211
- if ($[5] !== className || $[6] !== density) {
212
- t2 = cn("min-w-0", footerInsetClasses(density), className);
213
- $[5] = className;
214
- $[6] = density;
215
- $[7] = t2;
216
- } else t2 = $[7];
217
- let t3;
218
- if ($[8] !== children || $[9] !== props || $[10] !== qaTestId || $[11] !== t2) {
219
- t3 = /* @__PURE__ */ jsx("footer", {
220
- className: t2,
221
- "qa-test-id": qaTestId,
222
- ...props,
223
- children
224
- });
225
- $[8] = children;
226
- $[9] = props;
227
- $[10] = qaTestId;
228
- $[11] = t2;
229
- $[12] = t3;
230
- } else t3 = $[12];
231
- return t3;
203
+ function BlockFooter({ className, children, qaTestId = "block-footer", ref, ...props }) {
204
+ const { density, scopedSlots } = useBlockContext();
205
+ const slot = useSlotRole(scopedSlots, ref);
206
+ return /* @__PURE__ */ jsx("footer", {
207
+ ref: slot.ref,
208
+ role: slot.role,
209
+ className: cn(FOOTER_TYPOGRAPHY_CLASS, "min-w-0", footerInsetClasses(density), className),
210
+ "qa-test-id": qaTestId,
211
+ ...props,
212
+ children
213
+ });
232
214
  }
233
- function Block(t0) {
234
- const $ = c(48);
235
- let children;
236
- let className;
237
- let contentClassName;
238
- let footer;
239
- let footerClassName;
240
- let header;
241
- let headerClassName;
242
- let props;
243
- let style;
244
- let t1;
245
- let t2;
246
- let t3;
247
- let t4;
248
- let t5;
249
- let t6;
250
- if ($[0] !== t0) {
251
- ({children, className, variant: t1, density: t2, gap: t3, header, footer, headerClassName, contentClassName, footerClassName, sectioned: t4, style, as: t5, qaTestId: t6, ...props} = t0);
252
- $[0] = t0;
253
- $[1] = children;
254
- $[2] = className;
255
- $[3] = contentClassName;
256
- $[4] = footer;
257
- $[5] = footerClassName;
258
- $[6] = header;
259
- $[7] = headerClassName;
260
- $[8] = props;
261
- $[9] = style;
262
- $[10] = t1;
263
- $[11] = t2;
264
- $[12] = t3;
265
- $[13] = t4;
266
- $[14] = t5;
267
- $[15] = t6;
268
- } else {
269
- children = $[1];
270
- className = $[2];
271
- contentClassName = $[3];
272
- footer = $[4];
273
- footerClassName = $[5];
274
- header = $[6];
275
- headerClassName = $[7];
276
- props = $[8];
277
- style = $[9];
278
- t1 = $[10];
279
- t2 = $[11];
280
- t3 = $[12];
281
- t4 = $[13];
282
- t5 = $[14];
283
- t6 = $[15];
284
- }
285
- const variant = t1 === void 0 ? "weak" : t1;
286
- const density = t2 === void 0 ? "medium" : t2;
287
- const gap = t3 === void 0 ? "none" : t3;
288
- const sectioned = t4 === void 0 ? false : t4;
289
- const Tag = t5 === void 0 ? "div" : t5;
290
- const qaTestId = t6 === void 0 ? "block" : t6;
215
+ function Block({ children, className, variant = "weak", density = "medium", gap = "none", header, footer, headerClassName, contentClassName, footerClassName, sectioned = false, style, as: Tag = "div", qaTestId = "block", ...props }) {
291
216
  const hasHeaderSlot = header != null;
292
217
  const hasFooterSlot = footer != null;
293
218
  const legacySlots = hasHeaderSlot || hasFooterSlot;
294
- const shellStacked = legacySlots || sectioned;
295
- let T0;
296
- let t7;
297
- if ($[16] !== Tag || $[17] !== className || $[18] !== density || $[19] !== gap || $[20] !== shellStacked || $[21] !== variant) {
298
- const layoutClass = shellStacked ? cn("flex min-h-0 min-w-0 flex-col", gapClassFor(gap)) : "";
299
- T0 = MOTION_SHELL[Tag];
300
- t7 = cn(VARIANT_CLASS[variant], DENSITY_RADIUS_CLASS[density], layoutClass, "min-w-0", className);
301
- $[16] = Tag;
302
- $[17] = className;
303
- $[18] = density;
304
- $[19] = gap;
305
- $[20] = shellStacked;
306
- $[21] = variant;
307
- $[22] = T0;
308
- $[23] = t7;
309
- } else {
310
- T0 = $[22];
311
- t7 = $[23];
312
- }
313
- let t8;
314
- if ($[24] !== density) {
315
- t8 = { density };
316
- $[24] = density;
317
- $[25] = t8;
318
- } else t8 = $[25];
319
- let t9;
320
- if ($[26] !== children || $[27] !== contentClassName || $[28] !== density || $[29] !== footer || $[30] !== footerClassName || $[31] !== hasFooterSlot || $[32] !== hasHeaderSlot || $[33] !== header || $[34] !== headerClassName || $[35] !== legacySlots || $[36] !== sectioned) {
321
- t9 = legacySlots ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
322
- hasHeaderSlot && /* @__PURE__ */ jsx("header", {
323
- className: cn("flex min-w-0 shrink-0 items-center justify-between gap-2.5", headerInsetClasses(density), headerClassName),
324
- children: header
325
- }),
326
- /* @__PURE__ */ jsx("div", {
327
- className: cn("flex min-h-0 min-w-0 flex-1 flex-col", contentInsetClasses(density), contentClassName),
219
+ const layoutClass = legacySlots || sectioned ? cn("flex min-h-0 min-w-0 flex-col", gapClassFor(gap)) : "";
220
+ const MotionShell = MOTION_SHELL[Tag];
221
+ const scopedSlots = SECTIONING_SHELLS.has(Tag);
222
+ const headerSlot = useSlotRole(scopedSlots);
223
+ const footerSlot = useSlotRole(scopedSlots);
224
+ return /* @__PURE__ */ jsx(MotionShell, {
225
+ className: cn(VARIANT_CLASS[variant], DENSITY_RADIUS_CLASS[density], layoutClass, "min-w-0", className),
226
+ style,
227
+ "qa-test-id": qaTestId,
228
+ ...props,
229
+ children: /* @__PURE__ */ jsx(BlockContext.Provider, {
230
+ value: {
231
+ density,
232
+ scopedSlots
233
+ },
234
+ children: legacySlots ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
235
+ hasHeaderSlot && /* @__PURE__ */ jsx("header", {
236
+ ref: headerSlot.ref,
237
+ role: headerSlot.role,
238
+ className: cn("flex min-w-0 shrink-0 items-center justify-between gap-2", HEADER_TYPOGRAPHY_CLASS, headerInsetClasses(density), headerClassName),
239
+ children: header
240
+ }),
241
+ /* @__PURE__ */ jsx("div", {
242
+ className: cn("flex min-h-0 min-w-0 flex-1 flex-col", contentInsetClasses(density), contentClassName),
243
+ children
244
+ }),
245
+ hasFooterSlot && /* @__PURE__ */ jsx("footer", {
246
+ ref: footerSlot.ref,
247
+ role: footerSlot.role,
248
+ className: cn(FOOTER_TYPOGRAPHY_CLASS, "min-w-0 shrink-0", footerInsetClasses(density), footerClassName),
249
+ children: footer
250
+ })
251
+ ] }) : sectioned ? children : /* @__PURE__ */ jsx("div", {
252
+ className: cn("min-w-0", DENSITY_PADDING[density]),
328
253
  children
329
- }),
330
- hasFooterSlot && /* @__PURE__ */ jsx("footer", {
331
- className: cn("min-w-0 shrink-0", footerInsetClasses(density), footerClassName),
332
- children: footer
333
254
  })
334
- ] }) : sectioned ? children : /* @__PURE__ */ jsx("div", {
335
- className: cn("min-w-0", DENSITY_PADDING[density]),
336
- children
337
- });
338
- $[26] = children;
339
- $[27] = contentClassName;
340
- $[28] = density;
341
- $[29] = footer;
342
- $[30] = footerClassName;
343
- $[31] = hasFooterSlot;
344
- $[32] = hasHeaderSlot;
345
- $[33] = header;
346
- $[34] = headerClassName;
347
- $[35] = legacySlots;
348
- $[36] = sectioned;
349
- $[37] = t9;
350
- } else t9 = $[37];
351
- let t10;
352
- if ($[38] !== t8 || $[39] !== t9) {
353
- t10 = /* @__PURE__ */ jsx(BlockContext.Provider, {
354
- value: t8,
355
- children: t9
356
- });
357
- $[38] = t8;
358
- $[39] = t9;
359
- $[40] = t10;
360
- } else t10 = $[40];
361
- let t11;
362
- if ($[41] !== T0 || $[42] !== props || $[43] !== qaTestId || $[44] !== style || $[45] !== t10 || $[46] !== t7) {
363
- t11 = /* @__PURE__ */ jsx(T0, {
364
- className: t7,
365
- style,
366
- "qa-test-id": qaTestId,
367
- ...props,
368
- children: t10
369
- });
370
- $[41] = T0;
371
- $[42] = props;
372
- $[43] = qaTestId;
373
- $[44] = style;
374
- $[45] = t10;
375
- $[46] = t7;
376
- $[47] = t11;
377
- } else t11 = $[47];
378
- return t11;
255
+ })
256
+ });
379
257
  }
380
258
  Block.Header = BlockHeader;
381
259
  Block.Content = BlockContent;
@@ -2,7 +2,7 @@
2
2
  const NPM_CDN = "https://cdn.jsdelivr.net/npm/";
3
3
  const SHARED = /^(@patterninc\/pattern-ui\/|(react|react-dom|@lingui\/core|@lingui\/react|sucrase)(\/|$))/;
4
4
  const scriptUrl = document.currentScript instanceof HTMLScriptElement ? document.currentScript.src : "";
5
- const packageUrl = new URL("../", scriptUrl || location.href).href.replace(/\/@patterninc\/pattern-ui(@[^/]*)?\//, `/@patterninc/pattern-ui@0.0.0-main.202611050447.20eee6ff23dc/`);
5
+ const packageUrl = new URL("../", scriptUrl || location.href).href.replace(/\/@patterninc\/pattern-ui(@[^/]*)?\//, `/@patterninc/pattern-ui@0.0.0-main.202611050504.c31d6bfb5e4c/`);
6
6
  const browserUrl = `${packageUrl}dist/browser/`;
7
7
  globalThis.patternPlayCdnUrl = (specifier) => {
8
8
  if (specifier.endsWith(".css")) return `${browserUrl}${specifier}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@patterninc/pattern-ui",
3
- "version": "0.0.0-main.202611050447.20eee6ff23dc",
3
+ "version": "0.0.0-main.202611050504.c31d6bfb5e4c",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/patterninc/pattern-exp.git",
@@ -29,16 +29,50 @@ export type BlockGap = 'none' | 'tight' | 'small' | 'snug' | 'medium' | 'large'
29
29
 
30
30
  export interface BlockContextValue {
31
31
  density: BlockDensity
32
+ /**
33
+ * Whether the Block's own shell (`section`, `article`, `aside`) scopes its `<header>` /
34
+ * `<footer>` slots. Slots also check their rendered ancestors, so this is the initial (SSR)
35
+ * answer; unscoped slots get a neutral role instead of page-level `banner` / `contentinfo`.
36
+ */
37
+ scopedSlots?: boolean
32
38
  }
33
39
 
34
40
  export const BlockContext = React.createContext<BlockContextValue>({
35
41
  density: 'medium',
42
+ scopedSlots: false,
36
43
  })
37
44
 
38
45
  export function useBlockContext(): BlockContextValue {
39
46
  return React.useContext(BlockContext)
40
47
  }
41
48
 
49
+ const SECTIONING_SHELLS: ReadonlySet<BlockShellTag> = new Set(['section', 'article', 'aside'])
50
+
51
+ // HTML-AAM: `<header>` / `<footer>` only map to banner / contentinfo outside these elements.
52
+ const SECTIONING_ANCESTOR_SELECTOR = 'article, aside, main, nav, section'
53
+
54
+ function assignRef<T>(ref: React.Ref<T> | undefined, node: T | null): void {
55
+ if (typeof ref === 'function') ref(node)
56
+ else if (ref) ref.current = node
57
+ }
58
+
59
+ /**
60
+ * Neutral role for header/footer slots that would otherwise become page-level landmarks. Starts
61
+ * from the shell tag (so SSR markup is right for `as="section"` etc.), then checks the rendered
62
+ * slot's real ancestors so a `div` Block nested in `main` / `section` keeps native semantics.
63
+ */
64
+ function useSlotRole<T extends HTMLElement>(
65
+ scopedByShell: boolean | undefined,
66
+ forwardedRef?: React.Ref<T>,
67
+ ): { role: 'none' | undefined; ref: React.RefCallback<T> } {
68
+ const [scoped, setScoped] = React.useState(Boolean(scopedByShell))
69
+ const ref = (node: T | null) => {
70
+ if (node) setScoped(node.parentElement?.closest(SECTIONING_ANCESTOR_SELECTOR) != null)
71
+ assignRef(forwardedRef, node)
72
+ }
73
+ return { role: scoped ? undefined : 'none', ref }
74
+ }
75
+
42
76
  export type BlockShellTag = 'div' | 'section' | 'article' | 'aside' | 'header' | 'footer'
43
77
 
44
78
  export interface BlockProps extends Omit<React.ComponentProps<typeof motion.div>, 'children'> {
@@ -63,7 +97,7 @@ export interface BlockProps extends Omit<React.ComponentProps<typeof motion.div>
63
97
  gap?: BlockGap
64
98
  /**
65
99
  * Optional header slot rendered above `children`. Laid out as `flex-row items-center
66
- * justify-between gap-2.5` so a title sits left and an actions cluster sits right.
100
+ * justify-between gap-2` so a title sits left and an actions cluster sits right.
67
101
  *
68
102
  * TODO(#15220): The legacy `header` / `footer` props duplicate the compound `Block.Header` /
69
103
  * `Block.Content` / `Block.Footer` slots (raised by @JoshMDiaz in review). Decide in a follow-up
@@ -175,6 +209,11 @@ export function gapClassFor(gap: BlockGap): string {
175
209
  }
176
210
  }
177
211
 
212
+ // Figma Block header: Label/Medium Loose (14/24, 500) in text/strong.
213
+ const HEADER_TYPOGRAPHY_CLASS = 'pui-text-label-medium-loose text-text-strong'
214
+ // Figma Block footer: Body/Small Alt (12/16, 400) in text/sub.
215
+ const FOOTER_TYPOGRAPHY_CLASS = 'pui-text-body-small-alt text-text-sub'
216
+
178
217
  export function headerInsetClasses(density: BlockDensity): string {
179
218
  return cn(DENSITY_HORIZONTAL[density], DENSITY_HEADER_TOP[density])
180
219
  }
@@ -197,13 +236,18 @@ export function BlockHeader({
197
236
  className,
198
237
  children,
199
238
  qaTestId = 'block-header',
239
+ ref,
200
240
  ...props
201
241
  }: BlockHeaderProps): React.ReactElement {
202
- const { density } = useBlockContext()
242
+ const { density, scopedSlots } = useBlockContext()
243
+ const slot = useSlotRole(scopedSlots, ref)
203
244
  return (
204
245
  <header
246
+ ref={slot.ref}
247
+ role={slot.role}
205
248
  className={cn(
206
- 'flex min-w-0 items-center justify-between gap-2.5',
249
+ 'flex min-w-0 items-center justify-between gap-2',
250
+ HEADER_TYPOGRAPHY_CLASS,
207
251
  headerInsetClasses(density),
208
252
  className,
209
253
  )}
@@ -249,12 +293,16 @@ export function BlockFooter({
249
293
  className,
250
294
  children,
251
295
  qaTestId = 'block-footer',
296
+ ref,
252
297
  ...props
253
298
  }: BlockFooterProps): React.ReactElement {
254
- const { density } = useBlockContext()
299
+ const { density, scopedSlots } = useBlockContext()
300
+ const slot = useSlotRole(scopedSlots, ref)
255
301
  return (
256
302
  <footer
257
- className={cn('min-w-0', footerInsetClasses(density), className)}
303
+ ref={slot.ref}
304
+ role={slot.role}
305
+ className={cn(FOOTER_TYPOGRAPHY_CLASS, 'min-w-0', footerInsetClasses(density), className)}
258
306
  qa-test-id={qaTestId}
259
307
  {...props}
260
308
  >
@@ -288,6 +336,9 @@ export function Block({
288
336
  const layoutClass = shellStacked ? cn('flex min-h-0 min-w-0 flex-col', gapClassFor(gap)) : ''
289
337
 
290
338
  const MotionShell = MOTION_SHELL[Tag]
339
+ const scopedSlots = SECTIONING_SHELLS.has(Tag)
340
+ const headerSlot = useSlotRole<HTMLElement>(scopedSlots)
341
+ const footerSlot = useSlotRole<HTMLElement>(scopedSlots)
291
342
 
292
343
  return (
293
344
  <MotionShell
@@ -302,13 +353,16 @@ export function Block({
302
353
  qa-test-id={qaTestId}
303
354
  {...props}
304
355
  >
305
- <BlockContext.Provider value={{ density }}>
356
+ <BlockContext.Provider value={{ density, scopedSlots }}>
306
357
  {legacySlots ? (
307
358
  <>
308
359
  {hasHeaderSlot && (
309
360
  <header
361
+ ref={headerSlot.ref}
362
+ role={headerSlot.role}
310
363
  className={cn(
311
- 'flex min-w-0 shrink-0 items-center justify-between gap-2.5',
364
+ 'flex min-w-0 shrink-0 items-center justify-between gap-2',
365
+ HEADER_TYPOGRAPHY_CLASS,
312
366
  headerInsetClasses(density),
313
367
  headerClassName,
314
368
  )}
@@ -327,7 +381,14 @@ export function Block({
327
381
  </div>
328
382
  {hasFooterSlot && (
329
383
  <footer
330
- className={cn('min-w-0 shrink-0', footerInsetClasses(density), footerClassName)}
384
+ ref={footerSlot.ref}
385
+ role={footerSlot.role}
386
+ className={cn(
387
+ FOOTER_TYPOGRAPHY_CLASS,
388
+ 'min-w-0 shrink-0',
389
+ footerInsetClasses(density),
390
+ footerClassName,
391
+ )}
331
392
  >
332
393
  {footer}
333
394
  </footer>
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-BWaJ3C7D.js";import{t}from"./react-CUaU2Z9V.js";import{t as n}from"./compiler-runtime-B3BlmaWz.js";import{t as r}from"./jsx-runtime-Dgn0yPdi.js";import{t as i}from"./dist-BNSTMZct.js";import{n as a}from"./react-B3hSlcN2.js";var o=n(),s=/* @__PURE__ */ e(t(),1),c=/* @__PURE__ */ e(r(),1);const l=s.createContext({density:`medium`});function u(){return s.useContext(l)}const d={div:a.div,section:a.section,article:a.article,aside:a.aside,header:a.header,footer:a.footer},f={weak:`bg-depth-black-4`,stroke:`border-inner-depth-black-4`},p={small:`pl-4 pr-4 pt-4 pb-4`,medium:`pl-6 pr-6 pt-6 pb-6`,large:`pl-8 pr-8 pt-8 pb-8`},m={small:`px-4`,medium:`px-6`,large:`px-8`},h={small:`pt-4`,medium:`pt-6`,large:`pt-8`},g={small:`pb-4`,medium:`pb-6`,large:`pb-8`},_={small:20,medium:24,large:28},v={small:`rounded-20`,medium:`rounded-3xl`,large:`rounded-28`};function y(e){switch(e){case`none`:return`gap-0`;case`tight`:return`gap-1`;case`small`:return`gap-2`;case`snug`:return`gap-3`;case`medium`:return`gap-4`;case`large`:return`gap-6`;case`xlarge`:return`gap-8`;default:return e}}function b(e){return i(m[e],h[e])}function x(e){return i(m[e],g[e])}function S(e){return p[e]}function C(e){let t=(0,o.c)(13),n,r,a,s;t[0]===e?(n=t[1],r=t[2],a=t[3],s=t[4]):({className:r,children:n,qaTestId:s,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=s);let l=s===void 0?`block-header`:s,{density:d}=u(),f;t[5]!==r||t[6]!==d?(f=i(`flex min-w-0 items-center justify-between gap-2.5`,b(d),r),t[5]=r,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==n||t[9]!==a||t[10]!==l||t[11]!==f?(p=/* @__PURE__ */ (0,c.jsx)(`header`,{className:f,"qa-test-id":l,...a,children:n}),t[8]=n,t[9]=a,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function w(e){let t=(0,o.c)(13),n,r,a,s;t[0]===e?(n=t[1],r=t[2],a=t[3],s=t[4]):({className:r,children:n,qaTestId:s,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=s);let l=s===void 0?`block-content`:s,{density:d}=u(),f;t[5]!==r||t[6]!==d?(f=i(`min-w-0`,S(d),r),t[5]=r,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==n||t[9]!==a||t[10]!==l||t[11]!==f?(p=/* @__PURE__ */ (0,c.jsx)(`div`,{className:f,"qa-test-id":l,...a,children:n}),t[8]=n,t[9]=a,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function T(e){let t=(0,o.c)(13),n,r,a,s;t[0]===e?(n=t[1],r=t[2],a=t[3],s=t[4]):({className:r,children:n,qaTestId:s,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=s);let l=s===void 0?`block-footer`:s,{density:d}=u(),f;t[5]!==r||t[6]!==d?(f=i(`min-w-0`,x(d),r),t[5]=r,t[6]=d,t[7]=f):f=t[7];let p;return t[8]!==n||t[9]!==a||t[10]!==l||t[11]!==f?(p=/* @__PURE__ */ (0,c.jsx)(`footer`,{className:f,"qa-test-id":l,...a,children:n}),t[8]=n,t[9]=a,t[10]=l,t[11]=f,t[12]=p):p=t[12],p}function E(e){let t=(0,o.c)(48),n,r,a,s,u,m,h,g,_,C,w,T,E,D,O;t[0]===e?(n=t[1],r=t[2],a=t[3],s=t[4],u=t[5],m=t[6],h=t[7],g=t[8],_=t[9],C=t[10],w=t[11],T=t[12],E=t[13],D=t[14],O=t[15]):({children:n,className:r,variant:C,density:w,gap:T,header:m,footer:s,headerClassName:h,contentClassName:a,footerClassName:u,sectioned:E,style:_,as:D,qaTestId:O,...g}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=a,t[4]=s,t[5]=u,t[6]=m,t[7]=h,t[8]=g,t[9]=_,t[10]=C,t[11]=w,t[12]=T,t[13]=E,t[14]=D,t[15]=O);let k=C===void 0?`weak`:C,A=w===void 0?`medium`:w,j=T===void 0?`none`:T,M=E!==void 0&&E,N=D===void 0?`div`:D,P=O===void 0?`block`:O,F=m!=null,I=s!=null,L=F||I,R=L||M,z,B;if(t[16]!==N||t[17]!==r||t[18]!==A||t[19]!==j||t[20]!==R||t[21]!==k){let e=R?i(`flex min-h-0 min-w-0 flex-col`,y(j)):``;z=d[N],B=i(f[k],v[A],e,`min-w-0`,r),t[16]=N,t[17]=r,t[18]=A,t[19]=j,t[20]=R,t[21]=k,t[22]=z,t[23]=B}else z=t[22],B=t[23];let V;t[24]===A?V=t[25]:(V={density:A},t[24]=A,t[25]=V);let H;t[26]!==n||t[27]!==a||t[28]!==A||t[29]!==s||t[30]!==u||t[31]!==I||t[32]!==F||t[33]!==m||t[34]!==h||t[35]!==L||t[36]!==M?(H=L?/* @__PURE__ */ (0,c.jsxs)(c.Fragment,{children:[F&&/* @__PURE__ */ (0,c.jsx)(`header`,{className:i(`flex min-w-0 shrink-0 items-center justify-between gap-2.5`,b(A),h),children:m}),/* @__PURE__ */ (0,c.jsx)(`div`,{className:i(`flex min-h-0 min-w-0 flex-1 flex-col`,S(A),a),children:n}),I&&/* @__PURE__ */ (0,c.jsx)(`footer`,{className:i(`min-w-0 shrink-0`,x(A),u),children:s})]}):M?n:/* @__PURE__ */ (0,c.jsx)(`div`,{className:i(`min-w-0`,p[A]),children:n}),t[26]=n,t[27]=a,t[28]=A,t[29]=s,t[30]=u,t[31]=I,t[32]=F,t[33]=m,t[34]=h,t[35]=L,t[36]=M,t[37]=H):H=t[37];let U;t[38]!==V||t[39]!==H?(U=/* @__PURE__ */ (0,c.jsx)(l.Provider,{value:V,children:H}),t[38]=V,t[39]=H,t[40]=U):U=t[40];let W;return t[41]!==z||t[42]!==g||t[43]!==P||t[44]!==_||t[45]!==U||t[46]!==B?(W=/* @__PURE__ */ (0,c.jsx)(z,{className:B,style:_,"qa-test-id":P,...g,children:U}),t[41]=z,t[42]=g,t[43]=P,t[44]=_,t[45]=U,t[46]=B,t[47]=W):W=t[47],W}E.Header=C,E.Content=w,E.Footer=T;export{C as a,x as c,u as d,T as i,y as l,w as n,_ as o,l as r,S as s,E as t,b as u};