decord/source/design/components/Input/native/useInputAttachments.native.tsx

202 lines
6.8 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 6108
// Function ID: 6109
2026-07-29 08:29:29 +00:00
// Name: InputAttachmentContainer
2026-08-25 06:04:03 +00:00
// Dependencies: [32, 19, 17, 21, 5883, 4376, 1367, 6109, 2]
2026-07-29 08:29:29 +00:00
// Exports: estimateAttachmentWidth, renderInputAttachment, useInputAttachments
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 6108 (InputAttachmentContainer)
import Text from "Text" /* 4376 */;
import ICON_SIZE from "ICON_SIZE" /* 5883 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "_slicedToArray" /* 32 */;
import closure_4 from "noop" /* 19 */;
import get_ActivityIndicator from "get ActivityIndicator" /* 17 */;
import { jsx } from "jsxProd" /* 21 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
class InputAttachmentContainer {
constructor(arg0) {
({ content, style } = global);
2026-07-23 10:11:24 +00:00
({ setWidth, pressableProps } = global);
2026-07-20 16:05:17 +00:00
if (null == content) {
return null;
} else {
if (null != pressableProps) {
tmp4 = jsx;
tmp5 = Pressable;
2026-07-29 08:29:29 +00:00
obj = { role: "button" };
2026-07-20 16:05:17 +00:00
tmp6 = obj;
tmp7 = pressableProps;
merged = Object.assign(pressableProps);
2026-07-29 08:29:29 +00:00
pressableProps = function style(pressed) {
2026-07-20 16:05:17 +00:00
const items = [style, { pointerEvents: "auto" }, ];
2026-07-29 08:29:29 +00:00
let obj;
2026-07-20 16:05:17 +00:00
if (pressed.pressed) {
2026-07-29 08:29:29 +00:00
obj = { opacity: 0.2 };
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
items[2] = obj;
2026-07-20 16:05:17 +00:00
return items;
};
2026-07-29 08:29:29 +00:00
obj.style = pressableProps;
obj.onLayout = function onLayout(nativeEvent) {
2026-07-20 16:05:17 +00:00
return callback(nativeEvent.nativeEvent.layout.width);
};
2026-07-29 08:29:29 +00:00
obj.children = content;
2026-07-20 16:05:17 +00:00
tmp3 = jsx(Pressable, obj);
} else {
tmp = jsx;
tmp2 = View;
2026-07-29 08:29:29 +00:00
obj = { style: null, onLayout: null, children: null };
obj[0] = style;
obj[1] = function onLayout(nativeEvent) {
2026-07-20 16:05:17 +00:00
return callback(nativeEvent.nativeEvent.layout.width);
};
2026-07-29 08:29:29 +00:00
obj[2] = content;
2026-07-20 16:05:17 +00:00
tmp3 = jsx(View, obj);
}
tmp9 = tmp3;
}
return;
}
}
2026-07-29 08:29:29 +00:00
({ Platform, Pressable: c5, View: closure_6 } = get_ActivityIndicator);
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("design/components/Input/native/useInputAttachments.native.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export const estimateAttachmentWidth = function estimateAttachmentWidth(arg0, arg1) {
let num = 0;
if (null != arg0) {
2026-08-24 06:08:38 +00:00
num = ICON_SIZE.ICON_SIZE.xs + arg1;
2026-07-29 08:29:29 +00:00
}
return num;
};
export const renderInputAttachment = function renderInputAttachment(arg0, leadingText, text) {
if (null != arg0) {
let tmp2 = jsx(arg0, { size: "xs", color: "input-icon-default" });
} else {
tmp2 = null;
if (null != leadingText) {
const obj = { variant: "text-md/normal", style: null, children: null };
obj[1] = text;
obj[2] = leadingText;
2026-08-24 06:08:38 +00:00
tmp2 = jsx(Text.Text, { variant: "text-md/normal", style: null, children: null });
2026-07-29 08:29:29 +00:00
}
}
return tmp2;
};
2026-07-20 16:05:17 +00:00
export { InputAttachmentContainer };
export const useInputAttachments = function useInputAttachments(size, leading) {
2026-07-23 10:11:24 +00:00
let obj = inputStyles(trailingIcon[7]);
obj = { size: size.size, hasLeadingIcon: null != size.leadingIcon, isRefreshEnabled: leadingIcon(trailingIcon[6])("useInputAttachments") };
inputStyles = obj.useInputStyles(obj);
leadingIcon = size.leadingIcon;
2026-07-29 08:29:29 +00:00
({ leadingText, trailingIcon } = size);
const trailingText = size.trailingText;
2026-07-20 16:05:17 +00:00
leading = undefined;
2026-07-29 08:29:29 +00:00
({ leadingPressableProps, trailingPressableProps } = size);
if (leading != null) {
2026-07-20 16:05:17 +00:00
leading = leading.leading;
}
2026-07-29 08:29:29 +00:00
if (leading != null) {
let trailing;
if (leading != null) {
trailing = leading.trailing;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (trailing != null) {
if (null == leadingIcon) {
let leading1;
if (leading != null) {
leading1 = leading.leading;
}
if (null == leading1) {
let leadingIcon2 = inputStyles.leadingText;
}
if (null == trailingIcon) {
let trailing1;
if (leading != null) {
trailing1 = leading.trailing;
}
if (null == trailing1) {
let trailingIcon2 = inputStyles.trailingText;
}
[tmp22, tmp23] = callback(React.useState(() => {
let num = 0;
if (null != leadingIcon) {
num = inputStyles(trailingIcon[4]).ICON_SIZE.xs + tmp;
}
return num;
}), 2);
const tmp24 = callback(React.useState(() => {
let num = 0;
if (null != trailingIcon) {
num = inputStyles(trailingIcon[4]).ICON_SIZE.xs + tmp;
}
return num;
}), 2);
const first = tmp24[0];
obj = { content: null, setWidth: null, pressableProps: null, style: null };
obj[0] = leading;
obj[1] = tmp23;
let prop;
if (leading != null) {
prop = leading.leadingPressableProps;
}
if (prop == null) {
prop = leadingPressableProps;
}
2026-08-24 06:08:38 +00:00
obj1 = { leading: null, trailing: null, inputStyle: null };
2026-07-29 08:29:29 +00:00
obj[2] = prop;
obj[3] = leadingIcon2;
obj1[0] = <InputAttachmentContainer content={null} setWidth={null} pressableProps={null} style={null} />;
const obj2 = { content: null, setWidth: null, pressableProps: null, style: null };
obj2[0] = trailing;
obj2[1] = tmp24[1];
let prop1;
if (leading != null) {
prop1 = leading.trailingPressableProps;
}
if (prop1 == null) {
prop1 = trailingPressableProps;
}
obj2[2] = prop1;
obj2[3] = trailingIcon2;
obj1[1] = <InputAttachmentContainer content={null} setWidth={null} pressableProps={null} style={null} />;
let diff;
if (0 !== tmp22) {
diff = tmp22 - inputStyles.padding.paddingHorizontal;
}
const obj3 = { marginStart: null, marginEnd: null };
obj3[0] = diff;
let diff1;
if (0 !== first) {
diff1 = first - inputStyles.padding.paddingHorizontal;
}
obj3[1] = diff1;
obj1[2] = obj3;
return obj1;
}
trailingIcon2 = inputStyles.trailingIcon;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
leadingIcon2 = inputStyles.leadingIcon;
} else if (null != trailingIcon) {
let tmp13 = <trailingIcon size="xs" color="input-icon-default" />;
} else {
tmp13 = null;
if (null != trailingText) {
const obj4 = { variant: "text-md/normal", style: null, children: null };
obj4[1] = tmp12;
obj4[2] = trailingText;
tmp13 = jsx(tmp3(tmp[5]).Text, { variant: "text-md/normal", style: null, children: null });
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
} else if (null != leadingIcon) {
let tmp7 = <leadingIcon size="xs" color="input-icon-default" />;
} else {
tmp7 = null;
if (null != leadingText) {
const obj5 = { variant: "text-md/normal", style: null, children: null };
obj5[1] = tmp6;
obj5[2] = leadingText;
tmp7 = jsx(tmp3(tmp[5]).Text, { variant: "text-md/normal", style: null, children: null });
}
2026-07-20 16:05:17 +00:00
}
};