@stanfordspezi/spezi-web-design-system
Version:
Stanford Biodesign Digital Health Spezi Web Design System
2 lines (1 loc) • 824 B
JavaScript
;const o=require("react/jsx-runtime"),S=require("./ErrorState-DSH517_N.js"),d=require("./Spinner-DpazeznU.js"),E=require("./StateContainer-WjdrYal7.js"),j=require("./EmptyState-Cu8xtgFe.js");function f(t,e){const r={...t};for(let n=0;n<e.length;n++){const s=e[n];delete r[s]}return r}function u(t){return typeof t=="boolean"}function l(t){return t===void 0}const q=t=>l(t)?{show:!1}:u(t)?{show:t}:t,x=t=>u(t)?{show:t}:l(t)?{show:!1}:t,y=({entityName:t="data",empty:e,error:r,loading:n,renderState:s,children:h,grow:p,className:w})=>{const c=q(r),a=x(e),i=c.show?o.jsx(S.ErrorState,{entityName:t,...f(c,["show"])}):n?o.jsx(d.Spinner,{}):a.show?o.jsx(j.EmptyState,{entityName:t,...f(a,["show"])}):null;return i?s?s(i):o.jsx(E.StateContainer,{grow:p,className:w,children:i}):h};exports.Async=y;exports.isBoolean=u;