Skip to content

Commit 773e172

Browse files
author
github-actions[bot]
committed
Update: f6cd776218b9226333eed9a43905a17a29155c22
1 parent c0b3a6b commit 773e172

10 files changed

Lines changed: 113 additions & 113 deletions
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/ErrorBanner.stories-DOMr64Lf.js

Lines changed: 0 additions & 100 deletions
This file was deleted.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import{j as e}from"./jsx-runtime-CLpGMVip.js";import{n as h}from"./emotion-styled.browser.esm-yr_-r2v3.js";import{r as f}from"./index-CZMpeKRu.js";import{b as g}from"./theme-QoxxbpC5.js";import{S as k}from"./Spinner-BC5D4pXq.js";import{u as S}from"./useTranslation-CFqzwKmp.js";import"./extends-CF3RwP-h.js";import"./emotion-utils.browser.esm-D8RxJ_4a.js";function E(l){const r=l;return(r!==null&&typeof r=="object"||typeof r=="function")&&typeof r.block_id=="string"}function T(l){const r=l;return(r!==null&&typeof r=="object"||typeof r=="function")&&typeof r.title=="string"&&typeof r.message=="string"&&(r.source===null||typeof r.source=="string")&&(r.data===null||E(r.data))}const d=h.div`
2+
background: #f1f1f1;
3+
width: 100%;
4+
position: relative;
5+
margin: 0 auto;
6+
display: block;
7+
border-left: 4px solid #da4453;
8+
`,c=h.div`
9+
padding-top: 3rem;
10+
padding-bottom: 3rem;
11+
max-width: 100%;
12+
font-weight: 500;
13+
font-size: 1rem;
14+
line-height: 1.4;
15+
display: grid;
16+
grid-template-columns: 1fr;
17+
gap: 0.5rem;
18+
19+
a {
20+
text-decoration: none;
21+
max-width: 100%;
22+
cursor: pointer;
23+
display: flex;
24+
height: 1rem;
25+
line-height: 1rem;
26+
margin-top: 1rem;
27+
28+
span {
29+
display: flex;
30+
align-items: center;
31+
margin-left: 0.5rem;
32+
}
33+
}
34+
`,a=h.div`
35+
padding: 0 2rem;
36+
`,p=h.div`
37+
background: #e1e1e1;
38+
details {
39+
padding: 0 2rem;
40+
}
41+
42+
details[open] summary ~ * {
43+
color: ${g.colors.gray[700]};
44+
}
45+
46+
details[open] > div {
47+
animation-duration: 0.3s;
48+
animation-fill-mode: forwards;
49+
}
50+
51+
details summary {
52+
padding: 1rem 0;
53+
position: relative;
54+
cursor: pointer;
55+
font-size: 1.1rem;
56+
font-weight: medium;
57+
list-style: none;
58+
color: ${g.colors.gray[700]};
59+
outline: 0;
60+
::-webkit-details-marker {
61+
display: none;
62+
}
63+
&:hover {
64+
text-decoration: underline;
65+
}
66+
}
67+
68+
details[open] > summary {
69+
color: #1c1c1c;
70+
}
71+
72+
details[open] summary {
73+
opacity: 0.9;
74+
}
75+
76+
ul {
77+
padding: 0;
78+
margin: 0;
79+
padding-bottom: 2rem;
80+
}
81+
82+
ul li {
83+
font-size: 1.1rem;
84+
margin: 0 0 0.2rem;
85+
padding: 15px 30px;
86+
line-height: 1.7;
87+
list-style: none;
88+
background: #e3e3e3;
89+
border: 2px solid #c1c1c1;
90+
border-radius: 10px;
91+
}
92+
93+
ul li pre {
94+
white-space: pre-line;
95+
}
96+
`,x=l=>{var j;const{t:r}=S(),{variant:O="text",error:v}=l,i=v,[s,m]=f.useState(void 0);if(f.useEffect(()=>{if(typeof i=="object"&&i!==null&&i.data instanceof Blob)i.data.text().then(n=>{try{const o=JSON.parse(n);m({...i,data:o})}catch{m({...i,data:n})}});else{if(i===void 0)throw new Error("Invalid input");m(i)}},[i]),s===void 0)return e.jsx(k,{variant:"medium"});if(typeof s=="string")return e.jsx(d,{children:e.jsx(c,{children:e.jsxs(a,{children:[e.jsx("h2",{children:r("error-title")}),e.jsx("p",{children:s})]})})});if(typeof s=="object"&&s!==null)if(T(s.data)){const t=s.data,n=t.data;let o=e.jsx(e.Fragment,{});if(E(n)){const _=window.location.href.replace(location.hash,"");o=e.jsx("a",{href:`${_}#${n.block_id}`,children:r("go-to-error")})}return e.jsx(d,{children:e.jsxs(c,{children:[e.jsxs(a,{children:[e.jsxs("h2",{children:[r("error-title")," ",s.status,": ",t.title]}),e.jsx("p",{children:t.message})]}),e.jsx(p,{children:t.source&&e.jsxs("details",{children:[e.jsx("summary",{children:r("show-error-source")}),e.jsx("ul",{children:e.jsx("li",{children:e.jsx("pre",{children:t.source})})})]})}),t.data&&e.jsx(a,{children:o})]})})}else if(s.isAxiosError){const t=s,n=(j=t.response)==null?void 0:j.data,o=typeof n=="object"&&n!==null&&"message"in n?n.message:void 0;return e.jsx(d,{children:e.jsxs(c,{children:[e.jsxs(a,{children:[e.jsxs("h2",{children:[r("error-title"),": ",t.message]}),o&&e.jsx("p",{children:o})]}),e.jsx(p,{children:!!n&&e.jsxs("details",{children:[e.jsx("summary",{children:r("show-error-source")}),e.jsx("ul",{children:e.jsx("li",{children:e.jsx("pre",{children:JSON.stringify(n,void 0,2)})})})]})})]})})}else{if(s.status!==void 0&&s.statusText!==void 0&&typeof s.request=="object"&&s.request.responseURL!==void 0)return e.jsx(d,{children:e.jsxs(c,{children:[e.jsxs(a,{children:[e.jsxs("h2",{children:[r("error-title")," ",s.status,": ",s.statusText]}),e.jsx("p",{children:s.request.responseURL})]}),e.jsx(p,{children:s.data&&e.jsxs("details",{children:[e.jsx("summary",{children:r("show-error-source")}),e.jsx("ul",{children:e.jsx("li",{children:e.jsx("pre",{children:JSON.stringify(s.data,void 0,2)})})})]})})]})});if(s instanceof Error)return e.jsx(d,{children:e.jsxs(c,{children:[e.jsx(a,{children:e.jsxs("h2",{children:[r("error-title"),s.message&&`: ${s.message}`]})}),e.jsx(p,{children:e.jsxs("details",{children:[e.jsx("summary",{children:r("show-error-source")}),e.jsx("ul",{children:e.jsx("li",{children:e.jsxs("pre",{children:[s.toString(),e.jsx("br",{}),s.stack]})})})]})})]})})}return e.jsx(d,{children:e.jsxs(c,{children:[e.jsx(a,{children:e.jsx("h2",{children:r("error-title")})}),e.jsx(p,{children:e.jsxs("details",{children:[e.jsx("summary",{children:r("show-error-source")}),e.jsx("ul",{children:e.jsx("li",{children:e.jsx("pre",{children:JSON.stringify(s,void 0,2)})})})]})})]})})};try{x.displayName="ErrorBanner",x.__docgenInfo={description:"",displayName:"ErrorBanner",props:{variant:{defaultValue:null,description:"",name:"variant",required:!1,type:{name:"enum",value:[{value:'"link"'},{value:'"text"'},{value:'"readOnly"'}]}},error:{defaultValue:null,description:"",name:"error",required:!0,type:{name:"unknown"}}}}}catch{}const U={component:x,parameters:{docs:{description:{component:"Use this component to display an error banner. The error can be either a string or an Error object."}}}},u={args:{error:"This is an error message."}};var y,b,w;u.parameters={...u.parameters,docs:{...(y=u.parameters)==null?void 0:y.docs,source:{originalSource:`{
97+
args: {
98+
error: "This is an error message."
99+
}
100+
} satisfies StoryType`,...(w=(b=u.parameters)==null?void 0:b.docs)==null?void 0:w.source}}};const C=["Example"];export{u as Example,C as __namedExportsOrder,U as default};
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)