Files
2026-07-28 01:06:53 +03:00

348 lines
21 KiB
TypeScript

/* Metro module 4587; source: design/components/Button/native/ButtonPill.native.tsx; dependencies: [57, 31, 27, 33, 4582, 4501, 697, 4583, 3868, 3860, 4588, 4589, 4017, 4002, 4593, 3875, 4577, 4581, 2] */
import Module00057 from '../../../../by-id/module-00057.js'; /* Metro dependency 57 */
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 AccessibilityPreferencesContextModule from '../../../../external/discord_common/js/packages/design/components/AccessibilityPreferencesContext/AccessibilityPreferencesContext.tsx'; /* Metro dependency 3875 */
import * as CreateStylesModule from '../../Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
import * as SpringModule from '../../../animation/reanimated/spring/spring.tsx'; /* Metro dependency 4577 */
import * as SpringPresetsModule from '../../../animation/reanimated/spring/springPresets.tsx'; /* Metro dependency 4581 */
function _fun38896(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#38896, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:6, offset: 0x010cfaf2, size: 505 bytes, params: 8, frame: 23
const env0_0 = require;
const BasicButtonPill2 = BasicButtonPill;
const LoadingButtonPill2 = LoadingButtonPill;
const useLoadingStyles2 = useLoadingStyles;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ReactNativeModule;
const env0_5 = value.View;
const env0_6 = value.StyleSheet;
value = require(33) /* metro dependency 33 */;
const env0_7 = value.jsx;
const env0_8 = value.jsxs;
const env0_9 = value.Fragment;
value = require(4582) /* metro dependency 4582: ButtonConstantsNative */;
let getButtonPadding = value.getButtonPadding;
const SMALL_BUTTON_HEIGHT = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).SMALL_BUTTON_HEIGHT;
const SMALL_BUTTON_ICON_SIZE = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).SMALL_BUTTON_ICON_SIZE;
const env0_11 = Reflect.apply(getButtonPadding, value, [SMALL_BUTTON_HEIGHT, SMALL_BUTTON_ICON_SIZE]);
value = require(4582) /* metro dependency 4582: ButtonConstantsNative */;
getButtonPadding = value.getButtonPadding;
const MEDIUM_BUTTON_HEIGHT = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).MEDIUM_BUTTON_HEIGHT;
const MEDIUM_BUTTON_ICON_SIZE = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).MEDIUM_BUTTON_ICON_SIZE;
const env0_12 = Reflect.apply(getButtonPadding, value, [MEDIUM_BUTTON_HEIGHT, MEDIUM_BUTTON_ICON_SIZE]);
value = require(4582) /* metro dependency 4582: ButtonConstantsNative */;
getButtonPadding = value.getButtonPadding;
const LARGE_BUTTON_HEIGHT = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).LARGE_BUTTON_HEIGHT;
const LARGE_BUTTON_ICON_SIZE = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).LARGE_BUTTON_ICON_SIZE;
const env0_13 = Reflect.apply(getButtonPadding, value, [LARGE_BUTTON_HEIGHT, LARGE_BUTTON_ICON_SIZE]);
const env0_14 = (CreateStylesModule).createStyles(_fun38905);
object = {code: "function ButtonPillNativeTsx1(){const{withSpring,loading,SUBTLE_SPRING,useReducedMotion,withDelay,FADE_DELAY,offsetY}=this.__closure;const opacityTransition=withSpring(loading?0:1,SUBTLE_SPRING,'animate-always');if(useReducedMotion){return{opacity:loading?opacityTransition:withDelay(FADE_DELAY,opacityTransition),transform:[{translateY:0}]};}return{opacity:opacityTransition,transform:[{translateY:withSpring(loading?-1*offsetY:0,SUBTLE_SPRING)}]};}"};
object = {code: "function ButtonPillNativeTsx2(){const{withSpring,loading,SUBTLE_SPRING,useReducedMotion,withDelay,FADE_DELAY,offsetY}=this.__closure;const opacityTransition=withSpring(loading?1:0,SUBTLE_SPRING,'animate-always');if(useReducedMotion){return{opacity:loading?withDelay(FADE_DELAY,opacityTransition):opacityTransition,transform:[{translateY:0}]};}return{opacity:opacityTransition,transform:[{translateY:withSpring(loading?0:offsetY,SUBTLE_SPRING)}]};}"};
(FileImportTrackerModule).fileFinishedImporting('design/components/Button/native/ButtonPill.native.tsx');
exports.ButtonPill = ButtonPill;
exports.BasicButtonPill = BasicButtonPill2;
exports.LoadingButtonPill = LoadingButtonPill2;
exports.useLoadingStyles = useLoadingStyles2;
function PillWrapper({children, variant, style, pressed, shiny, expressiveRiveRef, expressivePressState, size}) { // fn#38897, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:1609, offset: 0x010cfceb, size: 847 bytes, params: 2, frame: 33
var r5;
var object;
var value7;
var object3;
var expressivePill;
var ExpressiveButtonRive;
var object5;
var items2;
shiny = !(shiny === undefined) && shiny;
const value2 = require(dependencyMap[7]).useButtonPillStyles(variant, pressed);
const value3 = require(dependencyMap[7]).useGradientPillStyles(variant);
const moduleValue3 = require(dependencyMap[8]);
const useThemeContext = moduleValue3.useThemeContext;
const theme = Reflect.apply(useThemeContext, moduleValue3, []).theme;
const styles = useStyles(variant, size);
const moduleValue4 = require(dependencyMap[9]);
let useToken = moduleValue4.useToken;
const REDESIGN_BUTTON_PREMIUM_PRIMARY_PURPLE_FOR_GRADIENT = importDefault(dependencyMap[6]).colors.REDESIGN_BUTTON_PREMIUM_PRIMARY_PURPLE_FOR_GRADIENT;
let items3 = [Reflect.apply(useToken, moduleValue4, [REDESIGN_BUTTON_PREMIUM_PRIMARY_PURPLE_FOR_GRADIENT])];
const moduleValue5 = require(dependencyMap[9]);
useToken = moduleValue5.useToken;
const REDESIGN_BUTTON_PREMIUM_PRIMARY_PURPLE_FOR_GRADIENT_2 = importDefault(dependencyMap[6]).colors.REDESIGN_BUTTON_PREMIUM_PRIMARY_PURPLE_FOR_GRADIENT_2;
items3[1] = Reflect.apply(useToken, moduleValue5, [REDESIGN_BUTTON_PREMIUM_PRIMARY_PURPLE_FOR_GRADIENT_2]);
const moduleValue6 = require(dependencyMap[9]);
useToken = moduleValue6.useToken;
const REDESIGN_BUTTON_PREMIUM_PRIMARY_PINK_FOR_GRADIENT = importDefault(dependencyMap[6]).colors.REDESIGN_BUTTON_PREMIUM_PRIMARY_PINK_FOR_GRADIENT;
items3[2] = Reflect.apply(useToken, moduleValue6, [REDESIGN_BUTTON_PREMIUM_PRIMARY_PINK_FOR_GRADIENT]);
const r10 = (
shiny
? ((ButtonShine) => <ButtonShine variant={variant} />)(require(dependencyMap[10]).ButtonShine)
: null
);
const jsxRuntimeEnv0_9Binding = jsxRuntimeEnv0_9;
if (variant === 'experimental_premium-primary') {
items3 = [
((Component) => <Component start={{'x': 0, 'y': 0}} end={{'x': 1, 'y': 0}} style={[style, value3,
StyleSheet.absoluteFill]} colors={items3} />)(importDefault(dependencyMap[11])),
];
items3[1] = ((View) => <View style={[style,
value2]}>{children}{r10}</View>)(importDefault(dependencyMap[12]).View);
object = {children: items3};
} else {
value7 = variant === 'expressive';
if (value7) {
object3 = {};
expressivePill = styles.expressivePill;
object3.style = [StyleSheet.absoluteFill, expressivePill];
ExpressiveButtonRive = require(dependencyMap[8]).ExpressiveButtonRive;
var expressiveButtonRiveProps2 = {'withReducedMotion': 'short-loop', 'ref': null, 'fit': 'layout',
ref: expressiveRiveRef,
artboard: require(dependencyMap[13]).isThemeLight(theme) ? 'Mobile Expressive Button Lightmode' : 'Mobile Expressive Button Dark Mode'};
object5 = {};
object5.buttonColor = styles.expressiveRiveFill.color;
expressivePill = styles.expressivePill;
object5.cornerRadius = expressivePill.borderRadius;
copyDataProperties(object5, expressivePressState, dependencyMap);
expressiveButtonRiveProps2.dataBinding = object5;
r5 = (
<View {...object3}>
<ExpressiveButtonRive {...expressiveButtonRiveProps2} />
</View>
);
} else {
r5 = value7;
}
items2 = [r5];
items2[1] = ((View) => <View style={[style,
value2]}>{children}{r10}</View>)(importDefault(dependencyMap[12]).View);
object = {children: items2};
}
return ((Fragment) => <Fragment {...object} />)(jsxRuntimeEnv0_9Binding);
}
function BasicButtonPill({children, style, pressed, variant, size = require(dependencyMap[4]).DEFAULT_BUTTON_SIZE, shiny, expressiveRiveRef, expressivePressState}) { // fn#38898, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:2766, offset: 0x010d003a, size: 211 bytes, params: 2, frame: 23
variant = variant === undefined ? 'primary' : variant;
shiny = !(shiny === undefined) && shiny;
const styles = useStyles(variant, size);
return (
<PillWrapper
variant={variant}
size={size}
style={[styles.pill, style]}
pressed={pressed}
shiny={shiny}
expressiveRiveRef={expressiveRiveRef}
expressivePressState={expressivePressState}
>
<View style={styles.childContainer}>
{children}
</View>
</PillWrapper>
);
}
function LoadingButtonPill({children, style, pressed, variant, size = require(dependencyMap[4]).DEFAULT_BUTTON_SIZE, loading, loaderSize, expressiveRiveRef, expressivePressState}) { // fn#38899, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:3114, offset: 0x010d010d, size: 499 bytes, params: 2, frame: 31
var r8;
var Ellipsis;
variant = variant === undefined ? 'primary' : variant;
loading = !(loading === undefined) && loading;
const styles = useStyles(variant, size);
const env0_1 = ReactModule.useRef(null);
const [property, env0_2] = Module00057(ReactModule.useState(loading), 2);
ReactModule.useEffect(_fun38900, [loading]);
const value5 = Module00057(useLoadingStyles(loading, size), 2);
const property2 = value5[0];
const property3 = value5[1];
const pillWrapperBindingProps = {variant: variant, size: size, style: [styles.pill, style], pressed: pressed,
expressiveRiveRef: expressiveRiveRef, expressivePressState: expressivePressState};
let View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
const view = (
<View style={[styles.childContainer, property2]}>
{children}
</View>
);
View = (importDefault(4017) /* metro dependency 4017: ReanimatedRexport */).View;
const items4 = [styles.ellipsis, property3];
if (property) {
Ellipsis = (require(4593) /* metro dependency 4593: ButtonEllipsisNative */).Ellipsis;
size = loaderSize ?? size;
r8 = <Ellipsis variant={variant} size={size} />;
} else {
r8 = property;
}
return (
<PillWrapper {...pillWrapperBindingProps}>
{view}
<View style={items4}>
{r8}
</View>
</PillWrapper>
);
function _fun38900() { // fn#38900, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:3379, offset: 0x010d0300, size: 107 bytes, params: 1, frame: 15
if (env0_1.current != null) {
global.clearTimeout(env0_1.current);
}
if (loading) {
env0_2(true);
} else {
env0_1.current = global.setTimeout(_fun38901, 500);
}
function _fun38901() { // fn#38901, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:3455, offset: 0x010d036b, size: 18 bytes, params: 1, frame: 11
env1_2(false);
}
}
}
function useLoadingStyles(a0, a1) { // fn#38902, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:4737, offset: 0x010d037d, size: 404 bytes, params: 3, frame: 24
const env0_0 = a0;
const useContext = ReactModule.useContext;
const AccessibilityPreferencesContext = (AccessibilityPreferencesContextModule).AccessibilityPreferencesContext;
const enabled = Reflect.apply(useContext, ReactModule, [AccessibilityPreferencesContext]).reducedMotion.enabled;
const value2 = 12;
const r6 = a1 !== 'lg' ? value2 : 18;
const moduleValue = require(dependencyMap[value2]);
let useAnimatedStyle = moduleValue.useAnimatedStyle;
let closure = useLoadingStylesO;
let object = {};
const withSpring = (SpringModule).withSpring;
object.withSpring = withSpring;
object.loading = a0;
const SUBTLE_SPRING = (SpringPresetsModule).SUBTLE_SPRING;
object.SUBTLE_SPRING = SUBTLE_SPRING;
object.useReducedMotion = enabled;
object.withDelay = require(dependencyMap[value2]).withDelay;
object.FADE_DELAY = env0_10;
object.offsetY = r6;
closure.__closure = object;
closure.__workletHash = 9388603334085;
closure.__initData = env0_15;
object = [Reflect.apply(useAnimatedStyle, moduleValue, [closure])];
const moduleValue2 = require(dependencyMap[value2]);
useAnimatedStyle = moduleValue2.useAnimatedStyle;
closure = useLoadingStylesL;
const object2 = {};
object2.withSpring = withSpring;
object2.loading = a0;
object2.SUBTLE_SPRING = SUBTLE_SPRING;
object2.useReducedMotion = enabled;
object2.withDelay = require(dependencyMap[value2]).withDelay;
object2.FADE_DELAY = env0_10;
object2.offsetY = r6;
closure.__closure = object2;
closure.__workletHash = 8255420825872;
closure.__initData = env0_16;
object[1] = Reflect.apply(useAnimatedStyle, moduleValue2, [closure]);
return object;
function useLoadingStylesO() { // fn#38903, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:4909, owner: useLoadingStyles.o, offset: 0x010d0511, size: 271 bytes, params: 1, frame: 22
var moduleValue2;
const value = environment.__proto__;
const withSpring = SpringModule.withSpring;
const r4 = env0_0 ? 0 : 1;
const SUBTLE_SPRING = (SpringPresetsModule).SUBTLE_SPRING;
const value5 = Reflect.apply(withSpring, SpringModule, [r4, SUBTLE_SPRING, 'animate-always']);
const enabledBinding = enabled;
const object = {};
if (enabledBinding) {
object.opacity = env0_0 ? value5 : (require(4017) /* metro dependency 4017: ReanimatedRexport */).withDelay(env1_10,
value5);
object.transform = [{translateY: 0}];
} else {
object.opacity = value5;
moduleValue2 = SpringModule;
object.transform = [{translateY: moduleValue2.withSpring(env0_0 ? -1 * env0_2 : 0, SUBTLE_SPRING)}];
}
return object;
}
function useLoadingStylesL() { // fn#38904, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:5399, owner: useLoadingStyles.l, offset: 0x010d0620, size: 261 bytes, params: 1, frame: 23
var moduleValue2;
const value = environment.__proto__;
const withSpring = SpringModule.withSpring;
const value3 = 0;
const r5 = env0_0 ? 1 : value3;
const SUBTLE_SPRING = (SpringPresetsModule).SUBTLE_SPRING;
const value5 = Reflect.apply(withSpring, SpringModule, [r5, SUBTLE_SPRING, 'animate-always']);
const enabledBinding = enabled;
const object = {};
if (enabledBinding) {
object.opacity = env0_0 ? (require(4017) /* metro dependency 4017: ReanimatedRexport */).withDelay(env1_10,
value5) : value5;
object.transform = [{translateY: value3}];
} else {
object.opacity = value5;
moduleValue2 = SpringModule;
object.transform = [{translateY: moduleValue2.withSpring(env0_0 ? value3 : env0_2, SUBTLE_SPRING)}];
}
return object;
}
}
function _fun38905(a0, a1) { // fn#38905, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:483, offset: 0x010d0725, size: 574 bytes, params: 3, frame: 19
var r7;
const LARGE_BUTTON_HEIGHT = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).LARGE_BUTTON_HEIGHT;
const MEDIUM_BUTTON_HEIGHT = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).MEDIUM_BUTTON_HEIGHT;
const SMALL_BUTTON_HEIGHT = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).SMALL_BUTTON_HEIGHT;
let object = {};
if (a1 === 'sm') {
object = {};
object.minHeight = SMALL_BUTTON_HEIGHT;
object.minWidth = SMALL_BUTTON_HEIGHT;
object.paddingHorizontal = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).SMALL_BUTTON_HORIZONTAL_PADDING;
object.paddingVertical = env0_11;
r7 = object;
} else if (a1 === 'md') {
object = {};
object.minHeight = MEDIUM_BUTTON_HEIGHT;
object.minWidth = MEDIUM_BUTTON_HEIGHT;
object.paddingHorizontal = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).MEDIUM_BUTTON_HORIZONTAL_PADDING;
object.paddingVertical = env0_12;
r7 = object;
} else if (a1 !== 'lg') {
r7 = object;
} else {
object = {};
object.minHeight = LARGE_BUTTON_HEIGHT;
object.minWidth = LARGE_BUTTON_HEIGHT;
object.paddingHorizontal = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).LARGE_BUTTON_HORIZONTAL_PADDING;
object.paddingVertical = env0_13;
r7 = object;
}
const r3 = a1 === 'lg' ? (importDefault(697) /* metro dependency 697: native */).modules.button.BORDER_RADIUS_LG : (importDefault(697) /* metro dependency 697: native */).modules.button.BORDER_RADIUS;
object = {};
const object2 = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'center', 'overflow': 'hidden'};
const BUTTON_BORDER_WIDTH = (require(4582) /* metro dependency 4582: ButtonConstantsNative */).BUTTON_BORDER_WIDTH;
object2.borderWidth = BUTTON_BORDER_WIDTH;
object2.borderRadius = r3;
copyDataProperties(object2, r7, require);
object.pill = object2;
object.expressivePill = {overflow: 'hidden', borderRadius: r3};
const CONTROL_EXPRESSIVE_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_EXPRESSIVE_BACKGROUND_DEFAULT;
object.expressiveRiveFill = {color: CONTROL_EXPRESSIVE_BACKGROUND_DEFAULT};
object.childContainer = {'flexDirection': 'row', 'alignItems': 'center', 'justifyContent': 'center', 'flexGrow': 1,
'maxWidth': '100%'};
object.ellipsis = {'position': 'absolute', 'height': '100%', 'width': '100%', 'justifyContent': 'center',
'alignItems': 'center'};
return object;
}
function ButtonPill(a0) { // fn#38906, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4765:5958, offset: 0x010d0963, size: 81 bytes, params: 2, frame: 14
return (
a0.loading == null
? (
<BasicButtonPill {...a0} />
)
: (
<LoadingButtonPill {...a0} />
)
);
}
}
global.__d(_fun38896, 4587, [57, 31, 27, 33, 4582, 4501, 697, 4583, 3868, 3860, 4588, 4589, 4017, 4002, 4593, 3875,
4577, 4581,
2]) /* metro module 4587, dependencies: [57, 31, 27, 33, 4582, 4501, 697, 4583, 3868, 3860, 4588, 4589, 4017, 4002, 4593, 3875, 4577, 4581, 2] */;