@arche-mc2/arche-controls
Version:
We know that there are a ton of react UI library projects to choose from. Our hope with this one is to provide the next generation of react components that you can use to bootstrap your next project, or as a reference for building a UIKit. Read on to get
163 lines • 7.53 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
var typestyle_1 = require("typestyle");
var classnames = require("classnames");
var animations_1 = require("../../../Common/theming/animations");
var utils_1 = require("../../../Common/theming/utils");
var colorMap_1 = require("../../../Common/theming/colorMap");
var isCssWidthValue = function (value) {
if (typeof value === 'number') {
return true;
}
if (typeof value !== 'string') {
return false;
}
if (value === '0') {
return true;
}
var regex = /^(\d+|\d*\.\d+)(px|%|em|rem|ex|ch|pt|pc|cm|mm|in|vh|vw|vmin|vmax)$/;
return regex.test(value);
};
var cssModal = function (_a) {
var modalWidth = _a.modalWidth, displayMode = _a.displayMode, showModal = _a.showModal, theme = _a.theme, screenPosition = _a.screenPosition;
return typestyle_1.style({
$nest: {
'& .up-modal': {
position: 'fixed',
top: 0,
right: 0,
bottom: 0,
left: 0,
zIndex: 1050,
overflowY: 'auto',
outline: 0,
opacity: 0,
visibility: !showModal ? 'hidden' : 'visible',
$nest: {
'&.fade': {
visibility: 'hidden',
transition: '.5s ease-in-out',
$nest: {
'& .up-modal_dialog': tslib_1.__assign({ transition: 'transform 1s ease-out', transform: 'translate(0, -25%)' }, (modalWidth !== 'default' && {
overflowY: 'hidden',
maxWidth: modalWidth === 'half' ? '50%' : 'auto',
marginLeft: displayMode === 'fromRight'
? modalWidth === 'full'
? '0'
: modalWidth === 'half'
? '50%'
: 'unset'
: '0',
transition: 'unset',
transform: 'unset',
})),
},
},
'&.in': tslib_1.__assign(tslib_1.__assign({ visibility: 'visible', transition: '.5s ease-in-out', animationDuration: '1s', opacity: 1 }, (modalWidth !== 'default' && tslib_1.__assign({}, animationProp('fadeIn', displayMode)))), { $nest: {
'& .up-modal_dialog': tslib_1.__assign({ transition: 'transform 1s ease-out', transform: 'translate(0, 0)' }, (modalWidth !== 'default' && {
overflowY: 'hidden',
})),
} }),
},
},
'& .up-modal_dialog': tslib_1.__assign(tslib_1.__assign({ position: 'relative' }, (screenPosition === 'center' && {
top: '40%',
transform: 'translateY(-100%) !important',
})), (modalWidth === 'default'
? {
minWidth: '600px',
maxWidth: '70%',
margin: utils_1.toRem(30) + " auto",
}
: displayMode === 'fromRight'
? {
display: 'flex',
width: '100%',
flexDirection: 'row-reverse',
}
: displayMode === 'fromLeft'
? {
display: 'flex',
width: '100%',
flexDirection: 'row',
}
: '')),
'& .up-modal_content': tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ position: 'relative', backgroundColor: (theme === null || theme === void 0 ? void 0 : theme.colorMap.white) || '#FFF', border: '1px solid #0009', borderRadius: utils_1.toRem(6), outline: 0, boxShadow: '0 3px 9px rgba(0, 0, 0, .5)' }, (modalWidth !== 'default' && {
padding: utils_1.toRem(150) + " " + utils_1.toRem(105) + " " + utils_1.toRem(15),
display: 'flex',
flexDirection: 'column',
height: '100vh',
borderRadius: '0',
})), (isCssWidthValue(modalWidth) && {
width: modalWidth,
})), (modalWidth === 'half' && {
width: '50%',
})), (modalWidth === 'full' && {
width: '100%',
})),
'& .up-modal_header': {
display: 'flex',
justifyContent: 'space-between',
padding: utils_1.toRem(15),
},
'& .up-modal_title': tslib_1.__assign({ margin: 0, fontWeight: 400, color: (theme === null || theme === void 0 ? void 0 : theme.colorMap.primary) || colorMap_1.default.primary }, (modalWidth !== 'default' && {
fontSize: utils_1.toRem(18),
fontWeight: 'bold',
})),
'& .up-modal_close': tslib_1.__assign({ cursor: 'pointer', $nest: {
'& svg': {
width: utils_1.toRem(20),
height: utils_1.toRem(20),
$nest: {
'& path': {
fill: (theme === null || theme === void 0 ? void 0 : theme.colorMap.primary) || colorMap_1.default.primary,
},
},
},
} }, (modalWidth !== 'default' && {
position: 'absolute',
top: utils_1.toRem(50),
right: utils_1.toRem(50),
zIndex: 1000,
})),
'& .up-modal_body': {
padding: utils_1.toRem(15),
},
'& .up-modal_footer': {
padding: utils_1.toRem(15),
textAlign: 'right',
borderTop: '1px solid ' + (theme === null || theme === void 0 ? void 0 : theme.colorMap.white3) || colorMap_1.default.white3,
},
'& .up-modal_backdrop': {
position: 'fixed',
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: (theme === null || theme === void 0 ? void 0 : theme.colorMap.black3) || colorMap_1.default.black3,
opacity: 0.7,
overflow: 'hidden',
zIndex: 1040,
$nest: {
'&.fade': {
filter: 'alpha(opacity=0)',
opacity: 0,
},
'&.in': {
filter: 'alpha(opacity=50)',
opacity: 0.5,
},
},
},
},
});
};
var animationProp = function (fade, displayMode) {
if (fade === 'fadeIn')
return animations_1.fullAnimationProp(0.5, 'ease', fade, displayMode);
};
exports.getStyles = function (props) {
return classnames(cssModal(props));
};
//# sourceMappingURL=styles.js.map