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

104 lines
4 KiB
TypeScript
Raw Normal View History

// Module ID: 8029
// Function ID: 8030
2026-07-20 16:05:17 +00:00
// Name: BaseIconButton
// Dependencies: [19, 21, 4481, 4941, 4218, 4938, 4942, 4944, 4946, 2]
2026-07-20 16:05:17 +00:00
// Module 8029 (BaseIconButton)
import _mod4218 from "module_4218" /* 4218 */;
import IconSizesDefault from "IconSizes" /* 4938 */;
import MINIMUM_HIT_AREA from "MINIMUM_HIT_AREA" /* 4941 */;
import styleProperties from "styleProperties" /* 4942 */;
import BaseButton from "BaseButton" /* 4944 */;
import PillWrapper from "PillWrapper" /* 4946 */;
2026-08-24 06:08:38 +00:00
import importAllResult from "noop" /* 19 */;
import { jsx } from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4481 */;
import importDefaultResult from "module_4218" /* 4218 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
let closure_4 = createCacheKey.createStyles((arg0, arg1) => {
2026-07-20 16:05:17 +00:00
if ("sm" === arg1) {
2026-07-29 08:29:29 +00:00
let obj = { paddingHorizontal: null, paddingVertical: null };
2026-08-24 06:08:38 +00:00
obj[0] = MINIMUM_HIT_AREA.SMALL_BUTTON_PADDING;
obj[1] = MINIMUM_HIT_AREA.SMALL_BUTTON_PADDING;
2026-07-20 16:05:17 +00:00
} else if ("md" === arg1) {
2026-07-29 08:29:29 +00:00
obj = { paddingHorizontal: null, paddingVertical: null };
2026-08-24 06:08:38 +00:00
obj[0] = MINIMUM_HIT_AREA.MEDIUM_BUTTON_PADDING;
obj[1] = MINIMUM_HIT_AREA.MEDIUM_BUTTON_PADDING;
2026-07-29 08:29:29 +00:00
} else {
obj = {};
if ("lg" === arg1) {
2026-08-24 06:08:38 +00:00
obj1 = { paddingHorizontal: null, paddingVertical: null };
obj1[0] = MINIMUM_HIT_AREA.LARGE_BUTTON_PADDING;
obj1[1] = MINIMUM_HIT_AREA.LARGE_BUTTON_PADDING;
2026-07-29 08:29:29 +00:00
obj = obj1;
}
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const obj2 = { button: { flexShrink: 0, flexGrow: 0, alignSelf: "center" }, pill: null };
2026-07-20 16:05:17 +00:00
const merged = Object.assign(obj);
2026-07-29 08:29:29 +00:00
obj2[1] = {};
2026-07-20 16:05:17 +00:00
return obj2;
});
2026-08-24 06:08:38 +00:00
let closure_5 = importDefaultResult.createAnimatedComponent(IconSizesDefault);
2026-07-29 08:29:29 +00:00
const forwardRefResult = importAllResult.forwardRef((variant, ref) => {
2026-07-20 16:05:17 +00:00
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-08-24 06:08:38 +00:00
DEFAULT_BUTTON_SIZE = MINIMUM_HIT_AREA.DEFAULT_BUTTON_SIZE;
2026-07-20 16:05:17 +00:00
}
({ icon, scaleAmountInPx } = variant);
2026-07-29 08:29:29 +00:00
let num = 4;
2026-07-20 16:05:17 +00:00
({ maxFontSizeMultiplier, loading } = variant);
if (undefined !== scaleAmountInPx) {
2026-07-29 08:29:29 +00:00
num = scaleAmountInPx;
2026-07-20 16:05:17 +00:00
}
const tmp3 = callback(str, DEFAULT_BUTTON_SIZE);
let obj = _mod4218;
2026-07-20 16:05:17 +00:00
const sharedValue = obj.useSharedValue(0);
2026-08-24 06:08:38 +00:00
obj1 = styleProperties;
2026-07-20 16:05:17 +00:00
const iconTintStyles = obj1.useIconTintStyles(str);
2026-08-24 06:08:38 +00:00
const iconSizeStyles = styleProperties.useIconSizeStyles(DEFAULT_BUTTON_SIZE, true, maxFontSizeMultiplier);
let MEDIUM_BUTTON_HEIGHT = MINIMUM_HIT_AREA.LARGE_BUTTON_HEIGHT;
2026-07-20 16:05:17 +00:00
if ("sm" === DEFAULT_BUTTON_SIZE) {
MEDIUM_BUTTON_HEIGHT = tmp4(4941).SMALL_BUTTON_HEIGHT;
2026-07-20 16:05:17 +00:00
} else if ("md" === DEFAULT_BUTTON_SIZE) {
MEDIUM_BUTTON_HEIGHT = tmp4(4941).MEDIUM_BUTTON_HEIGHT;
2026-07-20 16:05:17 +00:00
}
const bound = Math.max((tmp4(4941).MINIMUM_HIT_AREA - MEDIUM_BUTTON_HEIGHT) / 2, 0);
2026-07-20 16:05:17 +00:00
obj = {};
const merged = Object.assign(variant);
2026-07-29 08:29:29 +00:00
obj.ref = ref;
2026-07-20 16:05:17 +00:00
const items = [tmp3.button, style];
2026-07-29 08:29:29 +00:00
obj.style = items;
obj.pressed = sharedValue;
obj.scaleAmountInPx = num;
obj.hitSlop = bound;
obj = { style: items1, variant: str, size: DEFAULT_BUTTON_SIZE, loading, loaderSize: null, pressed: null, children: null };
2026-07-23 10:11:24 +00:00
items1 = [tmp3.pill, pillStyle];
2026-07-20 16:05:17 +00:00
let str3 = "xs";
if ("lg" === DEFAULT_BUTTON_SIZE) {
str3 = "sm";
}
2026-07-29 08:29:29 +00:00
obj[4] = str3;
obj[5] = sharedValue;
let tmp10Result = icon;
2026-07-20 16:05:17 +00:00
if (!importAllResult.isValidElement(icon)) {
2026-07-29 08:29:29 +00:00
obj1 = { source: null, style: null };
obj1[0] = icon;
2026-07-20 16:05:17 +00:00
const items2 = [iconTintStyles, iconSizeStyles];
2026-07-29 08:29:29 +00:00
obj1[1] = items2;
2026-08-24 06:08:38 +00:00
tmp10Result = tmp10(closure_5, obj1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[6] = tmp10Result;
2026-08-24 06:08:38 +00:00
obj.children = jsx(PillWrapper.ButtonPill, { style: items1, variant: str, size: DEFAULT_BUTTON_SIZE, loading, loaderSize: null, pressed: null, children: null });
return jsx(BaseButton.BaseButton, { style: items1, variant: str, size: DEFAULT_BUTTON_SIZE, loading, loaderSize: null, pressed: null, children: null });
2026-07-20 16:05:17 +00:00
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("design/components/Button/native/BaseIconButton.native.tsx");
2026-07-20 16:05:17 +00:00
export const BaseIconButton = forwardRefResult;