decord/source/design/components/Button/native/BaseIconButton.native.tsx

98 lines
3.8 KiB
TypeScript
Raw Normal View History

2026-07-28 08:39:19 +00:00
// Module ID: 6662
// Function ID: 58684
2026-07-20 16:05:17 +00:00
// Name: BaseIconButton
2026-07-28 08:39:19 +00:00
// Dependencies: [31, 33, 4165, 4582, 4026, 4580, 4583, 4585, 4587, 2]
2026-07-20 16:05:17 +00:00
2026-07-28 08:39:19 +00:00
// Module 6662 (BaseIconButton)
2026-07-23 10:11:24 +00:00
import importAllResult from "result";
import { jsx } from "jsxProd";
import _createForOfIteratorHelperLoose from "_createForOfIteratorHelperLoose";
import getIconSize from "getIconSize";
2026-07-28 08:39:19 +00:00
import importDefaultResult from "module_4026";
2026-07-23 10:11:24 +00:00
const require = arg1;
let closure_4 = _createForOfIteratorHelperLoose.createStyles((arg0, arg1) => {
2026-07-20 16:05:17 +00:00
let obj = {};
if ("sm" === arg1) {
2026-07-28 08:39:19 +00:00
obj = { paddingHorizontal: require(4582) /* getButtonPadding */.SMALL_BUTTON_PADDING, paddingVertical: require(4582) /* getButtonPadding */.SMALL_BUTTON_PADDING };
2026-07-20 16:05:17 +00:00
} else if ("md" === arg1) {
2026-07-28 08:39:19 +00:00
obj = { paddingHorizontal: require(4582) /* getButtonPadding */.MEDIUM_BUTTON_PADDING, paddingVertical: require(4582) /* getButtonPadding */.MEDIUM_BUTTON_PADDING };
2026-07-20 16:05:17 +00:00
} else if ("lg" === arg1) {
2026-07-28 08:39:19 +00:00
const obj1 = { paddingHorizontal: require(4582) /* getButtonPadding */.LARGE_BUTTON_PADDING, paddingVertical: require(4582) /* getButtonPadding */.LARGE_BUTTON_PADDING };
2026-07-20 16:05:17 +00:00
obj = obj1;
}
2026-07-23 10:11:24 +00:00
const obj2 = { button: { flexShrink: 0, flexGrow: 0, alignSelf: "center" } };
2026-07-20 16:05:17 +00:00
const merged = Object.assign(obj);
obj2.pill = {};
return obj2;
});
const forwardRefResult = importAllResult.forwardRef((variant) => {
let icon;
let loading;
let maxFontSizeMultiplier;
let pillStyle;
let scaleAmountInPx;
let style;
variant = variant.variant;
let str = "primary";
({ style, pillStyle } = variant);
if (undefined !== variant) {
str = variant;
}
let DEFAULT_BUTTON_SIZE = variant.size;
if (undefined === DEFAULT_BUTTON_SIZE) {
2026-07-28 08:39:19 +00:00
DEFAULT_BUTTON_SIZE = require(4582) /* getButtonPadding */.DEFAULT_BUTTON_SIZE;
2026-07-20 16:05:17 +00:00
}
({ icon, scaleAmountInPx } = variant);
let num2 = 4;
({ maxFontSizeMultiplier, loading } = variant);
if (undefined !== scaleAmountInPx) {
num2 = scaleAmountInPx;
}
const tmp3 = callback(str, DEFAULT_BUTTON_SIZE);
2026-07-28 08:39:19 +00:00
let obj = require(4026);
2026-07-20 16:05:17 +00:00
const sharedValue = obj.useSharedValue(0);
2026-07-28 08:39:19 +00:00
let obj1 = require(4583) /* useProfileThemedButtonStyles */;
2026-07-20 16:05:17 +00:00
const iconTintStyles = obj1.useIconTintStyles(str);
2026-07-28 08:39:19 +00:00
const iconSizeStyles = require(4583) /* useProfileThemedButtonStyles */.useIconSizeStyles(DEFAULT_BUTTON_SIZE, true, maxFontSizeMultiplier);
let MEDIUM_BUTTON_HEIGHT = require(4582) /* getButtonPadding */.LARGE_BUTTON_HEIGHT;
2026-07-20 16:05:17 +00:00
if ("sm" === DEFAULT_BUTTON_SIZE) {
2026-07-28 08:39:19 +00:00
MEDIUM_BUTTON_HEIGHT = require(4582) /* getButtonPadding */.SMALL_BUTTON_HEIGHT;
2026-07-20 16:05:17 +00:00
} else if ("md" === DEFAULT_BUTTON_SIZE) {
2026-07-28 08:39:19 +00:00
MEDIUM_BUTTON_HEIGHT = require(4582) /* getButtonPadding */.MEDIUM_BUTTON_HEIGHT;
2026-07-20 16:05:17 +00:00
}
2026-07-28 08:39:19 +00:00
const bound = Math.max((require(4582) /* getButtonPadding */.MINIMUM_HIT_AREA - MEDIUM_BUTTON_HEIGHT) / 2, 0);
2026-07-20 16:05:17 +00:00
obj = {};
const merged = Object.assign(variant);
obj["ref"] = arg1;
const items = [tmp3.button, style];
obj["style"] = items;
obj["pressed"] = sharedValue;
obj["scaleAmountInPx"] = num2;
obj["hitSlop"] = bound;
obj = { style: items1 };
2026-07-23 10:11:24 +00:00
items1 = [tmp3.pill, pillStyle];
2026-07-20 16:05:17 +00:00
obj.variant = str;
obj.size = DEFAULT_BUTTON_SIZE;
obj.loading = loading;
let str3 = "xs";
if ("lg" === DEFAULT_BUTTON_SIZE) {
str3 = "sm";
}
obj.loaderSize = str3;
obj.pressed = sharedValue;
let tmp16 = icon;
if (!importAllResult.isValidElement(icon)) {
obj1 = { source: icon };
const items2 = [iconTintStyles, iconSizeStyles];
obj1.style = items2;
2026-07-23 10:11:24 +00:00
tmp16 = <getIconSize source={icon} />;
2026-07-20 16:05:17 +00:00
}
obj.children = tmp16;
2026-07-28 08:39:19 +00:00
obj["children"] = jsx(require(4587) /* PillWrapper */.ButtonPill, { style: items1 });
return jsx(require(4585) /* BaseButton */.BaseButton, { style: items1 });
2026-07-20 16:05:17 +00:00
});
2026-07-23 10:11:24 +00:00
const result = require("_createForOfIteratorHelperLoose").fileFinishedImporting("design/components/Button/native/BaseIconButton.native.tsx");
2026-07-20 16:05:17 +00:00
export const BaseIconButton = forwardRefResult;