@braineet/ui
Version:
Braineet design system
145 lines • 5.03 kB
JavaScript
import { animated } from 'react-spring/renderprops.cjs';
import styled, { css } from 'styled-components';
import { variant } from 'styled-system';
import { borderRadius } from '../../utils';
import Box from '../box';
var types = {
standard: {
direction: 'column'
},
confirmation: {
alignItems: 'center',
direction: 'column'
}
};
var DefaultModalwrapper = styled.div.withConfig({
displayName: "styles__DefaultModalwrapper",
componentId: "sc-1oll552-0"
})(["display:flex;justify-content:center;position:fixed;width:100vw;height:100vh;left:0px;top:0px;overflow:", ";z-index:", ";", ""], function (p) {
return p.scrollBehavior && p.scrollBehavior === 'inside' ? 'hidden' : 'auto';
}, function (props) {
return props.theme.zIndex.modal;
}, function (p) {
return p.isCentered && css(["align-items:center !important;"]);
});
export var ModalWrapper = styled(DefaultModalwrapper).withConfig({
displayName: "styles__ModalWrapper",
componentId: "sc-1oll552-1"
})(variant({
variants: {
standard: {
alignItems: 'flex-start'
},
confirmation: {
alignItems: 'center'
}
}
}));
export var ModalInner = styled(animated.div).withConfig({
displayName: "styles__ModalInner",
componentId: "sc-1oll552-2"
})(["position:relative;display:flex;", " padding:", ";", " box-shadow:0 8px 16px -8px ", ";background-color:", ";animation-timing-function:cubic-bezier(0,1,1,1);color:inherit;z-index:", ";max-width:692px;border:2px solid ", ";outline:0px;.focusLockModal{display:flex;flex-direction:column;flex-grow:1;border-radius:inherit;width:100%;}", " ", ""], function (p) {
return p.$standalone ? 'flex-direction: column;' : '';
}, function (p) {
return p.theme.spaces.md;
}, borderRadius(16), function (p) {
return p.theme.utils.lighten('black', 0.32);
}, function (p) {
return p.theme.colors.background.white;
}, function (props) {
return props.theme.zIndex.modal;
}, function (p) {
return p.theme.utils.lighten('black', 0.1);
}, function (props) {
return variant({
prop: 'size',
variants: {
xxs: {
width: props.$width || '100%',
maxWidth: '24rem',
marginTop: '3.75rem',
marginBottom: '3.75rem',
maxHeight: props.$scrollBehavior === 'inside' ? 'calc(100% - 7.5rem)' : null
},
xs: {
width: props.$width || '100%',
maxWidth: '28rem',
marginTop: '3.75rem',
marginBottom: '3.75rem',
maxHeight: props.$scrollBehavior === 'inside' ? 'calc(100% - 7.5rem)' : null
},
sm: {
width: props.$width || '100%',
maxWidth: '32rem',
marginTop: '3.75rem',
marginBottom: '3.75rem',
maxHeight: props.$scrollBehavior === 'inside' ? 'calc(100% - 7.5rem)' : null
},
md: {
width: props.$width || '100%',
maxWidth: '36rem',
marginTop: '3.75rem',
marginBottom: '3.75rem',
maxHeight: props.$scrollBehavior === 'inside' ? 'calc(100% - 7.5rem)' : null
},
lg: {
width: props.$width || '100%',
maxWidth: '40rem',
marginTop: '3.75rem',
marginBottom: '3.75rem',
maxHeight: props.$scrollBehavior === 'inside' ? 'calc(100% - 7.5rem)' : null
},
xl: {
width: props.$width || '100%',
maxWidth: '44rem',
marginTop: '3.75rem',
marginBottom: '3.75rem',
maxHeight: props.$scrollBehavior === 'inside' ? 'calc(100% - 7.5rem)' : null
},
fullscreen: {
width: props.$width || '100%',
maxWidth: '100%',
marginTop: '0',
marginBottom: '0',
height: props.$scrollBehavior === 'inside' ? '100%' : null,
minHeight: props.$scrollBehavior === 'outside' ? '100%' : null
},
fullscreenSticky: {
width: props.$width || 'calc(100vw - 1rem)',
maxWidth: 'calc(100vw - 1rem)',
marginTop: '8px',
marginBottom: '0',
borderBottomLeftRadius: 0,
borderBottomRightRadius: 0,
borderBottom: 'none',
height: props.$scrollBehavior === 'inside' ? 'calc(100% - 8px)' : null,
minHeight: props.$scrollBehavior === 'outside' ? 'calc(100% - 8px)' : null
}
}
});
}, function (p) {
return p.$modalInnerStyles;
});
export var ModalContentInner = styled(Box).withConfig({
displayName: "styles__ModalContentInner",
componentId: "sc-1oll552-3"
})({
display: 'flex',
height: '100%',
flexDirection: function flexDirection(props) {
return types[props.variant].direction;
},
alignItems: function alignItems(props) {
return types[props.variant].alignItems;
}
});
export var ModalOverlay = styled(Box).withConfig({
displayName: "styles__ModalOverlay",
componentId: "sc-1oll552-4"
})(["position:fixed;left:0px;top:0px;width:100vw;height:100vh;z-index:", ";background-color:", ";", ""], function (props) {
return props.theme.zIndex.modal;
}, function (p) {
return p.theme.utils.lighten(p.theme.colors.black90, 0.6);
}, function (p) {
return p.overlayStyles;
});