@xsolla/xui-uploader-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.d.mts +35 -0
- package/index.d.ts +35 -0
- package/index.js +623 -0
- package/index.js.map +1 -0
- package/index.mjs +590 -0
- package/index.mjs.map +1 -0
- package/package.json +26 -0
package/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.tsx","../../src/Uploader.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 \"./Uploader\";\n","import React, { useRef, useState, forwardRef } 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 { Button } from \"@xsolla/xui-button\";\nimport { Upload, File, X } from \"@xsolla/xui-icons\";\n\nexport interface UploaderProps {\n /**\n * Label for the uploader\n */\n label?: string;\n /**\n * Placeholder text when no files are selected\n */\n placeholder?: string;\n /**\n * Accepted file types (e.g., \".jpg,.png\")\n */\n accept?: string;\n /**\n * Whether multiple files can be selected\n */\n multiple?: boolean;\n /**\n * Callback when files are selected\n */\n onFilesChange?: (files: File[]) => void;\n /**\n * Property for disabling the control\n */\n disabled?: boolean;\n /**\n * Size of the button\n */\n size?: \"xl\" | \"l\" | \"m\" | \"s\" | \"xs\";\n}\n\nexport const Uploader = forwardRef<HTMLInputElement, UploaderProps>(\n (\n {\n label,\n placeholder = \"Select files to upload\",\n accept,\n multiple = false,\n onFilesChange,\n disabled = false,\n size = \"m\",\n },\n ref\n ) => {\n const { theme } = useDesignSystem();\n const fileInputRef = useRef<HTMLInputElement>(null);\n const [selectedFiles, setSelectedFiles] = useState<File[]>([]);\n\n // Forward ref to input element\n React.useImperativeHandle(\n ref,\n () => fileInputRef.current as HTMLInputElement,\n []\n );\n\n const handleButtonClick = () => {\n fileInputRef.current?.click();\n };\n\n const handleFileChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (e.target.files) {\n const newFiles = Array.from(e.target.files);\n const updatedFiles = multiple ? [...selectedFiles, ...newFiles] : newFiles;\n setSelectedFiles(updatedFiles);\n onFilesChange?.(updatedFiles);\n }\n };\n\n const removeFile = (index: number) => {\n const updatedFiles = selectedFiles.filter((_, i) => i !== index);\n setSelectedFiles(updatedFiles);\n onFilesChange?.(updatedFiles);\n };\n\n return (\n <Box flexDirection=\"column\" gap={8} width=\"100%\">\n {label && (\n <Text\n color={theme.colors.content.secondary}\n fontSize={14}\n fontWeight=\"500\"\n >\n {label}\n </Text>\n )}\n\n <input\n type=\"file\"\n ref={fileInputRef}\n accept={accept}\n multiple={multiple}\n onChange={handleFileChange}\n style={{ display: \"none\" }}\n disabled={disabled}\n />\n\n <Button\n variant=\"primary\"\n tone=\"brand\"\n size={size}\n disabled={disabled}\n onPress={handleButtonClick}\n iconLeft={<Upload />}\n fullWidth\n >\n {placeholder}\n </Button>\n\n {selectedFiles.length > 0 && (\n <Box flexDirection=\"column\" gap={4} marginTop={4}>\n {selectedFiles.map((file, index) => (\n <Box\n key={`${file.name}-${index}`}\n flexDirection=\"row\"\n alignItems=\"center\"\n justifyContent=\"space-between\"\n backgroundColor={theme.colors.background.secondary}\n padding={8}\n borderRadius={4}\n gap={8}\n >\n <Box flexDirection=\"row\" alignItems=\"center\" gap={8} flex={1}>\n <File size={16} color={theme.colors.content.secondary} />\n <Text\n fontSize={13}\n color={theme.colors.content.primary}\n numberOfLines={1}\n >\n {file.name}\n </Text>\n </Box>\n <Box\n as=\"button\"\n onPress={() => removeFile(index)}\n style={{\n border: \"none\",\n background: \"transparent\",\n cursor: \"pointer\",\n padding: 4,\n }}\n >\n <X size={14} color={theme.colors.content.alert.primary} />\n </Box>\n </Box>\n ))}\n </Box>\n )}\n </Box>\n );\n }\n);\n\nUploader.displayName = \"Uploader\";\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,gBAAoD;;;ACCpD,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;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAC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A;AAAA,cACR;AAAA,eACF;AAAA,YACA;AAAA,cAAC;AAAA;AAAA,gBACC,IAAG;AAAA,gBACH,SAAS,MAAM,WAAW,KAAK;AAAA,gBAC/B,OAAO;AAAA,kBACL,QAAQ;AAAA,kBACR,YAAY;AAAA,kBACZ,QAAQ;AAAA,kBACR,SAAS;AAAA,gBACX;AAAA,gBAEA,uDAAC,sBAAE,MAAM,IAAI,OAAO,MAAM,OAAO,QAAQ,MAAM,SAAS;AAAA;AAAA,YAC1D;AAAA;AAAA;AAAA,QA9BK,GAAG,KAAK,IAAI,IAAI,KAAK;AAAA,MA+B5B,CACD,GACH;AAAA,OAEJ;AAAA,EAEJ;AACF;AAEA,SAAS,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","React"]}
|
package/index.mjs
ADDED
|
@@ -0,0 +1,590 @@
|
|
|
1
|
+
// src/Uploader.tsx
|
|
2
|
+
import React4, { useRef, useState, forwardRef as forwardRef3 } 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/Uploader.tsx
|
|
469
|
+
import { useDesignSystem } from "@xsolla/xui-core";
|
|
470
|
+
import { Button } from "@xsolla/xui-button";
|
|
471
|
+
import { Upload, File, X } from "@xsolla/xui-icons";
|
|
472
|
+
import { jsx as jsx8, jsxs } from "react/jsx-runtime";
|
|
473
|
+
var Uploader = forwardRef3(
|
|
474
|
+
({
|
|
475
|
+
label,
|
|
476
|
+
placeholder = "Select files to upload",
|
|
477
|
+
accept,
|
|
478
|
+
multiple = false,
|
|
479
|
+
onFilesChange,
|
|
480
|
+
disabled = false,
|
|
481
|
+
size = "m"
|
|
482
|
+
}, ref) => {
|
|
483
|
+
const { theme } = useDesignSystem();
|
|
484
|
+
const fileInputRef = useRef(null);
|
|
485
|
+
const [selectedFiles, setSelectedFiles] = useState([]);
|
|
486
|
+
React4.useImperativeHandle(
|
|
487
|
+
ref,
|
|
488
|
+
() => fileInputRef.current,
|
|
489
|
+
[]
|
|
490
|
+
);
|
|
491
|
+
const handleButtonClick = () => {
|
|
492
|
+
fileInputRef.current?.click();
|
|
493
|
+
};
|
|
494
|
+
const handleFileChange = (e) => {
|
|
495
|
+
if (e.target.files) {
|
|
496
|
+
const newFiles = Array.from(e.target.files);
|
|
497
|
+
const updatedFiles = multiple ? [...selectedFiles, ...newFiles] : newFiles;
|
|
498
|
+
setSelectedFiles(updatedFiles);
|
|
499
|
+
onFilesChange?.(updatedFiles);
|
|
500
|
+
}
|
|
501
|
+
};
|
|
502
|
+
const removeFile = (index) => {
|
|
503
|
+
const updatedFiles = selectedFiles.filter((_, i) => i !== index);
|
|
504
|
+
setSelectedFiles(updatedFiles);
|
|
505
|
+
onFilesChange?.(updatedFiles);
|
|
506
|
+
};
|
|
507
|
+
return /* @__PURE__ */ jsxs(Box, { flexDirection: "column", gap: 8, width: "100%", children: [
|
|
508
|
+
label && /* @__PURE__ */ jsx8(
|
|
509
|
+
Text,
|
|
510
|
+
{
|
|
511
|
+
color: theme.colors.content.secondary,
|
|
512
|
+
fontSize: 14,
|
|
513
|
+
fontWeight: "500",
|
|
514
|
+
children: label
|
|
515
|
+
}
|
|
516
|
+
),
|
|
517
|
+
/* @__PURE__ */ jsx8(
|
|
518
|
+
"input",
|
|
519
|
+
{
|
|
520
|
+
type: "file",
|
|
521
|
+
ref: fileInputRef,
|
|
522
|
+
accept,
|
|
523
|
+
multiple,
|
|
524
|
+
onChange: handleFileChange,
|
|
525
|
+
style: { display: "none" },
|
|
526
|
+
disabled
|
|
527
|
+
}
|
|
528
|
+
),
|
|
529
|
+
/* @__PURE__ */ jsx8(
|
|
530
|
+
Button,
|
|
531
|
+
{
|
|
532
|
+
variant: "primary",
|
|
533
|
+
tone: "brand",
|
|
534
|
+
size,
|
|
535
|
+
disabled,
|
|
536
|
+
onPress: handleButtonClick,
|
|
537
|
+
iconLeft: /* @__PURE__ */ jsx8(Upload, {}),
|
|
538
|
+
fullWidth: true,
|
|
539
|
+
children: placeholder
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
selectedFiles.length > 0 && /* @__PURE__ */ jsx8(Box, { flexDirection: "column", gap: 4, marginTop: 4, children: selectedFiles.map((file, index) => /* @__PURE__ */ jsxs(
|
|
543
|
+
Box,
|
|
544
|
+
{
|
|
545
|
+
flexDirection: "row",
|
|
546
|
+
alignItems: "center",
|
|
547
|
+
justifyContent: "space-between",
|
|
548
|
+
backgroundColor: theme.colors.background.secondary,
|
|
549
|
+
padding: 8,
|
|
550
|
+
borderRadius: 4,
|
|
551
|
+
gap: 8,
|
|
552
|
+
children: [
|
|
553
|
+
/* @__PURE__ */ jsxs(Box, { flexDirection: "row", alignItems: "center", gap: 8, flex: 1, children: [
|
|
554
|
+
/* @__PURE__ */ jsx8(File, { size: 16, color: theme.colors.content.secondary }),
|
|
555
|
+
/* @__PURE__ */ jsx8(
|
|
556
|
+
Text,
|
|
557
|
+
{
|
|
558
|
+
fontSize: 13,
|
|
559
|
+
color: theme.colors.content.primary,
|
|
560
|
+
numberOfLines: 1,
|
|
561
|
+
children: file.name
|
|
562
|
+
}
|
|
563
|
+
)
|
|
564
|
+
] }),
|
|
565
|
+
/* @__PURE__ */ jsx8(
|
|
566
|
+
Box,
|
|
567
|
+
{
|
|
568
|
+
as: "button",
|
|
569
|
+
onPress: () => removeFile(index),
|
|
570
|
+
style: {
|
|
571
|
+
border: "none",
|
|
572
|
+
background: "transparent",
|
|
573
|
+
cursor: "pointer",
|
|
574
|
+
padding: 4
|
|
575
|
+
},
|
|
576
|
+
children: /* @__PURE__ */ jsx8(X, { size: 14, color: theme.colors.content.alert.primary })
|
|
577
|
+
}
|
|
578
|
+
)
|
|
579
|
+
]
|
|
580
|
+
},
|
|
581
|
+
`${file.name}-${index}`
|
|
582
|
+
)) })
|
|
583
|
+
] });
|
|
584
|
+
}
|
|
585
|
+
);
|
|
586
|
+
Uploader.displayName = "Uploader";
|
|
587
|
+
export {
|
|
588
|
+
Uploader
|
|
589
|
+
};
|
|
590
|
+
//# sourceMappingURL=index.mjs.map
|