decord/source/design/void/RadioGroup/native/RadioGroup.tsx

299 lines
9.6 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 13517
// Function ID: 13518
2026-07-29 08:29:29 +00:00
// Name: RadioEmpty
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 17, 505, 21, 4668, 712, 4108, 6975, 13518, 2]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 13517 (RadioEmpty)
import ThemesDefault from "Themes" /* 712 */;
import useCheckboxA11yNative from "useCheckboxA11yNative" /* 4108 */;
import _modDef6975 from "module_6975" /* 6975 */;
import closure_3 from "noop" /* 19 */;
import { View } from "get ActivityIndicator" /* 17 */;
import { NOOP } from "sum" /* 505 */;
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4668 */;
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
function RadioEmpty(size) {
let MEDIUM = size.size;
const style = [callback2().radioIcon, , ];
if (MEDIUM === undefined) {
2026-07-20 16:05:17 +00:00
MEDIUM = obj.MEDIUM;
}
2026-07-29 08:29:29 +00:00
obj = { width: 2 * MEDIUM, height: 2 * MEDIUM, padding: dependencyMap[MEDIUM] };
style[1] = obj;
style[2] = size.style;
return closure_6(View, { style });
2026-07-20 16:05:17 +00:00
}
function RadioSelected(style) {
({ size, active } = style);
const tmp = callback2();
2026-07-29 08:29:29 +00:00
const items = [tmp.radioIcon, , , ];
let MEDIUM = size;
if (size === undefined) {
MEDIUM = obj.MEDIUM;
}
obj = { width: 2 * MEDIUM, height: 2 * MEDIUM, padding: dependencyMap[MEDIUM] };
items[1] = obj;
2026-07-20 16:05:17 +00:00
if (active) {
active = tmp.radioIconSelected;
}
2026-07-29 08:29:29 +00:00
obj = { style: items, children: null };
2026-07-20 16:05:17 +00:00
items[2] = active;
items[3] = style.style;
2026-07-29 08:29:29 +00:00
const items1 = [tmp.radioTick, ];
if (size === undefined) {
size = obj.MEDIUM;
}
items1[1] = { width: size, height: size };
obj[1] = closure_6(View, { style: items1 });
return closure_6(View, obj);
2026-07-20 16:05:17 +00:00
}
class RadioIndicator {
constructor(arg0) {
({ size, active, style } = global);
tmp = jsx;
if (active) {
tmp4 = RadioSelected;
2026-07-29 08:29:29 +00:00
obj = { size: null, active: null, style: null };
obj[0] = size;
obj[1] = active;
obj[2] = style;
2026-07-20 16:05:17 +00:00
tmpResult = tmp(RadioSelected, obj);
} else {
tmp2 = RadioEmpty;
2026-07-29 08:29:29 +00:00
obj = { size: null, style: null };
obj[0] = size;
obj[1] = style;
2026-07-20 16:05:17 +00:00
tmpResult = tmp(RadioEmpty, obj);
}
return tmpResult;
}
}
function RadioBar(arg0) {
({ checked, option, disabled, indicatorLeft, showIndicator } = arg0);
({ style, size, onPress } = arg0);
const tmp = callback2();
2026-07-29 08:29:29 +00:00
const tmp3 = callback(RadioIndicator, { size, active: checked });
2026-08-24 06:08:38 +00:00
obj = useCheckboxA11yNative;
2026-07-29 08:29:29 +00:00
const radioA11yNative = obj.useRadioA11yNative({ selected: checked, disabled });
2026-07-20 16:05:17 +00:00
({ accessibilityRole, accessibilityState } = radioA11yNative);
2026-07-29 08:29:29 +00:00
obj = { accessibilityRole, accessibilityState, disabled, onPress: null, DEPRECATED_style: null, label: null, subLabel: null, trailing: null, leading: null };
2026-07-20 16:05:17 +00:00
let tmp7;
if (!disabled) {
tmp7 = onPress;
}
2026-07-29 08:29:29 +00:00
obj[3] = tmp7;
2026-07-20 16:05:17 +00:00
const items = [style, , ];
if (disabled) {
disabled = tmp.disabled;
}
items[1] = disabled;
2026-07-23 10:11:24 +00:00
items[2] = null != option.collapsibleContent && (checked ? tmp.collapsibleBackgroundSelected : tmp.collapsibleBackground);
2026-07-29 08:29:29 +00:00
obj[4] = items;
({ name: obj2[5], desc: obj2[6] } = option);
2026-07-20 16:05:17 +00:00
let tmp8 = null;
if (!indicatorLeft) {
tmp8 = null;
if (showIndicator) {
2026-07-29 08:29:29 +00:00
tmp8 = tmp3;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
obj[7] = tmp8;
2026-07-20 16:05:17 +00:00
if (null == option.leading) {
let tmp9 = null;
if (indicatorLeft) {
tmp9 = null;
if (showIndicator) {
2026-07-29 08:29:29 +00:00
tmp9 = tmp3;
2026-07-20 16:05:17 +00:00
}
}
let leading = tmp9;
} else {
leading = option.leading;
}
2026-07-29 08:29:29 +00:00
obj[8] = leading;
2026-08-24 06:08:38 +00:00
return callback(_modDef6975, obj);
2026-07-20 16:05:17 +00:00
}
class RadioItem {
constructor(arg0) {
option = global.option;
checked = global.checked;
style = global.style;
size = global.size;
({ disabled, indicatorLeft } = global);
showIndicator = global.showIndicator;
2026-07-23 10:11:24 +00:00
onPress = global.onPress;
disabled = undefined;
2026-08-24 06:08:38 +00:00
tmp = closure_10();
2026-07-20 16:05:17 +00:00
if (!disabled) {
disabled = option.disabled;
}
if (null != option.collapsibleContent) {
2026-07-23 10:11:24 +00:00
tmp5 = onPress;
tmp6 = indicatorLeft;
2026-07-29 08:29:29 +00:00
obj = { style: null, children: null };
obj[0] = tmp.collapsibleContainer;
tmp7 = checked;
tmp8 = style;
obj1 = { isExpanded: null, collapsibleContent: null, style: null, children: null };
obj1[0] = checked;
obj1[1] = option.collapsibleContent;
obj1[2] = tmp.collapsibleStyle;
obj1[3] = function children(onPress) {
2026-07-23 10:11:24 +00:00
onPress = onPress.onPress;
2026-08-24 06:08:38 +00:00
return onPress(closure_1_14, {
2026-07-23 10:11:24 +00:00
option: onPress,
2026-07-20 16:05:17 +00:00
checked,
style,
size,
disabled,
2026-07-29 08:29:29 +00:00
onPress(preventDefault) {
preventDefault.preventDefault();
2026-08-24 06:08:38 +00:00
if (closure_1_6 != null) {
2026-07-29 08:29:29 +00:00
tmp2(onPress);
}
onPress(preventDefault);
2026-07-20 16:05:17 +00:00
},
indicatorLeft,
showIndicator
});
};
2026-07-29 08:29:29 +00:00
obj[1] = onPress(require("Collapsible"), obj1);
2026-07-23 10:11:24 +00:00
tmp4 = onPress(indicatorLeft, obj);
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
tmp2 = onPress;
2026-07-20 16:05:17 +00:00
tmp3 = RadioBar;
2026-07-29 08:29:29 +00:00
obj = { option: null, checked: null, style: null, size: null, disabled: null, onPress: null, indicatorLeft: null, showIndicator: null };
obj[0] = option;
obj[1] = checked;
obj[2] = style;
obj[3] = size;
obj[4] = disabled;
obj[5] = function handlePress(preventDefault) {
preventDefault.preventDefault();
let tmp2Result;
if (onPress != null) {
tmp2Result = tmp2(option);
}
return tmp2Result;
};
obj[6] = indicatorLeft;
obj[7] = showIndicator;
2026-07-23 10:11:24 +00:00
tmp4 = onPress(RadioBar, obj);
2026-07-20 16:05:17 +00:00
}
return tmp4;
}
}
class RadioGroup {
constructor(arg0) {
value = global.value;
if (value === undefined) {
value = null;
}
2026-07-23 10:11:24 +00:00
c0 = value;
2026-07-20 16:05:17 +00:00
options = global.options;
if (options === undefined) {
options = [];
}
2026-08-24 06:08:38 +00:00
closure_1 = options;
2026-07-23 10:11:24 +00:00
({ style, size } = global);
2026-07-20 16:05:17 +00:00
if (size === undefined) {
2026-07-23 10:11:24 +00:00
tmp2 = c8;
size = c8.MEDIUM;
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
MEDIUM = size;
2026-07-20 16:05:17 +00:00
flag = global.disabled;
if (flag === undefined) {
flag = false;
}
2026-07-23 10:11:24 +00:00
c4 = flag;
2026-07-20 16:05:17 +00:00
flag2 = global.withSpacing;
if (flag2 === undefined) {
flag2 = false;
}
2026-07-23 10:11:24 +00:00
c5 = flag2;
2026-07-20 16:05:17 +00:00
flag3 = global.indicatorLeft;
if (flag3 === undefined) {
flag3 = false;
}
2026-07-23 10:11:24 +00:00
c6 = flag3;
2026-07-20 16:05:17 +00:00
flag4 = global.showIndicator;
if (flag4 === undefined) {
flag4 = true;
}
2026-07-23 10:11:24 +00:00
c7 = flag4;
2026-07-20 16:05:17 +00:00
flag5 = global.withDividers;
if (flag5 === undefined) {
flag5 = true;
}
2026-07-23 10:11:24 +00:00
c8 = flag5;
2026-07-20 16:05:17 +00:00
onChange = global.onChange;
if (onChange === undefined) {
2026-07-23 10:11:24 +00:00
onChange = c5;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
closure_9 = onChange;
closure_10 = undefined;
closure_10 = closure_10();
2026-07-29 08:29:29 +00:00
obj = {
children: options.map((option) => {
2026-08-24 06:08:38 +00:00
obj = { option, checked: closure_0 === option.value, style: null, size: null, disabled: null, onPress: null, indicatorLeft: null, showIndicator: null };
2026-07-29 08:29:29 +00:00
const items = [closure_2, ];
if (arg1 === options.length - 1) {
obj = { marginBottom: 0 };
} else {
obj = flag2 ? { marginBottom: 8 } : {};
}
items[1] = obj;
obj[2] = items;
obj[3] = size;
obj[4] = flag;
obj[5] = onChange;
obj[6] = flag3;
obj[7] = flag4;
2026-08-24 06:08:38 +00:00
const children = [flag3(closure_1_15, obj, "radio-option-" + JSON.stringify(option.value) + "-" + arg1), ];
2026-07-29 08:29:29 +00:00
let tmp2Result = null;
if (arg1 !== options.length - 1) {
tmp2Result = null;
if (flag5) {
obj = { style: null };
obj[0] = divider.divider;
tmp2Result = tmp2(flag, obj);
}
}
children[1] = tmp2Result;
return flag4(size.Fragment, { children }, "radio-option-" + JSON.stringify(option.value) + "-" + arg1);
})
};
2026-07-23 10:11:24 +00:00
return c6(c4, obj);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
({ jsx: closure_6, jsxs: error } = jsxProd);
2026-07-20 16:05:17 +00:00
let obj = { SMALL: 8, [8]: "SMALL", MEDIUM: 10, [10]: "MEDIUM", LARGE: 12, [12]: "LARGE" };
let closure_9 = { [obj.SMALL]: 2, [obj.MEDIUM]: 3, [obj.LARGE]: 4 };
2026-07-29 08:29:29 +00:00
obj = { radioIcon: null, radioIconSelected: null, radioTick: null, disabled: null, divider: null, collapsibleStyle: null, collapsibleBackgroundSelected: null, collapsibleBackground: null, collapsibleContainer: null };
2026-08-24 06:08:38 +00:00
obj = { flex: 0, marginRight: 8, borderRadius: ThemesDefault.radii.round, borderColor: ThemesDefault.colors.TEXT_MUTED, borderWidth: 2 };
2026-07-29 08:29:29 +00:00
obj[0] = obj;
2026-08-24 06:08:38 +00:00
createCacheKey = { borderColor: ThemesDefault.colors.INTERACTIVE_TEXT_ACTIVE };
2026-07-29 08:29:29 +00:00
obj[1] = createCacheKey;
2026-08-24 06:08:38 +00:00
obj[2] = { borderRadius: ThemesDefault.radii.round, backgroundColor: ThemesDefault.colors.CONTROL_BRAND_FOREGROUND };
2026-07-29 08:29:29 +00:00
obj[3] = { opacity: 0.3 };
2026-08-24 06:08:38 +00:00
const obj2 = { borderRadius: ThemesDefault.radii.round, backgroundColor: ThemesDefault.colors.CONTROL_BRAND_FOREGROUND };
obj[4] = { height: 1, alignSelf: "stretch", backgroundColor: ThemesDefault.colors.BORDER_SUBTLE, marginLeft: 16 };
const obj3 = { height: 1, alignSelf: "stretch", backgroundColor: ThemesDefault.colors.BORDER_SUBTLE, marginLeft: 16 };
obj[5] = { borderRadius: ThemesDefault.radii.sm, overflow: "hidden" };
const obj4 = { borderRadius: ThemesDefault.radii.sm, overflow: "hidden" };
obj[6] = { backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOWEST };
const obj5 = { backgroundColor: ThemesDefault.colors.BACKGROUND_BASE_LOWEST };
obj[7] = { backgroundColor: ThemesDefault.colors.BACKGROUND_SURFACE_HIGH };
2026-07-29 08:29:29 +00:00
obj[8] = { paddingVertical: 4, paddingHorizontal: 12 };
let closure_10 = createCacheKey.createStyles(obj);
2026-07-20 16:05:17 +00:00
RadioIndicator.Sizes = obj;
RadioGroup.Sizes = obj;
2026-08-24 06:08:38 +00:00
const obj6 = { backgroundColor: ThemesDefault.colors.BACKGROUND_SURFACE_HIGH };
const result = require("set").fileFinishedImporting("design/void/RadioGroup/native/RadioGroup.tsx");
2026-07-20 16:05:17 +00:00
export default RadioGroup;
export { RadioIndicator };
export { RadioItem };