@chayns-components/emoji-input
Version:
Input field that supports HTML elements and emojis
104 lines (100 loc) • 3.2 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.StyledMotionEmojiInputProgress = exports.StyledMotionEmojiInputEditor = exports.StyledEmojiInputRightWrapper = exports.StyledEmojiInputLabel = exports.StyledEmojiInputContent = exports.StyledEmojiInput = void 0;
var _react = require("motion/react");
var _styledComponents = _interopRequireDefault(require("styled-components"));
var _font = require("../../utils/font");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const StyledEmojiInput = exports.StyledEmojiInput = _styledComponents.default.div`
align-items: center;
background-color: ${({
theme,
$shouldChangeColor
}) => theme.colorMode === 'classic' || $shouldChangeColor ? theme['000'] : theme['100']};
border-radius: 3px;
display: flex;
border: 1px solid rgba(160, 160, 160, 0.3);
min-height: 42px;
opacity: ${({
$isDisabled
}) => $isDisabled ? 0.5 : 1};
pointer-events: ${({
$isDisabled
}) => $isDisabled ? 'none' : 'initial'};
position: relative;
transition: opacity 0.3s ease;
`;
const StyledMotionEmojiInputProgress = exports.StyledMotionEmojiInputProgress = (0, _styledComponents.default)(_react.motion.div)`
background-color: ${({
theme
}) => theme['402']};
height: 100%;
position: absolute;
z-index: 2;
border-radius: 3px;
`;
const StyledEmojiInputContent = exports.StyledEmojiInputContent = _styledComponents.default.div`
align-items: end;
border-radius: 3px;
display: flex;
flex: 1 1 auto;
gap: 10px;
padding: 8px 10px;
z-index: 3;
`;
const StyledMotionEmojiInputEditor = exports.StyledMotionEmojiInputEditor = (0, _styledComponents.default)(_react.motion.div)`
color: ${({
theme,
$shouldShowContent
}) => $shouldShowContent ? theme.text : theme['100']};
flex: 1 1 auto;
font-family: ${_font.getFontFamily};
overflow-y: scroll;
overflow-x: hidden;
word-break: break-word;
// This fixes a bug where the field is not editable in certain browsers.
// This is for example the case on iOS 15 or older.
-webkit-user-modify: read-write;
-webkit-user-select: text;
lc_mention,
nerIgnore,
nerReplace {
font-weight: bold;
span {
opacity: 0.5;
}
}
`;
const StyledEmojiInputRightWrapper = exports.StyledEmojiInputRightWrapper = _styledComponents.default.div`
align-self: stretch;
border-bottom-right-radius: 3px;
border-top-right-radius: 3px;
flex: 0 0 auto;
overflow: hidden;
`;
const StyledEmojiInputLabel = exports.StyledEmojiInputLabel = _styledComponents.default.label`
color: rgba(${({
theme
}) => theme['text-rgb']}, 0.45);
left: ${({
$offsetWidth
}) => $offsetWidth ? `${$offsetWidth + 10}px` : '10px'};
top: 12px;
align-items: baseline;
display: flex;
flex: 0 0 auto;
gap: 4px;
line-height: 1.3;
pointer-events: none;
position: absolute;
user-select: none;
white-space: nowrap;
max-width: ${({
$maxWidth,
$offsetWidth
}) => `${$maxWidth - ($offsetWidth ?? 0)}px`};
overflow: hidden;
`;
//# sourceMappingURL=EmojiInput.styles.js.map