@wacht/jsx 0.0.1-alpha.2 → 0.0.1-alpha.3
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/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +5 -1
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -4740,7 +4740,7 @@ See https://s-c.sh/2BAXzed for more info.`),window[Qr]+=1);const ie=l.div`
|
|
|
4740
4740
|
&:hover {
|
|
4741
4741
|
color: var(--color-primary-hover);
|
|
4742
4742
|
}
|
|
4743
|
-
`,Y1=({onSelect:t,onCreateOrganization:r,onCreateWorkspace:o})=>{var j,b,g;const{organizations:n}=br(),{workspaces:a}=vt(),{switchOrganization:s,switchWorkspace:p}=Ue(),{deployment:f}=ve(),[c,h]=i.useState(null),[d,u]=i.useState(null),m=f==null?void 0:f.b2b_settings.workspaces_enabled,v=f==null?void 0:f.b2b_settings.allow_users_to_create_orgs,x=m&&d,w=S=>S.split(" ").map(k=>k[0]).join("").toUpperCase().slice(0,2),_=async S=>{if(m){h(S.id);try{await s(S.id),u(S)}finally{h(null)}return}h(S.id);try{await s(S.id),t(S.id)}finally{h(null)}},z=async(S,k)=>{h(k.id);try{await p(k.id),t(S.id,k.id)}finally{h(null)}},y=x?"Select a workspace":"Select an organization",I=x?`to continue to ${((j=f==null?void 0:f.ui_settings)==null?void 0:j.app_name)||"App"}`:m?"Choose an organization to view its workspaces":`to continue to ${((b=f==null?void 0:f.ui_settings)==null?void 0:b.app_name)||"App"}`,C=d?a==null?void 0:a.filter(S=>S.organization.id===d.id):[];return e.jsxs(N1,{children:[e.jsx(De,{}),e.jsxs(F1,{children:[e.jsx(B1,{children:y}),e.jsx(U1,{children:I})]}),e.jsxs(W1,{children:[x?e.jsxs(e.Fragment,{children:[C&&C.length>0?e.jsx(e.Fragment,{children:C.map(S=>e.jsxs(ki,{as:"button",onClick:()=>z(d,S),disabled:c===S.id,children:[e.jsx(q1,{children:S.image_url?e.jsx("img",{src:S.image_url,alt:S.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):w(S.name).charAt(0)}),e.jsx(_i,{children:e.jsx(Ci,{children:S.name})})]},S.id))}):e.jsx(Si,{children:"No workspaces available in this organization."}),e.jsxs(Bn,{onClick:()=>o==null?void 0:o(d.id),disabled:c!==null,children:[e.jsx(lt,{}),"Create workspace"]})]}):n&&n.length>0?e.jsx(e.Fragment,{children:n.map(S=>{const k=a==null?void 0:a.filter(R=>R.organization.id===S.id),E=(k==null?void 0:k.length)||0;return e.jsxs(ki,{as:"button",onClick:()=>_(S),disabled:c===S.id,children:[e.jsx(V1,{$small:!m,children:S.image_url?e.jsx(G1,{src:S.image_url,alt:S.name}):w(S.name)}),e.jsxs(_i,{children:[e.jsx(Ci,{children:S.name}),m&&e.jsxs(H1,{children:[E," workspace",E!==1?"s":""]})]})]},S.id)})}):e.jsx(Si,{children:m?"No workspaces available. Create one to get started.":"No organizations available. Create one to get started."}),!x&&e.jsx(e.Fragment,{children:m?n&&n.length>0&&n[0]&&e.jsxs(Bn,{onClick:()=>{o==null||o(n[0].id)},disabled:c!==null,children:[e.jsx(lt,{}),"Create workspace"]}):v&&e.jsxs(Bn,{onClick:()=>{r==null||r()},disabled:c!==null,children:[e.jsx(lt,{}),"Create organization"]})})]}),x?e.jsxs($i,{children:["Make a mistake?"," ",e.jsx(zi,{onClick:()=>u(null),children:"Select Organizations"})]}):e.jsxs($i,{children:["Having trouble?"," ",e.jsx(zi,{children:e.jsx(Ze,{to:((g=f==null?void 0:f.ui_settings)==null?void 0:g.support_page_url)||"#",children:"Get help"})})]})]})},Z1=({children:t})=>{const[r,o]=i.useState(null),[n,a]=i.useState(null),{loading:s}=Ue(),{organizations:p,loading:f}=br(),{activeOrganization:c}=Xe(),{activeWorkspace:h,loading:d}=zt(),{workspaces:u,loading:m}=vt(),{deployment:v}=ve(),{refetch:x,organizationMemberships:w}=tr(),_=v==null?void 0:v.b2b_settings.workspaces_enabled;if(i.useEffect(()=>{if(!(s||f)&&!(_&&d)){if((p==null?void 0:p.length)===0){o("createOrg");return}if(!c&&p&&p.length>0){o("select");return}if(_&&c&&!h){const y=u==null?void 0:u.filter(I=>I.organization.id===c.id);!y||y.length===0?o("createWorkspace"):o("select");return}o(null)}},[s,f,d,p,c,h,u,_]),f||s||_&&(d||m))return null;if(!r)return e.jsx(e.Fragment,{children:t});const z=async()=>{await x()
|
|
4743
|
+
`,Y1=({onSelect:t,onCreateOrganization:r,onCreateWorkspace:o})=>{var j,b,g;const{organizations:n}=br(),{workspaces:a}=vt(),{switchOrganization:s,switchWorkspace:p}=Ue(),{deployment:f}=ve(),[c,h]=i.useState(null),[d,u]=i.useState(null),m=f==null?void 0:f.b2b_settings.workspaces_enabled,v=f==null?void 0:f.b2b_settings.allow_users_to_create_orgs,x=m&&d,w=S=>S.split(" ").map(k=>k[0]).join("").toUpperCase().slice(0,2),_=async S=>{if(m){h(S.id);try{await s(S.id),u(S)}finally{h(null)}return}h(S.id);try{await s(S.id),t(S.id)}finally{h(null)}},z=async(S,k)=>{h(k.id);try{await p(k.id),t(S.id,k.id)}finally{h(null)}},y=x?"Select a workspace":"Select an organization",I=x?`to continue to ${((j=f==null?void 0:f.ui_settings)==null?void 0:j.app_name)||"App"}`:m?"Choose an organization to view its workspaces":`to continue to ${((b=f==null?void 0:f.ui_settings)==null?void 0:b.app_name)||"App"}`,C=d?a==null?void 0:a.filter(S=>S.organization.id===d.id):[];return e.jsxs(N1,{children:[e.jsx(De,{}),e.jsxs(F1,{children:[e.jsx(B1,{children:y}),e.jsx(U1,{children:I})]}),e.jsxs(W1,{children:[x?e.jsxs(e.Fragment,{children:[C&&C.length>0?e.jsx(e.Fragment,{children:C.map(S=>e.jsxs(ki,{as:"button",onClick:()=>z(d,S),disabled:c===S.id,children:[e.jsx(q1,{children:S.image_url?e.jsx("img",{src:S.image_url,alt:S.name,style:{width:"100%",height:"100%",objectFit:"cover"}}):w(S.name).charAt(0)}),e.jsx(_i,{children:e.jsx(Ci,{children:S.name})})]},S.id))}):e.jsx(Si,{children:"No workspaces available in this organization."}),e.jsxs(Bn,{onClick:()=>o==null?void 0:o(d.id),disabled:c!==null,children:[e.jsx(lt,{}),"Create workspace"]})]}):n&&n.length>0?e.jsx(e.Fragment,{children:n.map(S=>{const k=a==null?void 0:a.filter(R=>R.organization.id===S.id),E=(k==null?void 0:k.length)||0;return e.jsxs(ki,{as:"button",onClick:()=>_(S),disabled:c===S.id,children:[e.jsx(V1,{$small:!m,children:S.image_url?e.jsx(G1,{src:S.image_url,alt:S.name}):w(S.name)}),e.jsxs(_i,{children:[e.jsx(Ci,{children:S.name}),m&&e.jsxs(H1,{children:[E," workspace",E!==1?"s":""]})]})]},S.id)})}):e.jsx(Si,{children:m?"No workspaces available. Create one to get started.":"No organizations available. Create one to get started."}),!x&&e.jsx(e.Fragment,{children:m?n&&n.length>0&&n[0]&&e.jsxs(Bn,{onClick:()=>{o==null||o(n[0].id)},disabled:c!==null,children:[e.jsx(lt,{}),"Create workspace"]}):v&&e.jsxs(Bn,{onClick:()=>{r==null||r()},disabled:c!==null,children:[e.jsx(lt,{}),"Create organization"]})})]}),x?e.jsxs($i,{children:["Make a mistake?"," ",e.jsx(zi,{onClick:()=>u(null),children:"Select Organizations"})]}):e.jsxs($i,{children:["Having trouble?"," ",e.jsx(zi,{children:e.jsx(Ze,{to:((g=f==null?void 0:f.ui_settings)==null?void 0:g.support_page_url)||"#",children:"Get help"})})]})]})},Z1=({children:t})=>{const[r,o]=i.useState(null),[n,a]=i.useState(null),{loading:s}=Ue(),{organizations:p,loading:f}=br(),{activeOrganization:c}=Xe(),{activeWorkspace:h,loading:d}=zt(),{workspaces:u,loading:m}=vt(),{deployment:v}=ve(),{refetch:x,organizationMemberships:w}=tr(),_=v==null?void 0:v.b2b_settings.workspaces_enabled;if(i.useEffect(()=>{if(!(s||f)&&!(_&&d)){if((p==null?void 0:p.length)===0){o("createOrg");return}if(!c&&p&&p.length>0){o("select");return}if(_&&c&&!h){const y=u==null?void 0:u.filter(I=>I.organization.id===c.id);!y||y.length===0?o("createWorkspace"):o("select");return}o(null)}},[s,f,d,p,c,h,u,_]),f||s||_&&(d||m))return null;if(!r)return e.jsx(e.Fragment,{children:t});const z=async()=>{if(await x(),!_){o(null);return}setTimeout(()=>{if(w&&w.length>0){const y=w[w.length-1];a(y.organization.id)}o("createWorkspace")},500)};return e.jsx(ie,{children:e.jsx(ye,{isOpen:!0,children:e.jsx(ye.Overlay,{children:e.jsx(ye.Content,{style:{width:r==="select"?"400px":"900px",maxWidth:"90vw",padding:0},children:r==="select"?e.jsx(Y1,{onSelect:()=>{o(null)},onCreateOrganization:()=>{o("createOrg")},onCreateWorkspace:y=>{a(y),o("createWorkspace")}}):e.jsxs(ye.Body,{style:{padding:0},children:[r==="createOrg"&&e.jsx(en,{onSuccess:z,onCancel:()=>o("select")}),r==="createWorkspace"&&(n||c)&&e.jsx(ja,{organizationId:n||c.id,onSuccess:()=>{a(null),o(null)},onCancel:()=>{a(null),o("select")},onCreateOrganization:()=>{o("createOrg")}})]})})})})})},K1=l.div`
|
|
4744
4744
|
display: flex;
|
|
4745
4745
|
gap: 8px;
|
|
4746
4746
|
flex-wrap: wrap;
|