UNPKG

@iqmo/browser

Version:

Browser Stlite

2 lines (1 loc) 2.95 kB
import{r as o,E as m,_ as p,c,C as g,j as i,z as b,b$ as w,bH as z,bV as E,bC as C,bW as y,b4 as j}from"./index-C9lG8Cnd.js";var v=o.forwardRef(function(e,n){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(m,p({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:n}),o.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),o.createElement("path",{d:"M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"}))});v.displayName="Fullscreen";var x=o.forwardRef(function(e,n){var t={fill:"currentColor",xmlns:"http://www.w3.org/2000/svg"};return o.createElement(m,p({iconAttrs:t,iconVerticalAlign:"middle",iconViewBox:"0 0 24 24"},e,{ref:n}),o.createElement("path",{fill:"none",d:"M0 0h24v24H0V0z"}),o.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"})(({width:e,height:n,useContainerWidth:t,topCentered:a})=>({position:"relative",height:t&&n?n:"fit-content",width:t?e:"fit-content",maxWidth:"100%",...a?{display:"flex",justifyContent:"center"}:{}}),"");function h({label:e,show_label:n,icon:t,onClick:a}){const r=b(),s=n?e:"";return i.jsx("div",{"data-testid":"stElementToolbarButton",children:i.jsx(w,{content:i.jsx(j,{source:e,allowHTML:!1,style:{fontSize:r.fontSizes.sm}}),placement:z.TOP,onMouseEnterDelay:1e3,inline:!0,children:i.jsxs(E,{onClick:l=>{a&&a(),l.stopPropagation()},kind:C.ELEMENT_TOOLBAR,"aria-label":e,children:[t&&i.jsx(y,{content:t,size:"md",testid:"stElementToolbarButtonIcon"}),s&&i.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 i.jsx(T,{className:"stElementToolbar","data-testid":"stElementToolbar",locked:a||t,target:s,children:i.jsxs(V,{"data-testid":"stElementToolbarButtonContainer",children:[r,f&&i.jsx(h,{label:"Fullscreen",icon:v,onClick:()=>e()}),u&&i.jsx(h,{label:"Close fullscreen",icon:x,onClick:()=>n()})]})})};export{H as S,k as T,h as a};