UNPKG

@iqmo/browser

Version:
2 lines (1 loc) 2.95 kB
import{r as i,E as m,_ as p,c,b7 as g,j as o,ao as b,c1 as w,bI as E,bW as z,bE as y,bX as j,bb as C}from"./index-0xtYjrTa.js";var v=i.forwardRef(function(e,n){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(m,p({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:n}),i.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),i.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))});v.displayName="Fullscreen";var x=i.forwardRef(function(e,n){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return i.createElement(m,p({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:n}),i.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),i.createElement("path",{d:"M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"}))});x.displayName="FullscreenExit";const d="-2.65rem",T=c("div",{target:"e2wxzia2"})(({theme:e,locked:n,target:t})=>({padding:`${e.spacing.sm} 0 ${e.spacing.sm} ${e.spacing.sm}`,position:"absolute",top:n?d:"-1rem",right:e.spacing.none,transition:"none",...!n&&{opacity:0,"&:active, &:focus-visible, &:hover":{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:d},...t&&{[`${t}:hover &, ${t}:active &, ${t}:focus-visible &`]:{transition:"opacity 150ms 100ms, top 100ms 100ms",opacity:1,top:d}}}}),""),V=c("div",{target:"e2wxzia1"})(({theme:e})=>({color:g(e)?e.colors.fadedText60:e.colors.bodyText,display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"flex-end",boxShadow:"1px 2px 8px rgba(0, 0, 0, 0.08)",borderRadius:e.radii.default,backgroundColor:e.colors.lightenedBg05,width:"fit-content",zIndex:e.zIndices.sidebar+1,padding:e.spacing.twoXS}),""),H=c("div",{target:"e2wxzia0"})(({height:e,useContainerWidth:n,topCentered:t})=>({position:"relative",height:n&&e?e:"fit-content",maxWidth:"100%",width:n?"100%":"fit-content",...t?{display:"flex",justifyContent:"center"}:{}}),"");function h({label:e,show_label:n,icon:t,onClick:a}){const r=b(),s=n?e:"";return o.jsx("div",{"data-testid":"stElementToolbarButton",children:o.jsx(w,{content:o.jsx(C,{source:e,allowHTML:!1,style:{fontSize:r.fontSizes.sm}}),placement:E.TOP,onMouseEnterDelay:1e3,inline:!0,children:o.jsxs(z,{onClick:l=>{a&&a(),l.stopPropagation()},kind:y.ELEMENT_TOOLBAR,"aria-label":e,children:[t&&o.jsx(j,{content:t,size:"md",testid:"stElementToolbarButtonIcon"}),s&&o.jsx("span",{children:s})]})})})}const k=({onExpand:e,onCollapse:n,isFullScreen:t,locked:a,children:r,target:s,disableFullscreenMode:l})=>{const f=e&&!l&&!t,u=n&&!l&&t;return o.jsx(T,{className:"stElementToolbar","data-testid":"stElementToolbar",locked:a||t,target:s,children:o.jsxs(V,{"data-testid":"stElementToolbarButtonContainer",children:[r,f&&o.jsx(h,{label:"Fullscreen",icon:v,onClick:()=>e()}),u&&o.jsx(h,{label:"Close fullscreen",icon:x,onClick:()=>n()})]})})};export{H as S,k as T,h as a};