259 lines
13 KiB
TypeScript
259 lines
13 KiB
TypeScript
/* Metro module 12726; source: design/void/RadioGroup/native/RadioGroup.tsx; dependencies: [31, 27, 482, 33, 4501, 697, 3874, 6746, 12727, 2] */
|
|
import FormRow from '../../Form/native/FormRow.tsx'; /* Metro dependency 6746 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
|
|
import * as ConstantsModule from '../../../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */
|
|
import * as UseA11yRolesNativeModule from '../../../../external/discord_common/js/packages/design/hooks/useA11yRolesNative.tsx'; /* Metro dependency 3874 */
|
|
|
|
function _fun97420(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#97420, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:6, offset: 0x021804b8, size: 764 bytes, params: 8, frame: 26
|
|
const env0_0 = require;
|
|
const RadioIndicator2 = RadioIndicator;
|
|
const RadioItem2 = RadioItem;
|
|
const RadioGroup2 = RadioGroup;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = JsxRuntimeModule;
|
|
const env0_6 = value.jsx;
|
|
const env0_7 = value.jsxs;
|
|
object = {SMALL: 8};
|
|
object[8] = 'SMALL';
|
|
object.MEDIUM = 10;
|
|
object[10] = 'MEDIUM';
|
|
object.LARGE = 12;
|
|
object[12] = 'LARGE';
|
|
const object2 = {};
|
|
const SMALL = object.SMALL;
|
|
object2[SMALL] = 2;
|
|
const MEDIUM = object.MEDIUM;
|
|
object2[MEDIUM] = 3;
|
|
const LARGE = object.LARGE;
|
|
object2[LARGE] = 4;
|
|
value = require(4501) /* metro dependency 4501: createStyles */;
|
|
const createStyles = value.createStyles;
|
|
const object3 = {};
|
|
const object4 = {'flex': 0, 'marginRight': 8, 'borderRadius': null, 'borderColor': null, 'borderWidth': 2};
|
|
object4.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
|
|
const TEXT_MUTED = (importDefault(697) /* metro dependency 697: native */).colors.TEXT_MUTED;
|
|
object4.borderColor = TEXT_MUTED;
|
|
object3.radioIcon = object4;
|
|
const INTERACTIVE_TEXT_ACTIVE = (importDefault(697) /* metro dependency 697: native */).colors.INTERACTIVE_TEXT_ACTIVE;
|
|
object3.radioIconSelected = {borderColor: INTERACTIVE_TEXT_ACTIVE};
|
|
const object6 = {};
|
|
object6.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
|
|
const CONTROL_BRAND_FOREGROUND = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_BRAND_FOREGROUND;
|
|
object6.backgroundColor = CONTROL_BRAND_FOREGROUND;
|
|
object3.radioTick = object6;
|
|
object3.disabled = {opacity: 0.3};
|
|
const BORDER_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.BORDER_SUBTLE;
|
|
object3.divider = {'height': 1, 'alignSelf': 'stretch', 'backgroundColor': null, 'marginLeft': 16,
|
|
backgroundColor: BORDER_SUBTLE};
|
|
const object9 = {};
|
|
object9.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.sm;
|
|
object9.overflow = 'hidden';
|
|
object3.collapsibleStyle = object9;
|
|
const BACKGROUND_BASE_LOWEST = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWEST;
|
|
object3.collapsibleBackgroundSelected = {backgroundColor: BACKGROUND_BASE_LOWEST};
|
|
const BACKGROUND_SURFACE_HIGH = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_SURFACE_HIGH;
|
|
object3.collapsibleBackground = {backgroundColor: BACKGROUND_SURFACE_HIGH};
|
|
object3.collapsibleContainer = {'paddingVertical': 4, 'paddingHorizontal': 12};
|
|
const env0_10 = Reflect.apply(createStyles, value, [object3]);
|
|
RadioIndicator2.Sizes = object;
|
|
RadioGroup2.Sizes = object;
|
|
(FileImportTrackerModule).fileFinishedImporting('design/void/RadioGroup/native/RadioGroup.tsx');
|
|
exports.default = RadioGroup2;
|
|
exports.RadioIndicator = RadioIndicator2;
|
|
exports.RadioItem = RadioItem2;
|
|
function getOuterStylesFromSize() { // fn#97421, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:1034, offset: 0x021807b4, size: 60 bytes, params: 1, frame: 4
|
|
const value = a0;
|
|
const r2 = value !== undefined ? value : env0_8.MEDIUM;
|
|
return {width: 2 * r2, height: 2 * r2, padding: env0_9[r2]};
|
|
}
|
|
|
|
function getTickStylesFromSize() { // fn#97422, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:1120, offset: 0x021807f0, size: 34 bytes, params: 1, frame: 3
|
|
const value = a0;
|
|
const r1 = value !== undefined ? value : env0_8.MEDIUM;
|
|
return {width: r1, height: r1};
|
|
}
|
|
|
|
function RadioEmpty({size, style}) { // fn#97423, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:1188, offset: 0x02180812, size: 79 bytes, params: 2, frame: 18
|
|
const styles = useStyles();
|
|
const items2 = [styles.radioIcon];
|
|
items2[1] = getOuterStylesFromSize(size);
|
|
items2[2] = style;
|
|
return <View style={items2} />;
|
|
}
|
|
|
|
function RadioSelected({size, active, style}) { // fn#97424, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:1298, offset: 0x02180861, size: 149 bytes, params: 2, frame: 20
|
|
const styles = useStyles();
|
|
const items3 = [styles.radioIcon];
|
|
items3[1] = getOuterStylesFromSize(size);
|
|
items3[2] = active && styles.radioIconSelected;
|
|
items3[3] = style;
|
|
const items2 = [styles.radioTick];
|
|
items2[1] = getTickStylesFromSize(size);
|
|
return (
|
|
<View style={items3}>
|
|
<View style={items2} />
|
|
</View>
|
|
);
|
|
}
|
|
|
|
function RadioIndicator({size, active, style}) { // fn#97425, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:1504, offset: 0x021808f6, size: 82 bytes, params: 2, frame: 17
|
|
return (
|
|
active
|
|
? (
|
|
<RadioSelected
|
|
size={size}
|
|
active={active}
|
|
style={style}
|
|
/>
|
|
)
|
|
: (
|
|
<RadioEmpty size={size} style={style} />
|
|
)
|
|
);
|
|
}
|
|
|
|
function RadioBar({checked, option, style, size, disabled, indicatorLeft, showIndicator, onPress}) { // fn#97426, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:1638, offset: 0x02180948, size: 334 bytes, params: 2, frame: 25
|
|
const styles = useStyles();
|
|
const radioIndicator = <RadioIndicator size={size} active={checked} />;
|
|
const r11 = checked ? styles.collapsibleBackgroundSelected : styles.collapsibleBackground;
|
|
const {accessibilityRole,
|
|
accessibilityState} = (UseA11yRolesNativeModule).useRadioA11yNative({selected: checked,
|
|
disabled: disabled});
|
|
const valueProps = {accessibilityRole: accessibilityRole, accessibilityState: accessibilityState,
|
|
disabled: disabled, onPress: disabled ? undefined : onPress};
|
|
disabled = disabled && styles.disabled;
|
|
valueProps.DEPRECATED_style = [style, disabled, option.collapsibleContent != null && r11];
|
|
valueProps.label = option.name;
|
|
valueProps.subLabel = option.desc;
|
|
valueProps.trailing = indicatorLeft ? null : showIndicator ? radioIndicator : null;
|
|
valueProps.leading = option.leading ?? (indicatorLeft && showIndicator ? radioIndicator : null);
|
|
return ((Component) => <Component {...valueProps} />)(FormRow);
|
|
}
|
|
|
|
function RadioItem({option, checked, style, size, disabled, indicatorLeft, showIndicator, onPress}) { // fn#97427, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:2206, offset: 0x02180a96, size: 290 bytes, params: 2, frame: 25
|
|
var r0;
|
|
const onPress_974282 = onPress_97428;
|
|
var value;
|
|
const styles = useStyles();
|
|
disabled = !disabled ? option.disabled : disabled;
|
|
if (option.collapsibleContent != null) {
|
|
var viewBindingProps = {style: styles.collapsibleContainer};
|
|
value = importDefault(12727) /* metro dependency 12727: Collapsible */;
|
|
value = (
|
|
<View {...viewBindingProps}>
|
|
{((Component) => <Component isExpanded={checked} collapsibleContent={option.collapsibleContent} style={styles.collapsibleStyle}>{children_97429}</Component>)(value)}
|
|
</View>
|
|
);
|
|
r0 = value;
|
|
} else {
|
|
r0 = (
|
|
<RadioBar
|
|
option={option}
|
|
checked={checked}
|
|
style={style}
|
|
size={size}
|
|
disabled={!!disabled}
|
|
onPress={onPress_974282}
|
|
indicatorLeft={indicatorLeft}
|
|
showIndicator={showIndicator}
|
|
/>
|
|
);
|
|
}
|
|
return r0;
|
|
function RadioItemOnPress(a0) { // fn#97428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:2325, owner: RadioItem.onPress, offset: 0x02180bb8, size: 48 bytes, params: 2, frame: 12
|
|
a0.preventDefault();
|
|
return onPress?.(option);
|
|
}
|
|
|
|
function RadioItemChildren({onPress}) { // fn#97429, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:2585, owner: RadioItem.children, offset: 0x02180be8, size: 117 bytes, params: 2, frame: 15
|
|
return (
|
|
<RadioBar
|
|
option={option}
|
|
checked={checked}
|
|
style={style}
|
|
size={size}
|
|
disabled={!!disabled}
|
|
onPress={function(a0) {
|
|
onPress_97428(a0);
|
|
onPress(a0);
|
|
}}
|
|
indicatorLeft={indicatorLeft}
|
|
showIndicator={showIndicator}
|
|
/>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
function RadioGroup({value = null, options = [], style, size = env0_8.MEDIUM, disabled, withSpacing, indicatorLeft, showIndicator, withDividers, onChange = NOOP}) { // fn#97431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:2852, offset: 0x02180c7c, size: 232 bytes, params: 2, frame: 16
|
|
if (disabled !== undefined) {
|
|
}
|
|
if (withSpacing !== undefined) {
|
|
}
|
|
if (indicatorLeft !== undefined) {
|
|
}
|
|
if (showIndicator !== undefined) {
|
|
}
|
|
if (withDividers !== undefined) {
|
|
}
|
|
const env0_10 = useStyles();
|
|
return (
|
|
<View>
|
|
{options.map(_fun97432)}
|
|
</View>
|
|
);
|
|
function _fun97432(a0, a1) { // fn#97432, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12916:3063, offset: 0x02180d64, size: 363 bytes, params: 3, frame: 26
|
|
let value = environment.__proto__;
|
|
const Fragment = env1_3.Fragment;
|
|
let length = env0_1.length;
|
|
let JSON = global.JSON;
|
|
let stringify = JSON.stringify;
|
|
const radioItem = (
|
|
<RadioItem
|
|
option={a0}
|
|
checked={env0_0 === a0.value}
|
|
style={[style, a1 === length - 1 ? {marginBottom: 0} : withSpacing ? {marginBottom: 8} : {}]}
|
|
size={ReactModule}
|
|
disabled={disabled}
|
|
onPress={env0_9}
|
|
indicatorLeft={indicatorLeft}
|
|
showIndicator={showIndicator}
|
|
key={'radio-option-' + Reflect.apply(stringify, JSON, [a0.value]) + '-' + a1}
|
|
/>
|
|
);
|
|
length = env0_1.length;
|
|
const value8 = null;
|
|
const r10 = (
|
|
a1 === length - 1
|
|
? value8
|
|
: (
|
|
withDividers
|
|
? (
|
|
<View style={styles.divider} />
|
|
)
|
|
: value8
|
|
)
|
|
);
|
|
JSON = global.JSON;
|
|
stringify = JSON.stringify;
|
|
value = a0.value;
|
|
value = Reflect.apply(stringify, JSON, [value]);
|
|
return (
|
|
<Fragment key={'radio-option-' + value + '-' + a1}>
|
|
{radioItem}
|
|
{r10}
|
|
</Fragment>
|
|
);
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun97420, 12726, [31, 27, 482, 33, 4501, 697, 3874, 6746, 12727,
|
|
2]) /* metro module 12726, dependencies: [31, 27, 482, 33, 4501, 697, 3874, 6746, 12727, 2] */;
|