@xsolla/xui-tooltip-native 0.64.0-pr56.1768348754

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.tsx","../../src/Tooltip.tsx","../../../primitives-native/src/Box.tsx","../../../primitives-native/src/Text.tsx","../../../primitives-native/src/Spinner.tsx","../../../primitives-native/src/Icon.tsx","../../../primitives-native/src/Divider.tsx","../../../primitives-native/src/Input.tsx","../../../primitives-native/src/TextArea.tsx"],"sourcesContent":["export * from \"./Tooltip\";\nexport * from \"./types\";\n","import React, { forwardRef, useState, useMemo } from \"react\";\n// @ts-ignore - this will be resolved at build time\nimport { Box, Text } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\nimport type { TooltipPlacement, TooltipProps, TooltipSize } from \"./types\";\n\nconst getPositionStyles = (placement: TooltipPlacement, offset: number) => {\n switch (placement) {\n case \"top\":\n case \"top-center\":\n return {\n bottom: `calc(100% + ${offset}px)`,\n left: \"50%\",\n transform: \"translateX(-50%)\",\n };\n case \"top-start\":\n return { bottom: `calc(100% + ${offset}px)`, left: 0 };\n case \"top-end\":\n return { bottom: `calc(100% + ${offset}px)`, right: 0 };\n case \"bottom\":\n case \"bottom-center\":\n return {\n top: `calc(100% + ${offset}px)`,\n left: \"50%\",\n transform: \"translateX(-50%)\",\n };\n case \"bottom-start\":\n return { top: `calc(100% + ${offset}px)`, left: 0 };\n case \"bottom-end\":\n return { top: `calc(100% + ${offset}px)`, right: 0 };\n case \"left\":\n return {\n right: `calc(100% + ${offset}px)`,\n top: \"50%\",\n transform: \"translateY(-50%)\",\n };\n case \"left-start\":\n return { right: `calc(100% + ${offset}px)`, top: 0 };\n case \"left-end\":\n return { right: `calc(100% + ${offset}px)`, bottom: 0 };\n case \"right\":\n return {\n left: `calc(100% + ${offset}px)`,\n top: \"50%\",\n transform: \"translateY(-50%)\",\n };\n case \"right-start\":\n return { left: `calc(100% + ${offset}px)`, top: 0 };\n case \"right-end\":\n return { left: `calc(100% + ${offset}px)`, bottom: 0 };\n default:\n return { bottom: `calc(100% + ${offset}px)`, left: 0 };\n }\n};\n\nconst getTypoStyles = (size: TooltipSize) => {\n switch (size) {\n case \"sm\":\n return { fontSize: 12, lineHeight: \"16px\" };\n case \"md\":\n return { fontSize: 14, lineHeight: \"18px\" };\n case \"lg\":\n return { fontSize: 16, lineHeight: \"20px\" };\n case \"xl\":\n return { fontSize: 18, lineHeight: \"22px\" };\n default:\n return { fontSize: 14, lineHeight: \"18px\" };\n }\n};\n\nexport const Tooltip = forwardRef<any, TooltipProps>(\n (\n {\n content,\n children,\n size = \"md\",\n delayEnter = 0,\n delayLeave = 100,\n offset = 12,\n placement = \"top-start\",\n controlledVisible,\n style,\n \"data-testid\": dataTestId,\n className,\n ...props\n },\n ref\n ) => {\n const [isHovered, setIsHovered] = useState(false);\n const { theme } = useDesignSystem();\n const isVisible =\n controlledVisible !== undefined ? controlledVisible : isHovered;\n\n const positionStyles = useMemo(\n () => getPositionStyles(placement, offset),\n [placement, offset]\n );\n const typoStyles = useMemo(() => getTypoStyles(size), [size]);\n\n return (\n <Box\n position=\"relative\"\n display=\"inline-flex\"\n onMouseEnter={() => setIsHovered(true)}\n onMouseLeave={() => setIsHovered(false)}\n className={className}\n style={{ height: \"fit-content\" }}\n >\n {children}\n {isVisible && (\n <Box\n ref={ref}\n data-testid={dataTestId}\n position=\"absolute\"\n backgroundColor={theme.colors.background.secondary}\n borderRadius={8}\n paddingVertical={8}\n paddingHorizontal={12}\n zIndex={2000}\n style={{\n ...positionStyles,\n boxShadow: \"0 2px 4px rgba(0, 36, 77, 0.2)\",\n pointerEvents: \"none\",\n whiteSpace: \"nowrap\",\n width: \"max-content\",\n ...style,\n }}\n >\n {typeof content === \"string\" || typeof content === \"number\" ? (\n <Text\n color={theme.colors.content.primary}\n fontSize={typoStyles.fontSize}\n fontWeight=\"400\"\n style={{ lineHeight: typoStyles.lineHeight }}\n >\n {content}\n </Text>\n ) : (\n content\n )}\n </Box>\n )}\n </Box>\n );\n }\n);\n\nTooltip.displayName = \"Tooltip\";\n","import React from \"react\";\nimport {\n View,\n Pressable,\n Image,\n ViewStyle,\n ImageStyle,\n DimensionValue,\n AnimatableNumericValue,\n} from \"react-native\";\nimport { BoxProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Box: React.FC<BoxProps> = ({\n children,\n onPress,\n onLayout,\n onMoveShouldSetResponder,\n onResponderGrant,\n onResponderMove,\n onResponderRelease,\n onResponderTerminate,\n backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius,\n borderStyle,\n height,\n padding,\n paddingHorizontal,\n paddingVertical,\n margin,\n marginTop,\n marginBottom,\n marginLeft,\n marginRight,\n flexDirection,\n alignItems,\n justifyContent,\n position,\n top,\n bottom,\n left,\n right,\n width,\n flex,\n overflow,\n zIndex,\n hoverStyle,\n pressStyle,\n style,\n \"data-testid\": dataTestId,\n testID,\n as,\n src,\n alt,\n ...rest\n}) => {\n const getContainerStyle = (pressed?: boolean): ViewStyle => ({\n backgroundColor:\n pressed && pressStyle?.backgroundColor\n ? pressStyle.backgroundColor\n : backgroundColor,\n borderColor,\n borderWidth,\n borderBottomWidth,\n borderBottomColor,\n borderTopWidth,\n borderTopColor,\n borderLeftWidth,\n borderLeftColor,\n borderRightWidth,\n borderRightColor,\n borderRadius: borderRadius as AnimatableNumericValue,\n borderStyle: borderStyle as ViewStyle[\"borderStyle\"],\n overflow,\n zIndex,\n height: height as DimensionValue,\n width: width as DimensionValue,\n padding: padding as DimensionValue,\n paddingHorizontal: paddingHorizontal as DimensionValue,\n paddingVertical: paddingVertical as DimensionValue,\n margin: margin as DimensionValue,\n marginTop: marginTop as DimensionValue,\n marginBottom: marginBottom as DimensionValue,\n marginLeft: marginLeft as DimensionValue,\n marginRight: marginRight as DimensionValue,\n flexDirection,\n alignItems,\n justifyContent,\n position: position as ViewStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n flex,\n ...(style as ViewStyle),\n });\n\n const finalTestID = dataTestId || testID;\n\n // Destructure and drop web-only props from rest before passing to RN components\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const {\n role,\n tabIndex,\n onKeyDown,\n onKeyUp,\n \"aria-label\": _ariaLabel,\n \"aria-labelledby\": _ariaLabelledBy,\n \"aria-current\": _ariaCurrent,\n \"aria-disabled\": _ariaDisabled,\n \"aria-live\": _ariaLive,\n className,\n \"data-testid\": _dataTestId,\n ...nativeRest\n } = rest as Record<string, unknown>;\n\n // Handle as=\"img\" for React Native\n if (as === \"img\" && src) {\n const imageStyle: ImageStyle = {\n width: width as DimensionValue,\n height: height as DimensionValue,\n borderRadius: borderRadius as number,\n position: position as ImageStyle[\"position\"],\n top: top as DimensionValue,\n bottom: bottom as DimensionValue,\n left: left as DimensionValue,\n right: right as DimensionValue,\n ...(style as ImageStyle),\n };\n\n return (\n <Image\n source={{ uri: src }}\n style={imageStyle}\n testID={finalTestID}\n resizeMode=\"cover\"\n {...nativeRest}\n />\n );\n }\n\n if (onPress) {\n return (\n <Pressable\n onPress={onPress}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n style={({ pressed }) => getContainerStyle(pressed)}\n testID={finalTestID}\n {...nativeRest}\n >\n {children}\n </Pressable>\n );\n }\n\n return (\n <View\n style={getContainerStyle()}\n testID={finalTestID}\n onLayout={onLayout}\n onMoveShouldSetResponder={onMoveShouldSetResponder}\n onResponderGrant={onResponderGrant}\n onResponderMove={onResponderMove}\n onResponderRelease={onResponderRelease}\n onResponderTerminate={onResponderTerminate}\n {...nativeRest}\n >\n {children}\n </View>\n );\n};\n","import React from \"react\";\nimport { Text as RNText, TextStyle, AccessibilityRole } from \"react-native\";\nimport { TextProps } from \"@xsolla/xui-primitives-core\";\n\n// Map web roles to React Native accessibility roles\nconst roleMap: Record<string, AccessibilityRole> = {\n alert: \"alert\",\n heading: \"header\",\n button: \"button\",\n link: \"link\",\n text: \"text\",\n};\n\nexport const Text: React.FC<TextProps> = ({\n children,\n color,\n fontSize,\n fontWeight,\n fontFamily,\n id,\n role,\n ...props\n}) => {\n // Extract the first font name from a comma-separated list (e.g. for web-style font stacks)\n let resolvedFontFamily = fontFamily\n ? fontFamily.split(\",\")[0].replace(/['\"]/g, \"\").trim()\n : undefined;\n\n // On native, if we don't have the custom font loaded, it's better to use the system font\n // to avoid rendering issues or missing text.\n if (resolvedFontFamily === \"Pilat Wide Bold\") {\n resolvedFontFamily = undefined;\n }\n\n const style: TextStyle = {\n color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n fontWeight: fontWeight as TextStyle[\"fontWeight\"],\n fontFamily: resolvedFontFamily,\n textDecorationLine: props.textDecoration as TextStyle[\"textDecorationLine\"],\n };\n\n // Map role to React Native accessibilityRole\n const accessibilityRole = role ? roleMap[role] : undefined;\n\n return (\n <RNText style={style} testID={id} accessibilityRole={accessibilityRole}>\n {children}\n </RNText>\n );\n};\n","import type React from \"react\";\nimport { ActivityIndicator, View } from \"react-native\";\nimport type { SpinnerProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Spinner: React.FC<SpinnerProps> = ({\n color,\n size,\n role,\n \"aria-label\": ariaLabel,\n \"aria-live\": ariaLive,\n \"aria-describedby\": ariaDescribedBy,\n testID,\n}) => {\n return (\n <View\n accessible={true}\n accessibilityRole={role === \"status\" ? \"none\" : undefined}\n accessibilityLabel={ariaLabel}\n accessibilityLiveRegion={\n ariaLive === \"polite\"\n ? \"polite\"\n : ariaLive === \"assertive\"\n ? \"assertive\"\n : \"none\"\n }\n testID={testID}\n >\n <ActivityIndicator\n color={color}\n size={typeof size === \"number\" ? size : \"small\"}\n />\n </View>\n );\n};\n\nSpinner.displayName = \"Spinner\";\n","import React from \"react\";\nimport { View, ViewStyle } from \"react-native\";\nimport { IconProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Icon: React.FC<IconProps> = ({ children, color, size }) => {\n const style: ViewStyle = {\n width: typeof size === \"number\" ? size : undefined,\n height: typeof size === \"number\" ? size : undefined,\n alignItems: \"center\",\n justifyContent: \"center\",\n };\n\n // On native, we try to pass the color down to children (like Text primitives)\n // to mimic the CSS inheritance behavior of the web version.\n const childrenWithProps = React.Children.map(children, (child) => {\n if (React.isValidElement(child)) {\n // @ts-ignore - passing color down to potential Text/Icon children\n return React.cloneElement(child, {\n color: child.props.color || color,\n // Also pass size if child seems to be an icon that needs it\n size: child.props.size || size,\n });\n }\n return child;\n });\n\n return <View style={style}>{childrenWithProps}</View>;\n};\n","import React from \"react\";\nimport { View, ViewStyle } from \"react-native\";\nimport { DividerProps } from \"@xsolla/xui-primitives-core\";\n\nexport const Divider: React.FC<DividerProps> = ({\n color,\n height,\n width,\n vertical,\n dashStroke,\n}) => {\n const style: ViewStyle = {\n backgroundColor: dashStroke\n ? \"transparent\"\n : color || \"rgba(255, 255, 255, 0.15)\",\n width: vertical ? (typeof width === \"number\" ? width : 1) : \"100%\",\n height: vertical ? \"100%\" : typeof height === \"number\" ? height : 1,\n ...(dashStroke && {\n borderStyle: \"dashed\",\n borderColor: color || \"rgba(255, 255, 255, 0.15)\",\n borderWidth: 0,\n ...(vertical\n ? { borderLeftWidth: typeof width === \"number\" ? width : 1 }\n : { borderTopWidth: typeof height === \"number\" ? height : 1 }),\n }),\n };\n\n return <View style={style} />;\n};\n","import React, { forwardRef } from \"react\";\nimport { TextInput as RNTextInput } from \"react-native\";\nimport { InputPrimitiveProps } from \"@xsolla/xui-primitives-core\";\n\n// Map web input types to React Native keyboard types\nconst keyboardTypeMap: Record<string, any> = {\n text: \"default\",\n number: \"numeric\",\n email: \"email-address\",\n tel: \"phone-pad\",\n url: \"url\",\n decimal: \"decimal-pad\",\n};\n\n// Map web inputMode to React Native keyboard types\nconst inputModeToKeyboardType: Record<string, any> = {\n none: \"default\",\n text: \"default\",\n decimal: \"decimal-pad\",\n numeric: \"number-pad\",\n tel: \"phone-pad\",\n search: \"default\",\n email: \"email-address\",\n url: \"url\",\n};\n\n// Map web autoComplete to React Native textContentType (iOS)\nconst autoCompleteToTextContentType: Record<string, any> = {\n \"one-time-code\": \"oneTimeCode\",\n email: \"emailAddress\",\n username: \"username\",\n password: \"password\",\n \"new-password\": \"newPassword\",\n tel: \"telephoneNumber\",\n \"postal-code\": \"postalCode\",\n name: \"name\",\n};\n\nexport const InputPrimitive = forwardRef<RNTextInput, InputPrimitiveProps>(\n (\n {\n value,\n placeholder,\n onChange,\n onChangeText,\n onFocus,\n onBlur,\n onKeyDown,\n disabled,\n secureTextEntry,\n style,\n color,\n fontSize,\n placeholderTextColor,\n maxLength,\n name,\n type,\n inputMode,\n autoComplete,\n id,\n \"aria-invalid\": ariaInvalid,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-label\": ariaLabel,\n \"aria-disabled\": ariaDisabled,\n \"data-testid\": dataTestId,\n },\n ref\n ) => {\n const handleChangeText = (text: string) => {\n onChangeText?.(text);\n\n // Create a synthetic event for onChange compatibility\n // Include nativeEvent and no-op methods to prevent runtime errors\n // when consumers expect DOM-like event behavior\n if (onChange) {\n const syntheticEvent = {\n target: { value: text },\n currentTarget: { value: text },\n type: \"change\",\n nativeEvent: { text },\n preventDefault: () => {},\n stopPropagation: () => {},\n isTrusted: false,\n } as unknown as React.ChangeEvent<HTMLInputElement>;\n onChange(syntheticEvent);\n }\n };\n\n // Determine keyboard type - inputMode takes precedence over type\n const keyboardType = inputMode\n ? inputModeToKeyboardType[inputMode] || \"default\"\n : type\n ? keyboardTypeMap[type] || \"default\"\n : \"default\";\n\n // Determine textContentType for iOS autofill\n const textContentType = autoComplete\n ? autoCompleteToTextContentType[autoComplete]\n : undefined;\n\n return (\n <RNTextInput\n ref={ref}\n value={value}\n placeholder={placeholder}\n onChangeText={handleChangeText}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyPress={(e) => {\n // Map onKeyPress to onKeyDown for cross-platform compatibility\n // Include preventDefault to avoid runtime errors when consumers call it\n if (onKeyDown) {\n onKeyDown({\n key: e.nativeEvent.key,\n preventDefault: () => {},\n } as any);\n }\n }}\n editable={!disabled}\n secureTextEntry={secureTextEntry || type === \"password\"}\n keyboardType={keyboardType}\n textContentType={textContentType}\n style={[\n {\n color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n flex: 1,\n padding: 0,\n textAlign: (style as any)?.textAlign || \"left\",\n },\n style as any,\n ]}\n placeholderTextColor={placeholderTextColor}\n maxLength={maxLength}\n // React Native accessibility props\n testID={dataTestId || id}\n accessibilityLabel={ariaLabel}\n accessibilityHint={ariaDescribedBy}\n accessibilityState={{\n disabled: disabled || ariaDisabled,\n }}\n accessible={true}\n />\n );\n }\n);\n\nInputPrimitive.displayName = \"InputPrimitive\";\n","import React, { forwardRef } from \"react\";\nimport { TextInput as RNTextInput } from \"react-native\";\nimport { TextAreaPrimitiveProps } from \"@xsolla/xui-primitives-core\";\n\nexport const TextAreaPrimitive = forwardRef<\n RNTextInput,\n TextAreaPrimitiveProps\n>(\n (\n {\n value,\n placeholder,\n onChange,\n onChangeText,\n onFocus,\n onBlur,\n onKeyDown,\n disabled,\n style,\n color,\n fontSize,\n placeholderTextColor,\n maxLength,\n rows,\n id,\n \"aria-invalid\": ariaInvalid,\n \"aria-describedby\": ariaDescribedBy,\n \"aria-labelledby\": ariaLabelledBy,\n \"aria-label\": ariaLabel,\n \"aria-disabled\": ariaDisabled,\n \"data-testid\": dataTestId,\n },\n ref\n ) => {\n const handleChangeText = (text: string) => {\n onChangeText?.(text);\n\n if (onChange) {\n const syntheticEvent = {\n target: { value: text },\n currentTarget: { value: text },\n type: \"change\",\n nativeEvent: { text },\n preventDefault: () => {},\n stopPropagation: () => {},\n isTrusted: false,\n } as unknown as React.ChangeEvent<HTMLTextAreaElement>;\n onChange(syntheticEvent);\n }\n };\n\n return (\n <RNTextInput\n ref={ref}\n value={value}\n placeholder={placeholder}\n onChangeText={handleChangeText}\n onFocus={onFocus}\n onBlur={onBlur}\n onKeyPress={(e) => {\n if (onKeyDown) {\n onKeyDown({\n key: e.nativeEvent.key,\n preventDefault: () => {},\n } as any);\n }\n }}\n editable={!disabled}\n multiline={true}\n numberOfLines={rows || 4}\n style={[\n {\n color,\n fontSize: typeof fontSize === \"number\" ? fontSize : undefined,\n flex: 1,\n padding: 0,\n textAlignVertical: \"top\",\n textAlign: (style as any)?.textAlign || \"left\",\n },\n style as any,\n ]}\n placeholderTextColor={placeholderTextColor}\n maxLength={maxLength}\n testID={dataTestId || id}\n accessibilityLabel={ariaLabel}\n accessibilityHint={ariaDescribedBy}\n accessibilityState={{\n disabled: disabled || ariaDisabled,\n }}\n accessible={true}\n />\n );\n }\n);\n\nTextAreaPrimitive.displayName = \"TextAreaPrimitive\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,gBAAqD;;;ACCrD,0BAQO;AAmID;AAhIC,IAAM,MAA0B,CAAC;AAAA,EACtC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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AExD,UAAM,qBAAiB;AAAA,MACrB,MAAM,kBAAkB,WAAW,MAAM;AAAA,MACzC,CAAC,WAAW,MAAM;AAAA,IACpB;AACA,UAAM,iBAAa,uBAAQ,MAAM,cAAc,IAAI,GAAG,CAAC,IAAI,CAAC;AAE5D,WACE;AAAA,MAAC;AAAA;AAAA,QACC,UAAS;AAAA,QACT,SAAQ;AAAA,QACR,cAAc,MAAM,aAAa,IAAI;AAAA,QACrC,cAAc,MAAM,aAAa,KAAK;AAAA,QACtC;AAAA,QACA,OAAO,EAAE,QAAQ,cAAc;AAAA,QAE9B;AAAA;AAAA,UACA,aACC;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,eAAa;AAAA,cACb,UAAS;AAAA,cACT,iBAAiB,MAAM,OAAO,WAAW;AAAA,cACzC,cAAc;AAAA,cACd,iBAAiB;AAAA,cACjB,mBAAmB;AAAA,cACnB,QAAQ;AAAA,cACR,OAAO;AAAA,gBACL,GAAG;AAAA,gBACH,WAAW;AAAA,gBACX,eAAe;AAAA,gBACf,YAAY;AAAA,gBACZ,OAAO;AAAA,gBACP,GAAG;AAAA,cACL;AAAA,cAEC,iBAAO,YAAY,YAAY,OAAO,YAAY,WACjD;AAAA,gBAAC;AAAA;AAAA,kBACC,OAAO,MAAM,OAAO,QAAQ;AAAA,kBAC5B,UAAU,WAAW;AAAA,kBACrB,YAAW;AAAA,kBACX,OAAO,EAAE,YAAY,WAAW,WAAW;AAAA,kBAE1C;AAAA;AAAA,cACH,IAEA;AAAA;AAAA,UAEJ;AAAA;AAAA;AAAA,IAEJ;AAAA,EAEJ;AACF;AAEA,QAAQ,cAAc;","names":["import_react","import_react_native","import_jsx_runtime","RNText","import_react_native","import_jsx_runtime","import_react_native","import_jsx_runtime","import_react_native","import_jsx_runtime","import_react","import_react_native","import_jsx_runtime","RNTextInput","import_react","import_react_native","import_jsx_runtime","RNTextInput","import_jsx_runtime"]}
package/index.mjs ADDED
@@ -0,0 +1,607 @@
1
+ // src/Tooltip.tsx
2
+ import { forwardRef as forwardRef3, useState, useMemo } from "react";
3
+
4
+ // ../primitives-native/src/Box.tsx
5
+ import {
6
+ View,
7
+ Pressable,
8
+ Image
9
+ } from "react-native";
10
+ import { jsx } from "react/jsx-runtime";
11
+ var Box = ({
12
+ children,
13
+ onPress,
14
+ onLayout,
15
+ onMoveShouldSetResponder,
16
+ onResponderGrant,
17
+ onResponderMove,
18
+ onResponderRelease,
19
+ onResponderTerminate,
20
+ backgroundColor,
21
+ borderColor,
22
+ borderWidth,
23
+ borderBottomWidth,
24
+ borderBottomColor,
25
+ borderTopWidth,
26
+ borderTopColor,
27
+ borderLeftWidth,
28
+ borderLeftColor,
29
+ borderRightWidth,
30
+ borderRightColor,
31
+ borderRadius,
32
+ borderStyle,
33
+ height,
34
+ padding,
35
+ paddingHorizontal,
36
+ paddingVertical,
37
+ margin,
38
+ marginTop,
39
+ marginBottom,
40
+ marginLeft,
41
+ marginRight,
42
+ flexDirection,
43
+ alignItems,
44
+ justifyContent,
45
+ position,
46
+ top,
47
+ bottom,
48
+ left,
49
+ right,
50
+ width,
51
+ flex,
52
+ overflow,
53
+ zIndex,
54
+ hoverStyle,
55
+ pressStyle,
56
+ style,
57
+ "data-testid": dataTestId,
58
+ testID,
59
+ as,
60
+ src,
61
+ alt,
62
+ ...rest
63
+ }) => {
64
+ const getContainerStyle = (pressed) => ({
65
+ backgroundColor: pressed && pressStyle?.backgroundColor ? pressStyle.backgroundColor : backgroundColor,
66
+ borderColor,
67
+ borderWidth,
68
+ borderBottomWidth,
69
+ borderBottomColor,
70
+ borderTopWidth,
71
+ borderTopColor,
72
+ borderLeftWidth,
73
+ borderLeftColor,
74
+ borderRightWidth,
75
+ borderRightColor,
76
+ borderRadius,
77
+ borderStyle,
78
+ overflow,
79
+ zIndex,
80
+ height,
81
+ width,
82
+ padding,
83
+ paddingHorizontal,
84
+ paddingVertical,
85
+ margin,
86
+ marginTop,
87
+ marginBottom,
88
+ marginLeft,
89
+ marginRight,
90
+ flexDirection,
91
+ alignItems,
92
+ justifyContent,
93
+ position,
94
+ top,
95
+ bottom,
96
+ left,
97
+ right,
98
+ flex,
99
+ ...style
100
+ });
101
+ const finalTestID = dataTestId || testID;
102
+ const {
103
+ role,
104
+ tabIndex,
105
+ onKeyDown,
106
+ onKeyUp,
107
+ "aria-label": _ariaLabel,
108
+ "aria-labelledby": _ariaLabelledBy,
109
+ "aria-current": _ariaCurrent,
110
+ "aria-disabled": _ariaDisabled,
111
+ "aria-live": _ariaLive,
112
+ className,
113
+ "data-testid": _dataTestId,
114
+ ...nativeRest
115
+ } = rest;
116
+ if (as === "img" && src) {
117
+ const imageStyle = {
118
+ width,
119
+ height,
120
+ borderRadius,
121
+ position,
122
+ top,
123
+ bottom,
124
+ left,
125
+ right,
126
+ ...style
127
+ };
128
+ return /* @__PURE__ */ jsx(
129
+ Image,
130
+ {
131
+ source: { uri: src },
132
+ style: imageStyle,
133
+ testID: finalTestID,
134
+ resizeMode: "cover",
135
+ ...nativeRest
136
+ }
137
+ );
138
+ }
139
+ if (onPress) {
140
+ return /* @__PURE__ */ jsx(
141
+ Pressable,
142
+ {
143
+ onPress,
144
+ onLayout,
145
+ onMoveShouldSetResponder,
146
+ onResponderGrant,
147
+ onResponderMove,
148
+ onResponderRelease,
149
+ onResponderTerminate,
150
+ style: ({ pressed }) => getContainerStyle(pressed),
151
+ testID: finalTestID,
152
+ ...nativeRest,
153
+ children
154
+ }
155
+ );
156
+ }
157
+ return /* @__PURE__ */ jsx(
158
+ View,
159
+ {
160
+ style: getContainerStyle(),
161
+ testID: finalTestID,
162
+ onLayout,
163
+ onMoveShouldSetResponder,
164
+ onResponderGrant,
165
+ onResponderMove,
166
+ onResponderRelease,
167
+ onResponderTerminate,
168
+ ...nativeRest,
169
+ children
170
+ }
171
+ );
172
+ };
173
+
174
+ // ../primitives-native/src/Text.tsx
175
+ import { Text as RNText } from "react-native";
176
+ import { jsx as jsx2 } from "react/jsx-runtime";
177
+ var roleMap = {
178
+ alert: "alert",
179
+ heading: "header",
180
+ button: "button",
181
+ link: "link",
182
+ text: "text"
183
+ };
184
+ var Text = ({
185
+ children,
186
+ color,
187
+ fontSize,
188
+ fontWeight,
189
+ fontFamily,
190
+ id,
191
+ role,
192
+ ...props
193
+ }) => {
194
+ let resolvedFontFamily = fontFamily ? fontFamily.split(",")[0].replace(/['"]/g, "").trim() : void 0;
195
+ if (resolvedFontFamily === "Pilat Wide Bold") {
196
+ resolvedFontFamily = void 0;
197
+ }
198
+ const style = {
199
+ color,
200
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
201
+ fontWeight,
202
+ fontFamily: resolvedFontFamily,
203
+ textDecorationLine: props.textDecoration
204
+ };
205
+ const accessibilityRole = role ? roleMap[role] : void 0;
206
+ return /* @__PURE__ */ jsx2(RNText, { style, testID: id, accessibilityRole, children });
207
+ };
208
+
209
+ // ../primitives-native/src/Spinner.tsx
210
+ import { ActivityIndicator, View as View2 } from "react-native";
211
+ import { jsx as jsx3 } from "react/jsx-runtime";
212
+ var Spinner = ({
213
+ color,
214
+ size,
215
+ role,
216
+ "aria-label": ariaLabel,
217
+ "aria-live": ariaLive,
218
+ "aria-describedby": ariaDescribedBy,
219
+ testID
220
+ }) => {
221
+ return /* @__PURE__ */ jsx3(
222
+ View2,
223
+ {
224
+ accessible: true,
225
+ accessibilityRole: role === "status" ? "none" : void 0,
226
+ accessibilityLabel: ariaLabel,
227
+ accessibilityLiveRegion: ariaLive === "polite" ? "polite" : ariaLive === "assertive" ? "assertive" : "none",
228
+ testID,
229
+ children: /* @__PURE__ */ jsx3(
230
+ ActivityIndicator,
231
+ {
232
+ color,
233
+ size: typeof size === "number" ? size : "small"
234
+ }
235
+ )
236
+ }
237
+ );
238
+ };
239
+ Spinner.displayName = "Spinner";
240
+
241
+ // ../primitives-native/src/Icon.tsx
242
+ import React from "react";
243
+ import { View as View3 } from "react-native";
244
+ import { jsx as jsx4 } from "react/jsx-runtime";
245
+
246
+ // ../primitives-native/src/Divider.tsx
247
+ import { View as View4 } from "react-native";
248
+ import { jsx as jsx5 } from "react/jsx-runtime";
249
+
250
+ // ../primitives-native/src/Input.tsx
251
+ import { forwardRef } from "react";
252
+ import { TextInput as RNTextInput } from "react-native";
253
+ import { jsx as jsx6 } from "react/jsx-runtime";
254
+ var keyboardTypeMap = {
255
+ text: "default",
256
+ number: "numeric",
257
+ email: "email-address",
258
+ tel: "phone-pad",
259
+ url: "url",
260
+ decimal: "decimal-pad"
261
+ };
262
+ var inputModeToKeyboardType = {
263
+ none: "default",
264
+ text: "default",
265
+ decimal: "decimal-pad",
266
+ numeric: "number-pad",
267
+ tel: "phone-pad",
268
+ search: "default",
269
+ email: "email-address",
270
+ url: "url"
271
+ };
272
+ var autoCompleteToTextContentType = {
273
+ "one-time-code": "oneTimeCode",
274
+ email: "emailAddress",
275
+ username: "username",
276
+ password: "password",
277
+ "new-password": "newPassword",
278
+ tel: "telephoneNumber",
279
+ "postal-code": "postalCode",
280
+ name: "name"
281
+ };
282
+ var InputPrimitive = forwardRef(
283
+ ({
284
+ value,
285
+ placeholder,
286
+ onChange,
287
+ onChangeText,
288
+ onFocus,
289
+ onBlur,
290
+ onKeyDown,
291
+ disabled,
292
+ secureTextEntry,
293
+ style,
294
+ color,
295
+ fontSize,
296
+ placeholderTextColor,
297
+ maxLength,
298
+ name,
299
+ type,
300
+ inputMode,
301
+ autoComplete,
302
+ id,
303
+ "aria-invalid": ariaInvalid,
304
+ "aria-describedby": ariaDescribedBy,
305
+ "aria-labelledby": ariaLabelledBy,
306
+ "aria-label": ariaLabel,
307
+ "aria-disabled": ariaDisabled,
308
+ "data-testid": dataTestId
309
+ }, ref) => {
310
+ const handleChangeText = (text) => {
311
+ onChangeText?.(text);
312
+ if (onChange) {
313
+ const syntheticEvent = {
314
+ target: { value: text },
315
+ currentTarget: { value: text },
316
+ type: "change",
317
+ nativeEvent: { text },
318
+ preventDefault: () => {
319
+ },
320
+ stopPropagation: () => {
321
+ },
322
+ isTrusted: false
323
+ };
324
+ onChange(syntheticEvent);
325
+ }
326
+ };
327
+ const keyboardType = inputMode ? inputModeToKeyboardType[inputMode] || "default" : type ? keyboardTypeMap[type] || "default" : "default";
328
+ const textContentType = autoComplete ? autoCompleteToTextContentType[autoComplete] : void 0;
329
+ return /* @__PURE__ */ jsx6(
330
+ RNTextInput,
331
+ {
332
+ ref,
333
+ value,
334
+ placeholder,
335
+ onChangeText: handleChangeText,
336
+ onFocus,
337
+ onBlur,
338
+ onKeyPress: (e) => {
339
+ if (onKeyDown) {
340
+ onKeyDown({
341
+ key: e.nativeEvent.key,
342
+ preventDefault: () => {
343
+ }
344
+ });
345
+ }
346
+ },
347
+ editable: !disabled,
348
+ secureTextEntry: secureTextEntry || type === "password",
349
+ keyboardType,
350
+ textContentType,
351
+ style: [
352
+ {
353
+ color,
354
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
355
+ flex: 1,
356
+ padding: 0,
357
+ textAlign: style?.textAlign || "left"
358
+ },
359
+ style
360
+ ],
361
+ placeholderTextColor,
362
+ maxLength,
363
+ testID: dataTestId || id,
364
+ accessibilityLabel: ariaLabel,
365
+ accessibilityHint: ariaDescribedBy,
366
+ accessibilityState: {
367
+ disabled: disabled || ariaDisabled
368
+ },
369
+ accessible: true
370
+ }
371
+ );
372
+ }
373
+ );
374
+ InputPrimitive.displayName = "InputPrimitive";
375
+
376
+ // ../primitives-native/src/TextArea.tsx
377
+ import { forwardRef as forwardRef2 } from "react";
378
+ import { TextInput as RNTextInput2 } from "react-native";
379
+ import { jsx as jsx7 } from "react/jsx-runtime";
380
+ var TextAreaPrimitive = forwardRef2(
381
+ ({
382
+ value,
383
+ placeholder,
384
+ onChange,
385
+ onChangeText,
386
+ onFocus,
387
+ onBlur,
388
+ onKeyDown,
389
+ disabled,
390
+ style,
391
+ color,
392
+ fontSize,
393
+ placeholderTextColor,
394
+ maxLength,
395
+ rows,
396
+ id,
397
+ "aria-invalid": ariaInvalid,
398
+ "aria-describedby": ariaDescribedBy,
399
+ "aria-labelledby": ariaLabelledBy,
400
+ "aria-label": ariaLabel,
401
+ "aria-disabled": ariaDisabled,
402
+ "data-testid": dataTestId
403
+ }, ref) => {
404
+ const handleChangeText = (text) => {
405
+ onChangeText?.(text);
406
+ if (onChange) {
407
+ const syntheticEvent = {
408
+ target: { value: text },
409
+ currentTarget: { value: text },
410
+ type: "change",
411
+ nativeEvent: { text },
412
+ preventDefault: () => {
413
+ },
414
+ stopPropagation: () => {
415
+ },
416
+ isTrusted: false
417
+ };
418
+ onChange(syntheticEvent);
419
+ }
420
+ };
421
+ return /* @__PURE__ */ jsx7(
422
+ RNTextInput2,
423
+ {
424
+ ref,
425
+ value,
426
+ placeholder,
427
+ onChangeText: handleChangeText,
428
+ onFocus,
429
+ onBlur,
430
+ onKeyPress: (e) => {
431
+ if (onKeyDown) {
432
+ onKeyDown({
433
+ key: e.nativeEvent.key,
434
+ preventDefault: () => {
435
+ }
436
+ });
437
+ }
438
+ },
439
+ editable: !disabled,
440
+ multiline: true,
441
+ numberOfLines: rows || 4,
442
+ style: [
443
+ {
444
+ color,
445
+ fontSize: typeof fontSize === "number" ? fontSize : void 0,
446
+ flex: 1,
447
+ padding: 0,
448
+ textAlignVertical: "top",
449
+ textAlign: style?.textAlign || "left"
450
+ },
451
+ style
452
+ ],
453
+ placeholderTextColor,
454
+ maxLength,
455
+ testID: dataTestId || id,
456
+ accessibilityLabel: ariaLabel,
457
+ accessibilityHint: ariaDescribedBy,
458
+ accessibilityState: {
459
+ disabled: disabled || ariaDisabled
460
+ },
461
+ accessible: true
462
+ }
463
+ );
464
+ }
465
+ );
466
+ TextAreaPrimitive.displayName = "TextAreaPrimitive";
467
+
468
+ // src/Tooltip.tsx
469
+ import { useDesignSystem } from "@xsolla/xui-core";
470
+ import { jsx as jsx8, jsxs } from "react/jsx-runtime";
471
+ var getPositionStyles = (placement, offset) => {
472
+ switch (placement) {
473
+ case "top":
474
+ case "top-center":
475
+ return {
476
+ bottom: `calc(100% + ${offset}px)`,
477
+ left: "50%",
478
+ transform: "translateX(-50%)"
479
+ };
480
+ case "top-start":
481
+ return { bottom: `calc(100% + ${offset}px)`, left: 0 };
482
+ case "top-end":
483
+ return { bottom: `calc(100% + ${offset}px)`, right: 0 };
484
+ case "bottom":
485
+ case "bottom-center":
486
+ return {
487
+ top: `calc(100% + ${offset}px)`,
488
+ left: "50%",
489
+ transform: "translateX(-50%)"
490
+ };
491
+ case "bottom-start":
492
+ return { top: `calc(100% + ${offset}px)`, left: 0 };
493
+ case "bottom-end":
494
+ return { top: `calc(100% + ${offset}px)`, right: 0 };
495
+ case "left":
496
+ return {
497
+ right: `calc(100% + ${offset}px)`,
498
+ top: "50%",
499
+ transform: "translateY(-50%)"
500
+ };
501
+ case "left-start":
502
+ return { right: `calc(100% + ${offset}px)`, top: 0 };
503
+ case "left-end":
504
+ return { right: `calc(100% + ${offset}px)`, bottom: 0 };
505
+ case "right":
506
+ return {
507
+ left: `calc(100% + ${offset}px)`,
508
+ top: "50%",
509
+ transform: "translateY(-50%)"
510
+ };
511
+ case "right-start":
512
+ return { left: `calc(100% + ${offset}px)`, top: 0 };
513
+ case "right-end":
514
+ return { left: `calc(100% + ${offset}px)`, bottom: 0 };
515
+ default:
516
+ return { bottom: `calc(100% + ${offset}px)`, left: 0 };
517
+ }
518
+ };
519
+ var getTypoStyles = (size) => {
520
+ switch (size) {
521
+ case "sm":
522
+ return { fontSize: 12, lineHeight: "16px" };
523
+ case "md":
524
+ return { fontSize: 14, lineHeight: "18px" };
525
+ case "lg":
526
+ return { fontSize: 16, lineHeight: "20px" };
527
+ case "xl":
528
+ return { fontSize: 18, lineHeight: "22px" };
529
+ default:
530
+ return { fontSize: 14, lineHeight: "18px" };
531
+ }
532
+ };
533
+ var Tooltip = forwardRef3(
534
+ ({
535
+ content,
536
+ children,
537
+ size = "md",
538
+ delayEnter = 0,
539
+ delayLeave = 100,
540
+ offset = 12,
541
+ placement = "top-start",
542
+ controlledVisible,
543
+ style,
544
+ "data-testid": dataTestId,
545
+ className,
546
+ ...props
547
+ }, ref) => {
548
+ const [isHovered, setIsHovered] = useState(false);
549
+ const { theme } = useDesignSystem();
550
+ const isVisible = controlledVisible !== void 0 ? controlledVisible : isHovered;
551
+ const positionStyles = useMemo(
552
+ () => getPositionStyles(placement, offset),
553
+ [placement, offset]
554
+ );
555
+ const typoStyles = useMemo(() => getTypoStyles(size), [size]);
556
+ return /* @__PURE__ */ jsxs(
557
+ Box,
558
+ {
559
+ position: "relative",
560
+ display: "inline-flex",
561
+ onMouseEnter: () => setIsHovered(true),
562
+ onMouseLeave: () => setIsHovered(false),
563
+ className,
564
+ style: { height: "fit-content" },
565
+ children: [
566
+ children,
567
+ isVisible && /* @__PURE__ */ jsx8(
568
+ Box,
569
+ {
570
+ ref,
571
+ "data-testid": dataTestId,
572
+ position: "absolute",
573
+ backgroundColor: theme.colors.background.secondary,
574
+ borderRadius: 8,
575
+ paddingVertical: 8,
576
+ paddingHorizontal: 12,
577
+ zIndex: 2e3,
578
+ style: {
579
+ ...positionStyles,
580
+ boxShadow: "0 2px 4px rgba(0, 36, 77, 0.2)",
581
+ pointerEvents: "none",
582
+ whiteSpace: "nowrap",
583
+ width: "max-content",
584
+ ...style
585
+ },
586
+ children: typeof content === "string" || typeof content === "number" ? /* @__PURE__ */ jsx8(
587
+ Text,
588
+ {
589
+ color: theme.colors.content.primary,
590
+ fontSize: typoStyles.fontSize,
591
+ fontWeight: "400",
592
+ style: { lineHeight: typoStyles.lineHeight },
593
+ children: content
594
+ }
595
+ ) : content
596
+ }
597
+ )
598
+ ]
599
+ }
600
+ );
601
+ }
602
+ );
603
+ Tooltip.displayName = "Tooltip";
604
+ export {
605
+ Tooltip
606
+ };
607
+ //# sourceMappingURL=index.mjs.map