// Module ID: 13442 // Function ID: 13443 // Name: Fonts // Dependencies: [109, 19, 17, 676, 21, 4303, 712, 5158, 4013, 1297, 4299, 1236, 5996, 4153, 11560, 500, 2] // Module 13442 (Fonts) import _objectWithoutProperties from "_objectWithoutProperties"; import get_ActivityIndicator from "get ActivityIndicator"; import { Fonts } from "ME"; import jsxProd from "jsxProd"; import createCacheKey from "createCacheKey"; import importAllResult from "noop"; let Platform; let c10; let c5; let c9; let closure_6; let error; let require = arg1; let closure_3 = ["numberOfLines", "disableConstantNumberOfLines", "inputTextColor", "placeholder", "placeholderTextColor", "editable", "large", "accessibilityHint", "maxLength", "inActionSheet", "trailingButton", "clearButtonVisibility", "disabled", "style", "inputTextStyle", "onChangeText", "onFocus", "value"]; ({ View: c5, Pressable: closure_6, TouchableWithoutFeedback: error, Platform } = get_ActivityIndicator); ({ jsx: c9, jsxs: c10 } = jsxProd); createCacheKey = { disabled: { opacity: 0.5 }, topContainer: { minHeight: 16, alignItems: "center", flexDirection: "row", marginBottom: 5, flexWrap: "wrap" }, inputViewTitle: { marginRight: 5 }, inputViewError: null, inputBorder: null, inputView: null, inputViewBorder: null, inputViewBorderActive: null, inputContainer: null, bottomContainer: null, charactersLength: null, closeIcon: null, clearButton: null, required: null }; createCacheKey = { fontSize: 10, color: require("Themes").unsafe_rawColors.RED_400 }; createCacheKey[3] = createCacheKey; createCacheKey[4] = { backgroundColor: require("Themes").colors.TEXT_MUTED }; let obj1 = { backgroundColor: require("Themes").colors.TEXT_MUTED }; createCacheKey[5] = { fontSize: 16, paddingBottom: 0, paddingTop: 0, textAlignVertical: "top", flex: 1, color: require("result").DARK_PRIMARY_100_LIGHT_PRIMARY_500 }; createCacheKey[6] = { marginTop: 8, height: 2 }; let obj2 = { fontSize: 16, paddingBottom: 0, paddingTop: 0, textAlignVertical: "top", flex: 1, color: require("result").DARK_PRIMARY_100_LIGHT_PRIMARY_500 }; createCacheKey[7] = { backgroundColor: require("Themes").unsafe_rawColors.TRANSPARENT }; createCacheKey[8] = { flexDirection: "row", alignItems: "center", position: "relative" }; createCacheKey[9] = { marginTop: 5 }; let obj3 = { backgroundColor: require("Themes").unsafe_rawColors.TRANSPARENT }; createCacheKey[10] = { alignSelf: "flex-end", fontFamily: Fonts.CODE_BOLD, color: require("result").DARK_PRIMARY_400_LIGHT_PRIMARY_300 }; let obj4 = { alignSelf: "flex-end", fontFamily: Fonts.CODE_BOLD, color: require("result").DARK_PRIMARY_400_LIGHT_PRIMARY_300 }; createCacheKey[11] = { tintColor: require("Themes").colors.INTERACTIVE_TEXT_DEFAULT }; createCacheKey[12] = { position: "absolute", right: 6 }; let obj5 = { tintColor: require("Themes").colors.INTERACTIVE_TEXT_DEFAULT }; createCacheKey[13] = { color: require("Themes").unsafe_rawColors.RED_400 }; createCacheKey = createCacheKey.createLegacyClassComponentStyles(createCacheKey); const obj7 = { NEVER: "never", WITH_CONTENT: "with-content", ALWAYS: "always" }; const PureComponent = importAllResult.PureComponent; class InputView extends PureComponent { constructor() { applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target); closure_0 = applyArgumentsResult; applyArgumentsResult.state = { active: false, value: applyArgumentsResult.props.value, valueProp: applyArgumentsResult.props.value }; applyArgumentsResult._ref = undefined; applyArgumentsResult.handleFocus = function handleFocus() { const onFocus = applyArgumentsResult.props.onFocus; if (onFocus != null) { onFocus(); } applyArgumentsResult.setState({ active: true }); }; applyArgumentsResult.handleBlur = function handleBlur() { applyArgumentsResult.setState({ active: false }); }; applyArgumentsResult.handleChangeText = function handleChangeText(value) { value.setState({ value }, () => { const onChangeText = value.props.onChangeText; if (onChangeText != null) { onChangeText(value); } }); }; applyArgumentsResult.handleClear = function handleClear() { applyArgumentsResult.handleChangeText(""); }; applyArgumentsResult.handleEndEditing = function handleEndEditing() { const onEnd = applyArgumentsResult.props.onEnd; if (onEnd != null) { onEnd(applyArgumentsResult.state.value); } }; applyArgumentsResult.handleSubmitEditing = function handleSubmitEditing() { const onNext = applyArgumentsResult.props.onNext; if (onNext != null) { onNext(); } }; applyArgumentsResult.getText = function getText() { return applyArgumentsResult.state.value; }; applyArgumentsResult.isFocused = function isFocused() { const _ref = applyArgumentsResult._ref; let flag; if (_ref != null) { flag = _ref.isFocused(); } if (flag == null) { flag = false; } return flag; }; applyArgumentsResult.focus = function focus() { const _ref = applyArgumentsResult._ref; if (_ref != null) { _ref.focus(); } }; applyArgumentsResult.blur = function blur() { const _ref = applyArgumentsResult._ref; if (_ref != null) { _ref.blur(); } }; applyArgumentsResult.setText = function setText(arg0) { const _ref = applyArgumentsResult._ref; if (_ref != null) { const obj = { text: null }; obj[0] = arg0; _ref.setNativeProps(obj); } }; applyArgumentsResult.setRef = function setRef(_ref) { closure_0._ref = _ref; }; applyArgumentsResult.measure = function measure(arg0) { const _ref = applyArgumentsResult._ref; if (_ref != null) { _ref.measure(arg0); } }; applyArgumentsResult.measureInWindow = function measureInWindow(arg0) { const _ref = applyArgumentsResult._ref; if (_ref != null) { _ref.measureInWindow(arg0); } }; applyArgumentsResult.measureLayout = function measureLayout(arg0, arg1, arg2) { const _ref = applyArgumentsResult._ref; if (_ref != null) { _ref.measureLayout(arg0, arg1, arg2); } }; return applyArgumentsResult; } } const prototype = InputView.prototype; InputView["getDerivedStateFromProps"] = function getDerivedStateFromProps(value, valueProp) { value = value.value; if (value !== valueProp.valueProp) { if (value !== valueProp.value) { const obj = { value: null, valueProp: null }; obj[0] = value; obj[1] = value; } return { valueProp: value }; } }; prototype["renderBorder"] = function renderBorder() { const tmp = createCacheKey(this.context); const props = this.props; let backgroundColor = props.borderColor; if (props.showBorder) { if (backgroundColor == null) { backgroundColor = tmp.inputBorder.backgroundColor; } const items = [tmp.inputViewBorder, , ]; let obj = { backgroundColor: null }; obj[0] = backgroundColor; items[1] = obj; let inputViewBorderActive = this.state.active; if (inputViewBorderActive) { inputViewBorderActive = tmp.inputViewBorderActive; } obj = { style: null }; items[2] = inputViewBorderActive; obj[0] = items; return closure_9(closure_5, obj); } else { return null; } }; prototype["renderTopContainer"] = function renderTopContainer() { let error; let errorProps; let errorStyles; let helpText; let required; let showTopContainer; let title; const tmp = createCacheKey(this.context); const props = this.props; ({ error, title, errorProps, helpText } = props); let tmp2 = null != error; ({ showTopContainer, errorStyles, required } = props); if (tmp2) { tmp2 = "" !== error; } let tmp3; if (tmp2) { let obj = {}; const merged = Object.assign(errorProps); const items = [tmp.inputViewError, errorStyles]; obj.style = items; const items1 = ["(", error, ")"]; obj.children = items1; tmp3 = callback3(require(1297) /* Button */.LegacyText, obj); } let tmp10 = null != title; if (tmp10) { tmp10 = "" !== title; } let tmp12Result; if (tmp10) { let str5 = "text-default"; if (null !== error) { str5 = "text-default"; if ("" !== error) { str5 = "text-feedback-critical"; } } obj = { variant: "heading-md/semibold", color: null, style: null, children: null }; obj[1] = str5; const items2 = [tmp.inputViewTitle]; obj[2] = items2; obj[3] = title; tmp12Result = callback2(require(4299) /* Text */.Text, obj); const tmp12 = callback2; } let tmp15 = null != helpText; if (tmp15) { tmp15 = "" !== helpText; } let tmp16; if (tmp15) { obj = { variant: "text-xs/medium", children: null }; obj[1] = helpText; tmp16 = callback2(require(4299) /* Text */.Text, obj); } const obj1 = { style: tmp.topContainer, children: null }; const items3 = [tmp12Result, tmp16, , ]; let tmp22 = null == tmp3; if (tmp22) { tmp22 = required; } if (tmp22) { const obj2 = { style: null, children: "*" }; obj2[0] = tmp.required; tmp22 = callback2(require(1297) /* Button */.LegacyText, obj2); } items3[2] = tmp22; items3[3] = tmp3; obj1[1] = items3; return callback3(closure_5, obj1); }; prototype["renderBottomContainer"] = function renderBottomContainer() { const self = this; const tmp = createCacheKey(this.context); const props = this.props; const maxLength = props.maxLength; let tmp2 = null; if (props.showCharactersRemaining) { tmp2 = null; if (null != maxLength) { let obj = { style: null, children: null }; obj[0] = tmp.bottomContainer; obj = { accessible: true, style: null, accessibilityLabel: null, children: null }; obj[1] = tmp.charactersLength; const intl = require(1236) /* getSystemLocale */.intl; obj = { remainingCharacters: null }; obj[0] = maxLength - self.getText().length; obj[2] = intl.formatToPlainString(require(1236) /* getSystemLocale */.t.fR1cof, obj); obj[3] = maxLength - self.getText().length; obj[1] = callback2(require(1297) /* Button */.LegacyText, obj); tmp2 = callback2(closure_5, obj); } } return tmp2; }; prototype["renderTrailingButton"] = function renderTrailingButton() { let clearButtonAccessibilityLabel; let clearButtonVisibility; let trailingButton; const self = this; ({ trailingButton, clearButtonVisibility, clearButtonAccessibilityLabel } = this.props); if (null == trailingButton) { if (clearButtonVisibility === obj7.ALWAYS) { const obj = { hitSlop: 16, style: null, onPress: null, accessible: true, accessibilityRole: "button", accessibilityLabel: null, children: null }; obj[1] = tmp.clearButton; obj[2] = self.handleClear; if (clearButtonAccessibilityLabel == null) { const intl = require(1236) /* getSystemLocale */.intl; clearButtonAccessibilityLabel = intl.string(require(1236) /* getSystemLocale */.t.VkKicb); } obj[5] = clearButtonAccessibilityLabel; obj[6] = closure_9(require(5996) /* CircleXIcon */.CircleXIcon, { size: "sm" }); let tmp3Result = tmp3(closure_6, obj); const tmp4 = closure_6; } else { tmp3Result = null; if (clearButtonVisibility === tmp9.WITH_CONTENT) { tmp3Result = null; } } trailingButton = tmp3Result; } return trailingButton; }; prototype["renderTextView"] = function renderTextView() { let accessibilityHint; let clearButtonVisibility; let disableConstantNumberOfLines; let disabled; let editable; let inActionSheet; let inputTextColor; let inputTextStyle; let large; let maxLength; let numberOfLines; let onChangeText; let onFocus; let placeholder; let placeholderTextColor; let style; let trailingButton; let value; const self = this; const props = this.props; ({ numberOfLines, inputTextColor, placeholder, placeholderTextColor, large, maxLength, trailingButton, clearButtonVisibility, style, onChangeText, onFocus, value } = props); ({ disableConstantNumberOfLines, editable, accessibilityHint, inActionSheet, disabled, inputTextStyle } = props); const tmp2 = callback(props, closure_3); const items = [createCacheKey(this.context).inputView, , , , ]; if (disableConstantNumberOfLines) { let num2 = 21; if (large) { num2 = 30; } let obj = { maxHeight: null }; obj[0] = num2 * numberOfLines; } else { let num = 21; if (large) { num = 30; } obj = { minHeight: null }; obj[0] = num * numberOfLines; } items[1] = obj; if (null != inputTextColor) { obj = { color: null }; obj[0] = inputTextColor; let obj1 = obj; } else { obj1 = {}; } items[2] = obj1; if (large) { const obj2 = { fontSize: 25, fontFamily: null }; obj2[1] = Fonts.PRIMARY_SEMIBOLD; let obj3 = obj2; } else { obj3 = {}; } items[3] = obj3; items[4] = inputTextStyle; if (placeholderTextColor != null) { let formatToPlainStringResult; if (null != maxLength) { const intl = require(1236) /* getSystemLocale */.intl; const obj4 = { maxLength: null }; obj4[0] = maxLength; formatToPlainStringResult = intl.formatToPlainString(require(1236) /* getSystemLocale */.t["+DFxLc"], obj4); } const items1 = [formatToPlainStringResult, accessibilityHint]; const _Boolean = Boolean; const found = items1.filter(Boolean); const joined = found.join(","); if (inActionSheet) { let TextInput = importDefault(11560); } else { TextInput = require(1297) /* Button */.TextInput; } const obj5 = { accessibilityState: null, style: null, ref: null, onChangeText: null, onFocus: null, onBlur: null, onEndEditing: null, onSubmitEditing: null, value: null, clearButtonMode: "never", placeholder: null, placeholderTextColor: null, editable: null, maxLength: null, accessibilityHint: null }; let obj6 = { disabled: null }; obj6[0] = disabled; obj5[0] = obj6; obj5[1] = items; ({ setRef: obj10[2], handleChangeText: obj10[3], handleFocus: obj10[4], handleBlur: obj10[5], handleEndEditing: obj10[6], handleSubmitEditing: obj10[7] } = self); obj5[8] = this.state.value; obj5[10] = placeholder; obj5[11] = placeholderTextColor; obj5[12] = editable; obj5[13] = maxLength; obj5[14] = joined; const merged = Object.assign(tmp2); return closure_9(TextInput, obj5); } else { obj6 = require(4153) /* AccessibilityAnnouncer */; const unsafe_rawColors = importDefault(712).unsafe_rawColors; const isThemeDarkResult = obj6.isThemeDark(self.context.theme); } }; prototype["render"] = function render() { const self = this; const tmp = createCacheKey(this.context); const props = this.props; const disabled = props.disabled; let obj = { accessible: false, onPress: this.focus, children: null }; const items = [props.style, ]; let disabled2 = disabled; if (disabled) { disabled2 = tmp.disabled; } obj = { style: items, pointerEvents: null, children: null }; items[1] = disabled2; let str = "auto"; if (disabled) { str = "none"; } obj[1] = str; const items1 = [self.renderTopContainer(), , , , ]; obj = { style: items2, children: null }; items2 = [tmp.inputContainer, props.inputContainerStyle]; const items3 = [self.renderTextView(), self.renderTrailingButton()]; obj[1] = items3; items1[1] = closure_10(closure_5, obj); const obj4 = require(500) /* set */; const tmp2 = closure_9; const tmp3 = closure_7; const tmp6 = require; items1[2] = require(500) /* set */.isAndroid() && self.renderBorder(); items1[3] = self.renderBottomContainer(); const tmp8 = require(500) /* set */.isAndroid() && self.renderBorder(); const isAndroidResult = tmp6(500).isAndroid(); let renderBorderResult = !isAndroidResult; if (!isAndroidResult) { renderBorderResult = self.renderBorder(); } items1[4] = renderBorderResult; obj[2] = items1; obj[2] = closure_10(closure_5, obj); return tmp2(tmp3, obj); }; InputView.contextType = require("ManaContext").ThemeContext; InputView.defaultProps = { showBorder: true, value: "", returnKeyType: "next", disabled: false, autoFocus: false, multiline: false, numberOfLines: 1, showTopContainer: true, showCharactersRemaining: false, clearButtonVisibility: "never", inActionSheet: false }; let obj6 = { color: require("Themes").unsafe_rawColors.RED_400 }; const result = require("get ActivityIndicator").fileFinishedImporting("design/void/InputView/native/InputView.tsx"); export default InputView; export const ClearButtonVisibility = obj7;