@xsolla/xui-progress-line 0.89.0 → 0.91.0
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/native/index.js +5 -272
- package/native/index.js.map +1 -1
- package/native/index.mjs +5 -262
- package/native/index.mjs.map +1 -1
- package/package.json +4 -3
- package/web/index.js +5 -266
- package/web/index.js.map +1 -1
- package/web/index.mjs +5 -266
- package/web/index.mjs.map +1 -1
package/native/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/ProgressLine.tsx
|
|
2
|
-
import { forwardRef
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
3
|
|
|
4
4
|
// ../primitives-native/src/Box.tsx
|
|
5
5
|
import {
|
|
@@ -171,266 +171,9 @@ var Box = ({
|
|
|
171
171
|
);
|
|
172
172
|
};
|
|
173
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
|
-
|
|
178
|
-
// ../primitives-native/src/Spinner.tsx
|
|
179
|
-
import { ActivityIndicator, View as View2 } from "react-native";
|
|
180
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
181
|
-
var Spinner = ({
|
|
182
|
-
color,
|
|
183
|
-
size,
|
|
184
|
-
role,
|
|
185
|
-
"aria-label": ariaLabel,
|
|
186
|
-
"aria-live": ariaLive,
|
|
187
|
-
testID
|
|
188
|
-
}) => {
|
|
189
|
-
return /* @__PURE__ */ jsx3(
|
|
190
|
-
View2,
|
|
191
|
-
{
|
|
192
|
-
accessible: true,
|
|
193
|
-
accessibilityRole: role === "status" ? "none" : void 0,
|
|
194
|
-
accessibilityLabel: ariaLabel,
|
|
195
|
-
accessibilityLiveRegion: ariaLive === "polite" ? "polite" : ariaLive === "assertive" ? "assertive" : "none",
|
|
196
|
-
testID,
|
|
197
|
-
children: /* @__PURE__ */ jsx3(
|
|
198
|
-
ActivityIndicator,
|
|
199
|
-
{
|
|
200
|
-
color,
|
|
201
|
-
size: typeof size === "number" ? size : "small"
|
|
202
|
-
}
|
|
203
|
-
)
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
};
|
|
207
|
-
Spinner.displayName = "Spinner";
|
|
208
|
-
|
|
209
|
-
// ../primitives-native/src/Icon.tsx
|
|
210
|
-
import React from "react";
|
|
211
|
-
import { View as View3 } from "react-native";
|
|
212
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
213
|
-
|
|
214
|
-
// ../primitives-native/src/Divider.tsx
|
|
215
|
-
import { View as View4 } from "react-native";
|
|
216
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
217
|
-
|
|
218
|
-
// ../primitives-native/src/Input.tsx
|
|
219
|
-
import { forwardRef } from "react";
|
|
220
|
-
import { TextInput as RNTextInput } from "react-native";
|
|
221
|
-
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
222
|
-
var keyboardTypeMap = {
|
|
223
|
-
text: "default",
|
|
224
|
-
number: "numeric",
|
|
225
|
-
email: "email-address",
|
|
226
|
-
tel: "phone-pad",
|
|
227
|
-
url: "url",
|
|
228
|
-
decimal: "decimal-pad"
|
|
229
|
-
};
|
|
230
|
-
var inputModeToKeyboardType = {
|
|
231
|
-
none: "default",
|
|
232
|
-
text: "default",
|
|
233
|
-
decimal: "decimal-pad",
|
|
234
|
-
numeric: "number-pad",
|
|
235
|
-
tel: "phone-pad",
|
|
236
|
-
search: "default",
|
|
237
|
-
email: "email-address",
|
|
238
|
-
url: "url"
|
|
239
|
-
};
|
|
240
|
-
var autoCompleteToTextContentType = {
|
|
241
|
-
"one-time-code": "oneTimeCode",
|
|
242
|
-
email: "emailAddress",
|
|
243
|
-
username: "username",
|
|
244
|
-
password: "password",
|
|
245
|
-
"new-password": "newPassword",
|
|
246
|
-
tel: "telephoneNumber",
|
|
247
|
-
"postal-code": "postalCode",
|
|
248
|
-
name: "name"
|
|
249
|
-
};
|
|
250
|
-
var InputPrimitive = forwardRef(
|
|
251
|
-
({
|
|
252
|
-
value,
|
|
253
|
-
placeholder,
|
|
254
|
-
onChange,
|
|
255
|
-
onChangeText,
|
|
256
|
-
onFocus,
|
|
257
|
-
onBlur,
|
|
258
|
-
onKeyDown,
|
|
259
|
-
disabled,
|
|
260
|
-
secureTextEntry,
|
|
261
|
-
style,
|
|
262
|
-
color,
|
|
263
|
-
fontSize,
|
|
264
|
-
placeholderTextColor,
|
|
265
|
-
maxLength,
|
|
266
|
-
type,
|
|
267
|
-
inputMode,
|
|
268
|
-
autoComplete,
|
|
269
|
-
id,
|
|
270
|
-
"aria-describedby": ariaDescribedBy,
|
|
271
|
-
"aria-label": ariaLabel,
|
|
272
|
-
"aria-disabled": ariaDisabled,
|
|
273
|
-
"data-testid": dataTestId
|
|
274
|
-
}, ref) => {
|
|
275
|
-
const handleChangeText = (text) => {
|
|
276
|
-
onChangeText?.(text);
|
|
277
|
-
if (onChange) {
|
|
278
|
-
const syntheticEvent = {
|
|
279
|
-
target: { value: text },
|
|
280
|
-
currentTarget: { value: text },
|
|
281
|
-
type: "change",
|
|
282
|
-
nativeEvent: { text },
|
|
283
|
-
preventDefault: () => {
|
|
284
|
-
},
|
|
285
|
-
stopPropagation: () => {
|
|
286
|
-
},
|
|
287
|
-
isTrusted: false
|
|
288
|
-
};
|
|
289
|
-
onChange(syntheticEvent);
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
const keyboardType = inputMode ? inputModeToKeyboardType[inputMode] || "default" : type ? keyboardTypeMap[type] || "default" : "default";
|
|
293
|
-
const textContentType = autoComplete ? autoCompleteToTextContentType[autoComplete] : void 0;
|
|
294
|
-
return /* @__PURE__ */ jsx6(
|
|
295
|
-
RNTextInput,
|
|
296
|
-
{
|
|
297
|
-
ref,
|
|
298
|
-
value,
|
|
299
|
-
placeholder,
|
|
300
|
-
onChangeText: handleChangeText,
|
|
301
|
-
onFocus,
|
|
302
|
-
onBlur,
|
|
303
|
-
onKeyPress: (e) => {
|
|
304
|
-
if (onKeyDown) {
|
|
305
|
-
onKeyDown({
|
|
306
|
-
key: e.nativeEvent.key,
|
|
307
|
-
preventDefault: () => {
|
|
308
|
-
}
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
editable: !disabled,
|
|
313
|
-
secureTextEntry: secureTextEntry || type === "password",
|
|
314
|
-
keyboardType,
|
|
315
|
-
textContentType,
|
|
316
|
-
style: [
|
|
317
|
-
{
|
|
318
|
-
color,
|
|
319
|
-
fontSize: typeof fontSize === "number" ? fontSize : void 0,
|
|
320
|
-
flex: 1,
|
|
321
|
-
padding: 0,
|
|
322
|
-
textAlign: style?.textAlign || "left"
|
|
323
|
-
},
|
|
324
|
-
style
|
|
325
|
-
],
|
|
326
|
-
placeholderTextColor,
|
|
327
|
-
maxLength,
|
|
328
|
-
testID: dataTestId || id,
|
|
329
|
-
accessibilityLabel: ariaLabel,
|
|
330
|
-
accessibilityHint: ariaDescribedBy,
|
|
331
|
-
accessibilityState: {
|
|
332
|
-
disabled: disabled || ariaDisabled
|
|
333
|
-
},
|
|
334
|
-
accessible: true
|
|
335
|
-
}
|
|
336
|
-
);
|
|
337
|
-
}
|
|
338
|
-
);
|
|
339
|
-
InputPrimitive.displayName = "InputPrimitive";
|
|
340
|
-
|
|
341
|
-
// ../primitives-native/src/TextArea.tsx
|
|
342
|
-
import { forwardRef as forwardRef2 } from "react";
|
|
343
|
-
import { TextInput as RNTextInput2 } from "react-native";
|
|
344
|
-
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
345
|
-
var TextAreaPrimitive = forwardRef2(
|
|
346
|
-
({
|
|
347
|
-
value,
|
|
348
|
-
placeholder,
|
|
349
|
-
onChange,
|
|
350
|
-
onChangeText,
|
|
351
|
-
onFocus,
|
|
352
|
-
onBlur,
|
|
353
|
-
onKeyDown,
|
|
354
|
-
disabled,
|
|
355
|
-
style,
|
|
356
|
-
color,
|
|
357
|
-
fontSize,
|
|
358
|
-
placeholderTextColor,
|
|
359
|
-
maxLength,
|
|
360
|
-
rows,
|
|
361
|
-
id,
|
|
362
|
-
"aria-describedby": ariaDescribedBy,
|
|
363
|
-
"aria-label": ariaLabel,
|
|
364
|
-
"aria-disabled": ariaDisabled,
|
|
365
|
-
"data-testid": dataTestId
|
|
366
|
-
}, ref) => {
|
|
367
|
-
const handleChangeText = (text) => {
|
|
368
|
-
onChangeText?.(text);
|
|
369
|
-
if (onChange) {
|
|
370
|
-
const syntheticEvent = {
|
|
371
|
-
target: { value: text },
|
|
372
|
-
currentTarget: { value: text },
|
|
373
|
-
type: "change",
|
|
374
|
-
nativeEvent: { text },
|
|
375
|
-
preventDefault: () => {
|
|
376
|
-
},
|
|
377
|
-
stopPropagation: () => {
|
|
378
|
-
},
|
|
379
|
-
isTrusted: false
|
|
380
|
-
};
|
|
381
|
-
onChange(syntheticEvent);
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
return /* @__PURE__ */ jsx7(
|
|
385
|
-
RNTextInput2,
|
|
386
|
-
{
|
|
387
|
-
ref,
|
|
388
|
-
value,
|
|
389
|
-
placeholder,
|
|
390
|
-
onChangeText: handleChangeText,
|
|
391
|
-
onFocus,
|
|
392
|
-
onBlur,
|
|
393
|
-
onKeyPress: (e) => {
|
|
394
|
-
if (onKeyDown) {
|
|
395
|
-
onKeyDown({
|
|
396
|
-
key: e.nativeEvent.key,
|
|
397
|
-
preventDefault: () => {
|
|
398
|
-
}
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
},
|
|
402
|
-
editable: !disabled,
|
|
403
|
-
multiline: true,
|
|
404
|
-
numberOfLines: rows || 4,
|
|
405
|
-
style: [
|
|
406
|
-
{
|
|
407
|
-
color,
|
|
408
|
-
fontSize: typeof fontSize === "number" ? fontSize : void 0,
|
|
409
|
-
flex: 1,
|
|
410
|
-
padding: 0,
|
|
411
|
-
textAlignVertical: "top",
|
|
412
|
-
textAlign: style?.textAlign || "left"
|
|
413
|
-
},
|
|
414
|
-
style
|
|
415
|
-
],
|
|
416
|
-
placeholderTextColor,
|
|
417
|
-
maxLength,
|
|
418
|
-
testID: dataTestId || id,
|
|
419
|
-
accessibilityLabel: ariaLabel,
|
|
420
|
-
accessibilityHint: ariaDescribedBy,
|
|
421
|
-
accessibilityState: {
|
|
422
|
-
disabled: disabled || ariaDisabled
|
|
423
|
-
},
|
|
424
|
-
accessible: true
|
|
425
|
-
}
|
|
426
|
-
);
|
|
427
|
-
}
|
|
428
|
-
);
|
|
429
|
-
TextAreaPrimitive.displayName = "TextAreaPrimitive";
|
|
430
|
-
|
|
431
174
|
// src/ProgressLine.tsx
|
|
432
175
|
import { useDesignSystem } from "@xsolla/xui-core";
|
|
433
|
-
import { jsx as
|
|
176
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
434
177
|
var getHeight = (size) => {
|
|
435
178
|
switch (size) {
|
|
436
179
|
case "sm":
|
|
@@ -453,13 +196,13 @@ var getStateColor = (state, theme) => {
|
|
|
453
196
|
return theme.colors.content.brand.primary;
|
|
454
197
|
}
|
|
455
198
|
};
|
|
456
|
-
var ProgressLine =
|
|
199
|
+
var ProgressLine = forwardRef(
|
|
457
200
|
({ size = "md", state = "default", percent = 0, ...rest }, ref) => {
|
|
458
201
|
const { theme } = useDesignSystem();
|
|
459
202
|
const validPercent = Math.min(Math.max(0, percent), 100);
|
|
460
203
|
const height = getHeight(size);
|
|
461
204
|
const innerColor = getStateColor(state, theme);
|
|
462
|
-
return /* @__PURE__ */
|
|
205
|
+
return /* @__PURE__ */ jsx2(
|
|
463
206
|
Box,
|
|
464
207
|
{
|
|
465
208
|
...rest,
|
|
@@ -470,7 +213,7 @@ var ProgressLine = forwardRef3(
|
|
|
470
213
|
borderRadius: 100,
|
|
471
214
|
overflow: "hidden",
|
|
472
215
|
"data-testid": "progress-line__outer",
|
|
473
|
-
children: /* @__PURE__ */
|
|
216
|
+
children: /* @__PURE__ */ jsx2(
|
|
474
217
|
Box,
|
|
475
218
|
{
|
|
476
219
|
height: "100%",
|
package/native/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/ProgressLine.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":["import { forwardRef } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\nimport type {\n ProgressLineProps,\n ProgressLineSize,\n ProgressLineState,\n} from \"./types\";\n\nconst getHeight = (size: ProgressLineSize) => {\n switch (size) {\n case \"sm\":\n return 4;\n case \"md\":\n return 6;\n case \"lg\":\n return 8;\n default:\n return 6;\n }\n};\n\nconst getStateColor = (state: ProgressLineState, theme: any) => {\n switch (state) {\n case \"success\":\n return theme.colors.content.success.primary;\n case \"error\":\n return theme.colors.content.alert.primary;\n default:\n return theme.colors.content.brand.primary;\n }\n};\n\nexport const ProgressLine = forwardRef<any, ProgressLineProps>(\n ({ size = \"md\", state = \"default\", percent = 0, ...rest }, ref) => {\n const { theme } = useDesignSystem();\n const validPercent = Math.min(Math.max(0, percent), 100);\n const height = getHeight(size);\n const innerColor = getStateColor(state, theme);\n\n return (\n <Box\n {...rest}\n ref={ref}\n width=\"100%\"\n height={height}\n backgroundColor={theme.colors.background.secondary} // using secondary as ghost/placeholder\n borderRadius={100}\n overflow=\"hidden\"\n data-testid=\"progress-line__outer\"\n >\n <Box\n height=\"100%\"\n width={`${validPercent}%`}\n backgroundColor={innerColor}\n borderRadius={100}\n data-testid=\"progress-line__inner\"\n />\n </Box>\n );\n }\n);\n\nProgressLine.displayName = \"ProgressLine\";\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 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 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 type,\n inputMode,\n autoComplete,\n id,\n \"aria-describedby\": ariaDescribedBy,\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-describedby\": ariaDescribedBy,\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,SAAS,cAAAA,mBAAkB;;;ACC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,CAAC,aAAkC;AAAA,IAC3D,iBACE,WAAW,YAAY,kBACnB,WAAW,kBACX;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;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E,UAAM,EAAE,MAAM,IAAI,gBAAgB;AAClC,UAAM,eAAe,KAAK,IAAI,KAAK,IAAI,GAAG,OAAO,GAAG,GAAG;AACvD,UAAM,SAAS,UAAU,IAAI;AAC7B,UAAM,aAAa,cAAc,OAAO,KAAK;AAE7C,WACE,gBAAAD;AAAA,MAAC;AAAA;AAAA,QACE,GAAG;AAAA,QACJ;AAAA,QACA,OAAM;AAAA,QACN;AAAA,QACA,iBAAiB,MAAM,OAAO,WAAW;AAAA,QACzC,cAAc;AAAA,QACd,UAAS;AAAA,QACT,eAAY;AAAA,QAEZ,0BAAAA;AAAA,UAAC;AAAA;AAAA,YACC,QAAO;AAAA,YACP,OAAO,GAAG,YAAY;AAAA,YACtB,iBAAiB;AAAA,YACjB,cAAc;AAAA,YACd,eAAY;AAAA;AAAA,QACd;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;","names":["forwardRef","jsx","View","jsx","View","jsx","View","jsx","jsx","forwardRef","RNTextInput","jsx","jsx","forwardRef"]}
|
|
1
|
+
{"version":3,"sources":["../../src/ProgressLine.tsx","../../../primitives-native/src/Box.tsx"],"sourcesContent":["import { forwardRef } from \"react\";\n// @ts-expect-error - this will be resolved at build time\nimport { Box } from \"@xsolla/xui-primitives\";\nimport { useDesignSystem } from \"@xsolla/xui-core\";\nimport type {\n ProgressLineProps,\n ProgressLineSize,\n ProgressLineState,\n} from \"./types\";\n\nconst getHeight = (size: ProgressLineSize) => {\n switch (size) {\n case \"sm\":\n return 4;\n case \"md\":\n return 6;\n case \"lg\":\n return 8;\n default:\n return 6;\n }\n};\n\nconst getStateColor = (state: ProgressLineState, theme: any) => {\n switch (state) {\n case \"success\":\n return theme.colors.content.success.primary;\n case \"error\":\n return theme.colors.content.alert.primary;\n default:\n return theme.colors.content.brand.primary;\n }\n};\n\nexport const ProgressLine = forwardRef<any, ProgressLineProps>(\n ({ size = \"md\", state = \"default\", percent = 0, ...rest }, ref) => {\n const { theme } = useDesignSystem();\n const validPercent = Math.min(Math.max(0, percent), 100);\n const height = getHeight(size);\n const innerColor = getStateColor(state, theme);\n\n return (\n <Box\n {...rest}\n ref={ref}\n width=\"100%\"\n height={height}\n backgroundColor={theme.colors.background.secondary} // using secondary as ghost/placeholder\n borderRadius={100}\n overflow=\"hidden\"\n data-testid=\"progress-line__outer\"\n >\n <Box\n height=\"100%\"\n width={`${validPercent}%`}\n backgroundColor={innerColor}\n borderRadius={100}\n data-testid=\"progress-line__inner\"\n />\n </Box>\n );\n }\n);\n\nProgressLine.displayName = \"ProgressLine\";\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"],"mappings":";AAAA,SAAS,kBAAkB;;;ACC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAKK;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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAM;AACJ,QAAM,oBAAoB,CAAC,aAAkC;AAAA,IAC3D,iBACE,WAAW,YAAY,kBACnB,WAAW,kBACX;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAA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|
-
"version": "0.
|
|
3
|
+
"version": "0.91.0",
|
|
4
4
|
"main": "./web/index.js",
|
|
5
5
|
"module": "./web/index.mjs",
|
|
6
6
|
"types": "./web/index.d.ts",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"build:native": "PLATFORM=native tsup"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xsolla/xui-core": "0.
|
|
14
|
-
"@xsolla/xui-primitives-core": "0.
|
|
13
|
+
"@xsolla/xui-core": "0.91.0",
|
|
14
|
+
"@xsolla/xui-primitives-core": "0.91.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react": ">=16.8.0",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"vitest": "^4.0.18"
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
|
+
"sideEffects": false,
|
|
26
27
|
"react-native": "./native/index.js",
|
|
27
28
|
"exports": {
|
|
28
29
|
".": {
|