This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,101 @@
// Metro module 11342 (f11343).
import { useState, useCallback } from "react";
import { View } from "react-native";
import { DEFAULT_CONTENT_PADDING } from "../../AppLauncherNativeConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { BottomSheetFlashList, FlashList } from "../../../../../_bundle/noop_6676";
import useSafeAreaInsets_native from "../../../../safe_area/useSafeAreaInsets.native";
import { isIOS } from "../../../../../utils/PlatformUtils";
import AutocompleteUtils from "../../../../../utils/AutocompleteUtils";
import { FormRadioRow, FormDivider } from "../../../../../design/void/Form/native/index";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import useIsWindowLarge from "../../../../screen/native/useIsWindowLarge";
import { AppLauncherCommandOptionActionSheet } from "../AppLauncherCommandOptionActionSheet";
import { AppLauncherListSearchBar, AppLauncherListEmptyState } from "../../base_components/AppLauncherList";
let useStyles;
const FlashListWrapper = function FlashListWrapper(props) {
const { scrollable, ...props2 } = props;
return scrollable ? <BottomSheetFlashList preserveScrollMomentum {...props2} /> : <FlashList scrollEnabled={false} {...props2} />;
};
useStyles = createStyles({
listItemContainer: {
overflow: "hidden"
},
listItem: {
backgroundColor: Module712.colors.CARD_BACKGROUND_DEFAULT
},
firstItem: {
borderTopLeftRadius: Module712.radii.xl,
borderTopRightRadius: Module712.radii.xl
},
lastItem: {
borderBottomLeftRadius: Module712.radii.xl,
borderBottomRightRadius: Module712.radii.xl
},
divider: {
backgroundColor: Module712.colors.BORDER_SUBTLE,
marginLeft: 16
}
});
export default function AppLauncherChoicesActionSheet(props) {
let state, setState, state2, setState2;
const { option, initChoiceIndex, onChoiceSelect, onDismiss } = props;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
const styles = useStyles();
const bottom = useSafeAreaInsets_native().bottom;
const paddingBottom = isIOS() ? bottom : bottom + DEFAULT_CONTENT_PADDING;
[state, setState] = useState(() => {
let choices = option.choices;
if (choices == null) {
choices = [];
}
return choices.map((a0, index) => ({
choice: a0,
originalIndex: index
}));
});
[state2, setState2] = useState(initChoiceIndex);
const callback = useCallback((a0) => {
let choices = option.choices;
if (choices == null) {
choices = [];
}
setState(AutocompleteUtils.queryChoice({
query: a0,
choices,
limit: null
}));
}, [option.choices]);
const callback2 = useCallback(({ item, index }) => {
let r11 = state != null && index === state.length - 1;
const originalIndex = item.originalIndex;
const style = [styles.listItemContainer, index === 0 && styles.firstItem, ,];
if (r11) {
r11 = styles.lastItem;
}
const selected = state2 === originalIndex;
style[2] = r11;
return <View style={style}>
<FormRadioRow style={[styles.listItem]} label={item.choice.displayName} align="right" selected={selected} onPress={() => {
setState2(item.originalIndex);
onChoiceSelect(item.choice, item.originalIndex);
ActionSheetActionCreators.hideActionSheet();
}} />
</View>;
}, [onChoiceSelect, state2, styles, state]);
const callback3 = useCallback(() => <FormDivider style={styles.divider} />, [styles.divider]);
const isWindowLarge = useIsWindowLarge();
const startExpanded = option.choices != null && option.choices?.length >= (isWindowLarge ? 10 : 5);
return <AppLauncherCommandOptionActionSheet option={option} startExpanded={startExpanded} onDismiss={onDismiss} scrollable={startExpanded}>
{startExpanded && <AppLauncherListSearchBar onChange={callback} />}
{state.length === 0 ? <AppLauncherListEmptyState /> : <FlashListWrapper scrollable={startExpanded} contentContainerStyle={{
paddingBottom
}} scrollIndicatorInsets={{
bottom: paddingBottom
}} keyExtractor={(item) => `${item.choice.name}_${item.originalIndex}`} data={state} renderItem={callback2} ItemSeparatorComponent={callback3} accessibilityRole="radiogroup" />}
</AppLauncherCommandOptionActionSheet>;
};
@@ -0,0 +1,54 @@
// Metro module 11341 (f11342).
import { useState, useCallback } from "react";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { dismissGlobalKeyboard } from "../../../../../utils/native/KeyboardManagerUtils";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { useAnimationDelayedAutoFocus } from "../../hooks/useAnimationDelayedAutoFocus";
import { FormRow, FormArrow } from "../../../../../design/void/Form/native/index";
import { Text } from "../../../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.lg,
alignItems: "center",
padding: 12
}
});
export default function AppLauncherChoicesOption(props) {
let state, setState;
const { style, option, initialValue, onSelect, onOpenChoicesSheet, onDismissChoicesSheet, autoFocus, hasError } = props;
state = void 0;
setState = void 0;
const styles = useStyles();
[state, setState] = useState(() => {
if (initialValue != null && initialValue.type === "text") {
const choices = option.choices;
const choice = choices == null ? void 0 : choices.find((choice) => choice.displayName === initialValue.text);
if (choice != null) {
return {
choice,
index: option.choices.indexOf(choice)
};
}
}
});
const callback = useCallback(() => {
onOpenChoicesSheet();
dismissGlobalKeyboard();
ActionSheetActionCreators.openLazy(import("./AppLauncherChoicesActionSheet"), "AppLauncherChoicesActionSheet", {
option,
initChoiceIndex: state?.index,
onChoiceSelect: (a0, a1) => {
setState({
choice: a0,
index: a1
});
onSelect(a0);
},
onDismiss: onDismissChoicesSheet
});
}, [onDismissChoicesSheet, onOpenChoicesSheet, onSelect, option, state?.index]);
useAnimationDelayedAutoFocus(autoFocus, callback);
return <FormRow start end style={[styles.container, style]} hasError={hasError} label={<Text variant={state == null ? "text-md/medium" : "text-sm/medium"} color={state == null ? "text-default" : "interactive-text-default"} lineClamp={1}>{option.displayName}</Text>} subLabel={state != null ? <Text variant="text-md/medium" color="text-default" lineClamp={1}>{state.choice.displayName}</Text> : null} trailing={<FormArrow />} onPress={callback} />;
};