@datawheel/bespoke 0.10.0-beta.1 → 0.10.0-test.6

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/README.md CHANGED
@@ -1,11 +1,5 @@
1
1
  # Reports
2
2
 
3
- ## Documentation
4
-
5
- - **[Customization Guide](./docs/customization.md)** - Overview of styling and component customization options
6
- - **[Styling Guide](./docs/customization/styles.md)** - Detailed CSS/SCSS customization reference
7
- - **[Custom Components Guide](./docs/customization/components.md)** - How to override default components
8
-
9
3
  ## EnvVars
10
4
 
11
5
  ```
@@ -63,5 +57,3 @@ publicRuntimeConfig: {
63
57
  ```
64
58
 
65
59
  And is gonna be offered as ENV_API and ENV_WHATEVER in the list of variables in the profile.
66
-
67
- ## SCSS Mixins
package/dist/auth.js CHANGED
@@ -1 +1 @@
1
- import {useRouter}from'next/router';import {useEffect,useMemo}from'react';import {SessionProvider,useSession,signIn,signOut}from'next-auth/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Menu,Button,Text,Avatar}from'@mantine/core';import {IconUserCircle,IconLogout,IconEdit}from'@tabler/icons-react';import $ from'next/link';function T(o={required:false}){let{update:i,data:s,status:a}=useSession(o);return {update:i,user:s?.user,status:a,isLoading:a==="loading"}}var f=T;function w(o){let{SuccessComponent:i,FailureComponent:s}=o,a=new Set(o.allowedRoles);return function(n){let{user:m,status:r}=f(),l=useRouter();if(useEffect(()=>{r==="unauthenticated"&&signIn();},[r,l]),r==="loading")return jsx("div",{children:"Loading..."});if(!m)return jsx(s,{...n});let y=m.bespoke_roles||[];return a.size===0||y.some(t=>a.has(t))?jsx(i,{user:m,...n}):jsx(s,{...n})}}var N=SessionProvider;var p={ADMIN:"Admin",EDITOR:"Editor",WRITER:"Writer"},I={APP:"App",USER:"User"},z=o=>{let i=Object.values(p);return o?o.map(s=>({...s,type:i.includes(s.name)?I.APP:I.USER})):[]};function J({buttonProps:o={},editorMenuItemProps:i={},editorMenuItemRoute:s="/cms",logoutButtonProps:a={},menuProps:U={},options:n="",optionsPosition:m="bottom",translations:r={},withEditorMenuItem:l=true,withSession:y=true}){let{user:t,isLoading:S}=f(),b=useMemo(()=>t?.bespoke_roles||[],[t]),k=useMemo(()=>p&&Object.keys(p).length>0&&Object.keys(p).some(P=>b.includes(p[P])),[b]),x={leftSection:jsx(IconUserCircle,{}),...o};if(t&&!S){let P={...i},M={color:"red",fullWidth:true,leftSection:jsx(IconLogout,{size:14}),size:"xs",variant:"subtle",...a},v={shadow:"md",width:"auto",position:"bottom",...U},h=jsx($,{href:s,passHref:true,children:jsx(Menu.Item,{leftSection:jsx(IconEdit,{size:14}),...P,children:r["Go to editor"]||"Go to editor"})});return jsxs(Menu,{...v,children:[jsx(Menu.Target,{children:jsx(Button,{...x,children:`${r["Welcome message"]||`Hi, ${t.name||t.email}`}`})}),jsxs(Menu.Dropdown,{children:[m==="top"&&jsxs(Fragment,{children:[l&&k&&h,n,(n||l&&k)&&jsx(Menu.Divider,{})]}),y&&jsxs(Menu.Item,{component:"span",style:{pointerEvents:"none"},leftSection:jsx(Avatar,{src:t.picture,radius:"md"}),children:[jsx(Text,{size:"sm",fw:500,children:t.name}),jsx(Text,{c:"dimmed",size:"xs",children:t.email})]}),jsx(Button,{onClick:()=>signOut({callbackUrl:process.env.NEXT_PUBLIC_REPORTS_BASE_URL||"/"}),...M,children:r.Disconnect||"Disconnect"}),m==="bottom"&&jsxs(Fragment,{children:[(n||l&&k)&&jsx(Menu.Divider,{}),l&&k&&h,n]})]})]})}return jsx(Button,{onClick:()=>signIn(),loading:S,...x,children:S?r["Signing in"]||"Signing in...":r["Sign in"]||"Sign in"})}var X=J;export{X as BespokeLoginBtn,N as BespokeUserProvider,w as BespokeWithPageRoleAuthRequired,p as CMS_ROLES,z as addRoleTypes,f as useBespokeUser};
1
+ import {useRouter}from'next/router';import {useEffect,useMemo}from'react';import {SessionProvider,useSession,signIn,signOut}from'next-auth/react';import {jsx,jsxs,Fragment}from'react/jsx-runtime';import {Menu,Button,Text,Avatar}from'@mantine/core';import {IconUserCircle,IconLogout,IconEdit}from'@tabler/icons-react';import $ from'next/link';function T(o={required:false}){let{update:i,data:s,status:a}=useSession(o);return {update:i,user:s?.user,status:a,isLoading:a==="loading"}}var g=T;function w(o){let{SuccessComponent:i,FailureComponent:s}=o,a=new Set(o.allowedRoles);return function(n){let{user:m,status:r}=g(),l=useRouter();if(useEffect(()=>{r==="unauthenticated"&&signIn();},[r,l]),r==="loading")return jsx("div",{children:"Loading..."});if(!m)return jsx(s,{...n});let y=m.bespoke_roles||[];return a.size===0||y.some(t=>a.has(t))?jsx(i,{user:m,...n}):jsx(s,{...n})}}var N=SessionProvider;var p={ADMIN:"Admin",EDITOR:"Editor",WRITER:"Writer"},h={APP:"App",USER:"User"},z=o=>{let i=Object.values(p);return o?o.map(s=>({...s,type:i.includes(s.name)?h.APP:h.USER})):[]};function J({buttonProps:o={},editorMenuItemProps:i={},editorMenuItemRoute:s="/cms",logoutButtonProps:a={},menuProps:U={},options:n="",optionsPosition:m="bottom",translations:r={},withEditorMenuItem:l=true,withSession:y=true}){let{user:t,isLoading:P}=g(),b=useMemo(()=>t?.bespoke_roles||[],[t]),k=useMemo(()=>p&&Object.keys(p).length>0&&Object.keys(p).some(R=>b.includes(p[R])),[b]),x={leftIcon:jsx(IconUserCircle,{}),...o};if(t&&!P){let R={...i},M={color:"red",fullWidth:true,leftIcon:jsx(IconLogout,{size:14}),size:"xs",variant:"subtle",...a},v={shadow:"md",width:"auto",position:"bottom",...U},I=jsx($,{href:s,passHref:true,children:jsx(Menu.Item,{icon:jsx(IconEdit,{size:14}),...R,children:r["Go to editor"]||"Go to editor"})});return jsxs(Menu,{...v,children:[jsx(Menu.Target,{children:jsx(Button,{...x,children:`${r["Welcome message"]||`Hi, ${t.name||t.email}`}`})}),jsxs(Menu.Dropdown,{children:[m==="top"&&jsxs(Fragment,{children:[l&&k&&I,n,(n||l&&k)&&jsx(Menu.Divider,{})]}),y&&jsxs(Menu.Item,{component:"span",style:{pointerEvents:"none"},icon:jsx(Avatar,{src:t.picture,radius:"md"}),children:[jsx(Text,{size:"sm",weight:500,children:t.name}),jsx(Text,{color:"dimmed",size:"xs",children:t.email})]}),jsx(Button,{onClick:()=>signOut({callbackUrl:process.env.NEXT_PUBLIC_REPORTS_BASE_URL||"/"}),...M,children:r.Disconnect||"Disconnect"}),m==="bottom"&&jsxs(Fragment,{children:[(n||l&&k)&&jsx(Menu.Divider,{}),l&&k&&I,n]})]})]})}return jsx(Button,{onClick:()=>signIn(),loading:P,...x,children:P?r["Signing in"]||"Signing in...":r["Sign in"]||"Sign in"})}var X=J;export{X as BespokeLoginBtn,N as BespokeUserProvider,w as BespokeWithPageRoleAuthRequired,p as CMS_ROLES,z as addRoleTypes,g as useBespokeUser};
package/dist/cms.css CHANGED
@@ -1 +1 @@
1
- .C{z-index:99;overflow:hidden;transition:width .3s;box-shadow:0 4px 15px 5px #0000000d}.D{flex:1}.E{flex-grow:1}.f{display:block;width:100%}.f:hover{background-color:var(--mantine-color-gray-2)!important;transition:background-color .2s}.F{flex-shrink:0}.G{border:none;background-color:var(--mantine-color-blue-0);border-radius:var(--mantine-radius-sm);color:var(--mantine-color-blue-7);font-size:.75rem;font-weight:700;width:80px}.H{font-size:.75rem}.I{pointer-events:none}.J{max-width:100px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.h.g{font-size:11px;padding:0}.h.g .K{background-color:transparent!important;padding:0}.i .L{border-bottom:0}.i .M{padding:2px}.i .N{padding:0}.i .O{margin-right:4px}.P{border-top-right-radius:0;border-bottom-right-radius:0}.Q{border-top-left-radius:0;border-bottom-left-radius:0;border-left:1px solid #fff;background-color:#e7f5ff;min-height:1.875rem;height:1.875rem;width:1.875rem;font-size:.75rem}.R:hover{background-color:#ebebeb}.x{box-sizing:border-box;z-index:99;transition:right .4s;overflow:hidden;background:#f1f3f5}.x[data-dragging-over=true]{background:#e7f5ff}.a{transition:background-color .45s}.a .b{opacity:0;transition:opacity .45s}.a:hover{background-color:#e9ecefe6!important}.a:hover .b{opacity:1}.m{border:none;border-radius:2px}.m[data-active=true]{border:1px solid #74c0fc}.o{background:inherit;border:1px solid transparent}.o[data-dragging-over=true]{background:#e7f5ff}.o .u{visibility:hidden}.o:hover .u{visibility:visible}.o:hover{border:1px solid #96f2d7}.n{border:1px solid transparent;resize:horizontal}.n:hover{border:1px solid transparent}.n[data-show-outline=true]:hover{border:1px solid var(--mantine-color-blue-2)}.n[data-show-outline=true]:hover:before{position:absolute;top:0;left:0;font-size:8px;color:var(--mantine-color-blue-5);transform:translateY(-100%);content:attr(data-block-label);width:-moz-fit-content;width:fit-content}.S{height:100%}.l{position:"absolute";top:"50%";z-index:10;opacity:.55}.l:hover{opacity:1}.l[data-direction=left]{left:16px}.l[data-direction=right]{right:16px}.T{table-layout:fixed}.U{min-height:100px;max-height:350px;overflow-x:"auto";background:red}.V{padding:5px!important;text-wrap:wrap}.v{display:block}@media(min-width:1000px){.v{display:none}}.y{display:none}@media(min-width:1000px){.y{display:block}}.W{border-radius:4px;transform:translate(-50%);z-index:20}.w{flex-direction:column}@media(min-width:62em){.w{flex-direction:row}}.k{max-width:100%;min-width:unset}@media(min-width:62em){.k{max-width:var(--column-max-width);min-width:300px}}.z{position:relative}.z:before{content:"";position:absolute;top:.25rem;bottom:.25rem;left:calc(.875rem + var(--level) * 1.5rem);width:.0625rem;background-color:#dee2e6;z-index:0}.d{display:flex;gap:1rem;align-items:center;list-style-type:none}.d[data-align=left]{justify-content:flex-start}.d[data-align=center]{justify-content:center}.d[data-align=right]{justify-content:flex-end}.r{display:flex}.r[data-align=left]{justify-content:flex-start}.r[data-align=center]{justify-content:center}.r[data-align=right]{justify-content:flex-end}.r li{margin-right:1rem}.j{display:flex}.j .chart{flex:1 1 100%}.X{width:60px}.Z:after{content:" *";color:red}.Y{background-color:transparent}.Y[data-selected=true]{background-color:#e7f5ff}.t{font-size:14px;line-height:1.2;background-color:var(--mantine-color-gray-0);border-color:var(--mantine-color-gray-4);border-width:1px;border-style:solid;border-radius:var(--mantine-radius-md);padding-left:var(--mantine-spacing-xs);padding-right:var(--mantine-spacing-xs);font-weight:400}.t._{color:var(--mantine-color-gray-7);background-color:var(--mantine-color-gray-1)}.t:focus-visible{outline-color:var(--mantine-color-blue-5);background-color:var(--mantine-color-gray-0)}.t code{font-family:monospace;color:var(--mantine-color-blue-6);font-weight:700;letter-spacing:.02em}.t .ee:first-of-type:before{color:var(--mantine-color-gray-6);content:attr(data-placeholder);float:left;height:0;pointer-events:none}.oe{align-items:stretch;margin:0;position:relative}.re{display:flex;flex-direction:column}.te{position:absolute;right:0;top:0}.ie{flex-grow:1;display:flex;flex-direction:column}.ae{flex-grow:1}.ne{align-self:stretch;display:flex;flex-direction:column;height:100%;position:relative}.le{align-self:stretch;display:flex;flex-direction:column;height:100%;border-left:2px solid var(--mantine-color-gray-0)}.de{display:flex;flex-direction:column;border-left:2px solid var(--mantine-color-gray-0)}.ce~.se{min-height:calc(100vh - 50px)}.p{height:0}.p button{background-color:#fff;opacity:0;transition:opacity .1s;z-index:2}.e:hover>.p button{opacity:1}.e:hover .q,.e:hover .pe,.q.fe{opacity:1}.e:hover .A,.e.he .A{opacity:.4}.e .ge{min-height:20px}.xe{max-height:90vw}.be pre{font-size:12px;line-height:1.25}.me{overflow:hidden;border-right:1px solid #dee2e6;flex-shrink:0;flex-grow:0}.B{border:1px solid transparent;cursor:default}.B:hover{border:1px solid blue}.c{cursor:default;border:1px solid transparent}.c .ue{color:var(--section-color)}.c[data-active=true]{border:1px solid #dee2e6}.c:hover{border:1px solid #339af0}.ve{overflow:hidden;border-left:1px solid #dee2e6;flex-shrink:0;flex-grow:0}.s{backdrop-filter:none;opacity:0}.s button{display:none}.s:hover{opacity:1;backdrop-filter:blur(.2375rem)}.s:hover button{display:flex}
1
+ .mantine-Prism-root.cr-variable{font-size:11px;padding:0}.mantine-Prism-root.cr-variable .mantine-Prism-code{background-color:transparent!important;padding:0}.cr-variable-accordion .mantine-Accordion-item{border-bottom:0}.cr-variable-accordion .mantine-Accordion-control{padding:2px}.cr-variable-accordion .mantine-Accordion-contentInner{padding:0}.cr-variable-accordion .mantine-Accordion-icon{margin-right:4px}.cr-monaco-container{height:100%}.selector-option-default-col{width:60px}.required:after{content:" *";color:red}.cr-block-output{align-items:stretch;margin:0;position:relative}.cr-block-output .cr-block-output-editor{display:flex;flex-direction:column}.cr-block-output .cr-block-output-mode-control{position:absolute;right:0;top:0}.mantine-Header-root~.mantine-AppShell-body{min-height:calc(100vh - 50px)}.cms-section-controls{height:0}.cms-section-controls button{background-color:#fff;opacity:0;transition:opacity .1s;z-index:2}.cms-section-container:hover>.cms-section-controls button{opacity:1}.cms-section-container:hover .cms-section-header,.cms-section-container:hover .cms-section-click-to-edit,.cms-section-header.active{opacity:1}.cms-section-container:hover .cms-section-overlay,.cms-section-container.isDragging .cms-section-overlay{opacity:.4}.cms-section-container .cms-section-content{min-height:20px}.mantine-Modal-body{max-height:90vw}.mantine-Prism-root pre{font-size:12px;line-height:1.25}