@xaui/native 0.0.21 → 0.0.24
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/README.md +195 -2
- package/dist/alert/index.js +1 -2
- package/dist/app-bar/index.cjs +217 -0
- package/dist/app-bar/index.d.cts +52 -0
- package/dist/app-bar/index.d.ts +52 -0
- package/dist/app-bar/index.js +142 -0
- package/dist/autocomplete/index.js +48 -36
- package/dist/avatar/index.js +1 -2
- package/dist/badge/index.js +1 -2
- package/dist/bottom-sheet/index.js +1 -2
- package/dist/bottom-tab-bar/index.cjs +571 -0
- package/dist/bottom-tab-bar/index.d.cts +211 -0
- package/dist/bottom-tab-bar/index.d.ts +211 -0
- package/dist/bottom-tab-bar/index.js +497 -0
- package/dist/button/index.d.cts +102 -5
- package/dist/button/index.d.ts +102 -5
- package/dist/button/index.js +2 -3
- package/dist/button.type-j1ZdkkSl.d.cts +4 -0
- package/dist/button.type-j1ZdkkSl.d.ts +4 -0
- package/dist/card/index.cjs +2 -0
- package/dist/card/index.d.cts +6 -1
- package/dist/card/index.d.ts +6 -1
- package/dist/card/index.js +4 -2
- package/dist/carousel/index.js +1 -1
- package/dist/chart/index.cjs +1067 -0
- package/dist/chart/index.d.cts +218 -0
- package/dist/chart/index.d.ts +218 -0
- package/dist/chart/index.js +1026 -0
- package/dist/checkbox/index.js +1 -2
- package/dist/chip/index.js +1 -2
- package/dist/chunk-3XSXTM3G.js +661 -0
- package/dist/chunk-4KSZLONZ.js +79 -0
- package/dist/{chunk-DXXNBF5P.js → chunk-CZFDZPAS.js} +0 -5
- package/dist/{chunk-LTKYHG5V.js → chunk-GHCVNQET.js} +12 -5
- package/dist/chunk-I4V5Y5GD.js +76 -0
- package/dist/{chunk-F7WH4DMG.js → chunk-UI5L26KD.js} +1 -1
- package/dist/{chunk-LUBWRVI2.js → chunk-ULJSCNPE.js} +1 -1
- package/dist/chunk-URBEEDFX.js +79 -0
- package/dist/core/index.js +3 -5
- package/dist/datepicker/index.js +1 -2
- package/dist/divider/index.js +2 -3
- package/dist/drawer/index.cjs +310 -0
- package/dist/drawer/index.d.cts +58 -0
- package/dist/drawer/index.d.ts +58 -0
- package/dist/drawer/index.js +236 -0
- package/dist/{accordion → expansion-panel}/index.cjs +45 -45
- package/dist/{accordion → expansion-panel}/index.d.cts +30 -30
- package/dist/{accordion → expansion-panel}/index.d.ts +30 -30
- package/dist/{accordion → expansion-panel}/index.js +40 -41
- package/dist/fab/index.d.cts +3 -3
- package/dist/fab/index.d.ts +3 -3
- package/dist/fab/index.js +3 -4
- package/dist/fab-menu/index.d.cts +2 -2
- package/dist/fab-menu/index.d.ts +2 -2
- package/dist/fab-menu/index.js +3 -4
- package/dist/{fab.type-Ba0QMprb.d.ts → fab.type-CgIYqQlT.d.ts} +1 -1
- package/dist/{fab.type-U09H8B7D.d.cts → fab.type-l2vjG8-p.d.cts} +1 -1
- package/dist/feature-discovery/index.cjs +531 -0
- package/dist/feature-discovery/index.d.cts +82 -0
- package/dist/feature-discovery/index.d.ts +82 -0
- package/dist/feature-discovery/index.js +464 -0
- package/dist/indicator/index.js +2 -3
- package/dist/input/index.cjs +258 -164
- package/dist/input/index.d.cts +15 -1
- package/dist/input/index.d.ts +15 -1
- package/dist/input/index.js +219 -126
- package/dist/list/index.js +1 -2
- package/dist/menu/index.js +2 -2
- package/dist/menubox/index.cjs +369 -0
- package/dist/menubox/index.d.cts +98 -0
- package/dist/menubox/index.d.ts +98 -0
- package/dist/menubox/index.js +296 -0
- package/dist/pager/index.cjs +243 -0
- package/dist/pager/index.d.cts +93 -0
- package/dist/pager/index.d.ts +93 -0
- package/dist/pager/index.js +205 -0
- package/dist/progress/index.js +1 -2
- package/dist/radio/index.cjs +537 -0
- package/dist/radio/index.d.cts +145 -0
- package/dist/radio/index.d.ts +145 -0
- package/dist/radio/index.js +464 -0
- package/dist/segment-button/index.js +2 -2
- package/dist/select/index.js +22 -10
- package/dist/skeleton/index.js +2 -2
- package/dist/slider/index.cjs +655 -0
- package/dist/slider/index.d.cts +171 -0
- package/dist/slider/index.d.ts +171 -0
- package/dist/slider/index.js +575 -0
- package/dist/stepper/index.cjs +624 -0
- package/dist/stepper/index.d.cts +137 -0
- package/dist/stepper/index.d.ts +137 -0
- package/dist/stepper/index.js +549 -0
- package/dist/switch/index.js +1 -2
- package/dist/tabs/index.cjs +523 -0
- package/dist/tabs/index.d.cts +176 -0
- package/dist/tabs/index.d.ts +176 -0
- package/dist/tabs/index.js +438 -0
- package/dist/timepicker/index.cjs +1280 -0
- package/dist/timepicker/index.d.cts +215 -0
- package/dist/timepicker/index.d.ts +215 -0
- package/dist/timepicker/index.js +1181 -0
- package/dist/toolbar/index.cjs +395 -0
- package/dist/toolbar/index.d.cts +100 -0
- package/dist/toolbar/index.d.ts +100 -0
- package/dist/toolbar/index.js +325 -0
- package/dist/typography/index.js +1 -2
- package/dist/view/index.cjs +16 -2
- package/dist/view/index.js +16 -2
- package/package.json +73 -8
- package/dist/button.type-D8tzEBo7.d.ts +0 -104
- package/dist/button.type-ikaWzhIg.d.cts +0 -104
- package/dist/chunk-GBHQCAKW.js +0 -19
- package/dist/chunk-JEGEPGVU.js +0 -287
package/dist/input/index.d.cts
CHANGED
|
@@ -131,6 +131,20 @@ declare const TextInput: React.ForwardRefExoticComponent<Omit<react_native.TextI
|
|
|
131
131
|
customAppearance?: TextInputCustomAppearance;
|
|
132
132
|
} & React.RefAttributes<TextInput$1>>;
|
|
133
133
|
|
|
134
|
+
type TextAreaProps = Omit<TextInputProps, 'multiline'> & {
|
|
135
|
+
/**
|
|
136
|
+
* Minimum number of rows.
|
|
137
|
+
* @default 3
|
|
138
|
+
*/
|
|
139
|
+
minRows?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Optional maximum number of rows before scrolling.
|
|
142
|
+
*/
|
|
143
|
+
maxRows?: number;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
declare const TextArea: React.FC<TextAreaProps>;
|
|
147
|
+
|
|
134
148
|
type DateSeparator = '-' | '/' | '.';
|
|
135
149
|
type DateOrder = 'YMD' | 'DMY' | 'MDY';
|
|
136
150
|
type TimeInputGranularity = 'minute' | 'second';
|
|
@@ -489,4 +503,4 @@ declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & Re
|
|
|
489
503
|
|
|
490
504
|
declare const getDateOrder: (locale: string) => DateOrder;
|
|
491
505
|
|
|
492
|
-
export { DateInput, type DateInputProps, type DateOrder, type DateSeparator, DateTimeInput, type DateTimeInputProps, NumberInput, type NumberInputCustomAppearance, type NumberInputProps, OTPInput, type OTPInputCustomAppearance, type OTPInputProps, TextInput, type TextInputCustomAppearance, type TextInputLabelPlacement, type TextInputProps, type TextInputSize, type TextInputVariant, TimeInput, type TimeInputGranularity, type TimeInputProps, getDateOrder };
|
|
506
|
+
export { DateInput, type DateInputProps, type DateOrder, type DateSeparator, DateTimeInput, type DateTimeInputProps, NumberInput, type NumberInputCustomAppearance, type NumberInputProps, OTPInput, type OTPInputCustomAppearance, type OTPInputProps, TextArea, type TextAreaProps, TextInput, type TextInputCustomAppearance, type TextInputLabelPlacement, type TextInputProps, type TextInputSize, type TextInputVariant, TimeInput, type TimeInputGranularity, type TimeInputProps, getDateOrder };
|
package/dist/input/index.d.ts
CHANGED
|
@@ -131,6 +131,20 @@ declare const TextInput: React.ForwardRefExoticComponent<Omit<react_native.TextI
|
|
|
131
131
|
customAppearance?: TextInputCustomAppearance;
|
|
132
132
|
} & React.RefAttributes<TextInput$1>>;
|
|
133
133
|
|
|
134
|
+
type TextAreaProps = Omit<TextInputProps, 'multiline'> & {
|
|
135
|
+
/**
|
|
136
|
+
* Minimum number of rows.
|
|
137
|
+
* @default 3
|
|
138
|
+
*/
|
|
139
|
+
minRows?: number;
|
|
140
|
+
/**
|
|
141
|
+
* Optional maximum number of rows before scrolling.
|
|
142
|
+
*/
|
|
143
|
+
maxRows?: number;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
declare const TextArea: React.FC<TextAreaProps>;
|
|
147
|
+
|
|
134
148
|
type DateSeparator = '-' | '/' | '.';
|
|
135
149
|
type DateOrder = 'YMD' | 'DMY' | 'MDY';
|
|
136
150
|
type TimeInputGranularity = 'minute' | 'second';
|
|
@@ -489,4 +503,4 @@ declare const NumberInput: React.ForwardRefExoticComponent<NumberInputProps & Re
|
|
|
489
503
|
|
|
490
504
|
declare const getDateOrder: (locale: string) => DateOrder;
|
|
491
505
|
|
|
492
|
-
export { DateInput, type DateInputProps, type DateOrder, type DateSeparator, DateTimeInput, type DateTimeInputProps, NumberInput, type NumberInputCustomAppearance, type NumberInputProps, OTPInput, type OTPInputCustomAppearance, type OTPInputProps, TextInput, type TextInputCustomAppearance, type TextInputLabelPlacement, type TextInputProps, type TextInputSize, type TextInputVariant, TimeInput, type TimeInputGranularity, type TimeInputProps, getDateOrder };
|
|
506
|
+
export { DateInput, type DateInputProps, type DateOrder, type DateSeparator, DateTimeInput, type DateTimeInputProps, NumberInput, type NumberInputCustomAppearance, type NumberInputProps, OTPInput, type OTPInputCustomAppearance, type OTPInputProps, TextArea, type TextAreaProps, TextInput, type TextInputCustomAppearance, type TextInputLabelPlacement, type TextInputProps, type TextInputSize, type TextInputVariant, TimeInput, type TimeInputGranularity, type TimeInputProps, getDateOrder };
|
package/dist/input/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-CZFDZPAS.js";
|
|
2
2
|
import {
|
|
3
3
|
useXUITheme
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-I4V5Y5GD.js";
|
|
5
5
|
|
|
6
6
|
// src/components/input/input.tsx
|
|
7
7
|
import React, { forwardRef, useMemo as useMemo2, useState, useRef, useEffect } from "react";
|
|
@@ -288,98 +288,115 @@ var TextInput = forwardRef(
|
|
|
288
288
|
]
|
|
289
289
|
},
|
|
290
290
|
label
|
|
291
|
-
), /* @__PURE__ */ React.createElement(
|
|
292
|
-
|
|
291
|
+
), /* @__PURE__ */ React.createElement(
|
|
292
|
+
Pressable,
|
|
293
293
|
{
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
{
|
|
297
|
-
minHeight: sizeStyles.minHeight,
|
|
298
|
-
paddingVertical: sizeStyles.paddingVertical,
|
|
299
|
-
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
300
|
-
gap: sizeStyles.slotGap,
|
|
301
|
-
backgroundColor: variantStyles.container.backgroundColor,
|
|
302
|
-
borderWidth: variant === "underlined" ? 0 : variantStyles.container.borderWidth,
|
|
303
|
-
...variant === "underlined" && {
|
|
304
|
-
borderBottomWidth: variantStyles.container.borderBottomWidth
|
|
305
|
-
},
|
|
306
|
-
borderRadius: variant === "underlined" ? 0 : radiusStyles.borderRadius,
|
|
307
|
-
...variant === "underlined" ? {
|
|
308
|
-
borderBottomColor: borderAnimation.interpolate({
|
|
309
|
-
inputRange: [0, 1],
|
|
310
|
-
outputRange: [
|
|
311
|
-
variantStyles.unfocusedBorderColor,
|
|
312
|
-
variantStyles.focusedBorderColor
|
|
313
|
-
]
|
|
314
|
-
})
|
|
315
|
-
} : {
|
|
316
|
-
borderColor: borderAnimation.interpolate({
|
|
317
|
-
inputRange: [0, 1],
|
|
318
|
-
outputRange: [
|
|
319
|
-
variantStyles.unfocusedBorderColor,
|
|
320
|
-
variantStyles.focusedBorderColor
|
|
321
|
-
]
|
|
322
|
-
})
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
variant === "underlined" && styles.underlinedWrapper,
|
|
326
|
-
customAppearance?.inputWrapper
|
|
327
|
-
]
|
|
294
|
+
onPress: handleWrapperPress,
|
|
295
|
+
disabled: isDisabled || isReadOnly
|
|
328
296
|
},
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
Text,
|
|
297
|
+
/* @__PURE__ */ React.createElement(
|
|
298
|
+
Animated.View,
|
|
332
299
|
{
|
|
333
300
|
style: [
|
|
334
|
-
styles.
|
|
301
|
+
styles.inputWrapper,
|
|
335
302
|
{
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
303
|
+
minHeight: sizeStyles.minHeight,
|
|
304
|
+
paddingVertical: sizeStyles.paddingVertical,
|
|
305
|
+
paddingHorizontal: sizeStyles.paddingHorizontal,
|
|
306
|
+
gap: sizeStyles.slotGap,
|
|
307
|
+
backgroundColor: variantStyles.container.backgroundColor,
|
|
308
|
+
borderWidth: variant === "underlined" ? 0 : variantStyles.container.borderWidth,
|
|
309
|
+
...variant === "underlined" && {
|
|
310
|
+
borderBottomWidth: variantStyles.container.borderBottomWidth
|
|
311
|
+
},
|
|
312
|
+
borderRadius: variant === "underlined" ? 0 : radiusStyles.borderRadius,
|
|
313
|
+
...variant === "underlined" ? {
|
|
314
|
+
borderBottomColor: borderAnimation.interpolate({
|
|
315
|
+
inputRange: [0, 1],
|
|
316
|
+
outputRange: [
|
|
317
|
+
variantStyles.unfocusedBorderColor,
|
|
318
|
+
variantStyles.focusedBorderColor
|
|
319
|
+
]
|
|
320
|
+
})
|
|
321
|
+
} : {
|
|
322
|
+
borderColor: borderAnimation.interpolate({
|
|
323
|
+
inputRange: [0, 1],
|
|
324
|
+
outputRange: [
|
|
325
|
+
variantStyles.unfocusedBorderColor,
|
|
326
|
+
variantStyles.focusedBorderColor
|
|
327
|
+
]
|
|
328
|
+
})
|
|
329
|
+
}
|
|
339
330
|
},
|
|
340
|
-
|
|
331
|
+
variant === "underlined" && styles.underlinedWrapper,
|
|
332
|
+
customAppearance?.inputWrapper
|
|
341
333
|
]
|
|
342
334
|
},
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
setIsFocused(true);
|
|
352
|
-
onFocus?.(event);
|
|
353
|
-
},
|
|
354
|
-
onBlur: (event) => {
|
|
355
|
-
setIsFocused(false);
|
|
356
|
-
onBlur?.(event);
|
|
335
|
+
startContent && /* @__PURE__ */ React.createElement(View, { style: styles.slot }, startContent),
|
|
336
|
+
/* @__PURE__ */ React.createElement(
|
|
337
|
+
View,
|
|
338
|
+
{
|
|
339
|
+
style: {
|
|
340
|
+
flex: 1,
|
|
341
|
+
gap: labelPlacement === "inside" && label ? 2 : 0
|
|
342
|
+
}
|
|
357
343
|
},
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
placeholderTextColor: variantStyles.placeholderColor,
|
|
361
|
-
style: [
|
|
362
|
-
styles.input,
|
|
344
|
+
label && labelPlacement === "inside" && /* @__PURE__ */ React.createElement(
|
|
345
|
+
Text,
|
|
363
346
|
{
|
|
364
|
-
|
|
365
|
-
|
|
347
|
+
style: [
|
|
348
|
+
styles.label,
|
|
349
|
+
{
|
|
350
|
+
color: variantStyles.labelColor,
|
|
351
|
+
fontSize: sizeStyles.helperSize,
|
|
352
|
+
paddingBottom: 2
|
|
353
|
+
},
|
|
354
|
+
customAppearance?.label
|
|
355
|
+
]
|
|
366
356
|
},
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
357
|
+
label
|
|
358
|
+
),
|
|
359
|
+
/* @__PURE__ */ React.createElement(
|
|
360
|
+
RNTextInput,
|
|
361
|
+
{
|
|
362
|
+
ref: typeof forwardedRef === "function" ? internalRef : forwardedRef || internalRef,
|
|
363
|
+
value: inputValue,
|
|
364
|
+
onChangeText: handleChangeText,
|
|
365
|
+
onFocus: (event) => {
|
|
366
|
+
setIsFocused(true);
|
|
367
|
+
onFocus?.(event);
|
|
368
|
+
},
|
|
369
|
+
onBlur: (event) => {
|
|
370
|
+
setIsFocused(false);
|
|
371
|
+
onBlur?.(event);
|
|
372
|
+
},
|
|
373
|
+
editable,
|
|
374
|
+
secureTextEntry,
|
|
375
|
+
placeholderTextColor: variantStyles.placeholderColor,
|
|
376
|
+
style: [
|
|
377
|
+
styles.input,
|
|
378
|
+
{
|
|
379
|
+
color: variantStyles.textColor,
|
|
380
|
+
fontSize: sizeStyles.fontSize
|
|
381
|
+
},
|
|
382
|
+
customAppearance?.input
|
|
383
|
+
],
|
|
384
|
+
...nativeProps
|
|
385
|
+
}
|
|
386
|
+
)
|
|
387
|
+
),
|
|
388
|
+
showClearButton ? /* @__PURE__ */ React.createElement(
|
|
389
|
+
Pressable,
|
|
390
|
+
{
|
|
391
|
+
onPress: handleClear,
|
|
392
|
+
accessibilityLabel: "Clear input",
|
|
393
|
+
accessibilityRole: "button",
|
|
394
|
+
style: styles.clearButton
|
|
395
|
+
},
|
|
396
|
+
/* @__PURE__ */ React.createElement(CloseIcon, { size: 16, color: variantStyles.placeholderColor })
|
|
397
|
+
) : endContent && /* @__PURE__ */ React.createElement(View, { style: styles.slot }, endContent)
|
|
398
|
+
)
|
|
399
|
+
)),
|
|
383
400
|
helperText && /* @__PURE__ */ React.createElement(
|
|
384
401
|
Text,
|
|
385
402
|
{
|
|
@@ -399,8 +416,70 @@ var TextInput = forwardRef(
|
|
|
399
416
|
);
|
|
400
417
|
TextInput.displayName = "TextInput";
|
|
401
418
|
|
|
419
|
+
// src/components/input/textarea.tsx
|
|
420
|
+
import React2 from "react";
|
|
421
|
+
|
|
422
|
+
// src/components/input/textarea.style.ts
|
|
423
|
+
import { StyleSheet as StyleSheet2 } from "react-native";
|
|
424
|
+
var textAreaStyles = StyleSheet2.create({
|
|
425
|
+
inputWrapper: {
|
|
426
|
+
alignItems: "flex-start"
|
|
427
|
+
},
|
|
428
|
+
input: {
|
|
429
|
+
textAlignVertical: "top"
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
|
|
433
|
+
// src/components/input/textarea.tsx
|
|
434
|
+
var TextArea = ({
|
|
435
|
+
minRows = 3,
|
|
436
|
+
maxRows,
|
|
437
|
+
size = "md",
|
|
438
|
+
customAppearance,
|
|
439
|
+
numberOfLines,
|
|
440
|
+
textAlignVertical,
|
|
441
|
+
scrollEnabled,
|
|
442
|
+
...props
|
|
443
|
+
}) => {
|
|
444
|
+
const sizeStyles = useTextInputSizeStyles(size);
|
|
445
|
+
const lineHeight = Math.round(sizeStyles.fontSize * 1.35);
|
|
446
|
+
const verticalPadding = sizeStyles.paddingVertical * 2;
|
|
447
|
+
const normalizedMaxRows = typeof maxRows === "number" ? Math.max(maxRows, minRows) : void 0;
|
|
448
|
+
const minHeight = minRows * lineHeight + verticalPadding;
|
|
449
|
+
const maxHeight = typeof normalizedMaxRows === "number" ? normalizedMaxRows * lineHeight + verticalPadding : void 0;
|
|
450
|
+
return /* @__PURE__ */ React2.createElement(
|
|
451
|
+
TextInput,
|
|
452
|
+
{
|
|
453
|
+
...props,
|
|
454
|
+
size,
|
|
455
|
+
multiline: true,
|
|
456
|
+
numberOfLines: numberOfLines ?? minRows,
|
|
457
|
+
textAlignVertical: textAlignVertical ?? "top",
|
|
458
|
+
scrollEnabled: scrollEnabled ?? !!maxHeight,
|
|
459
|
+
customAppearance: {
|
|
460
|
+
...customAppearance,
|
|
461
|
+
inputWrapper: [
|
|
462
|
+
textAreaStyles.inputWrapper,
|
|
463
|
+
{
|
|
464
|
+
minHeight,
|
|
465
|
+
...maxHeight ? { maxHeight } : {}
|
|
466
|
+
},
|
|
467
|
+
customAppearance?.inputWrapper
|
|
468
|
+
],
|
|
469
|
+
input: [
|
|
470
|
+
textAreaStyles.input,
|
|
471
|
+
{
|
|
472
|
+
lineHeight
|
|
473
|
+
},
|
|
474
|
+
customAppearance?.input
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
);
|
|
479
|
+
};
|
|
480
|
+
|
|
402
481
|
// src/components/input/date-time-input.tsx
|
|
403
|
-
import
|
|
482
|
+
import React3, { forwardRef as forwardRef2, useCallback, useMemo as useMemo3 } from "react";
|
|
404
483
|
|
|
405
484
|
// src/components/input/date-time-input.hook.ts
|
|
406
485
|
var YMD_LOCALES = ["ja", "zh", "ko", "hu", "lt", "mn"];
|
|
@@ -532,7 +611,7 @@ var DateInput = forwardRef2(
|
|
|
532
611
|
},
|
|
533
612
|
[resolvedOrder, separator, onChangeText, onValueChange]
|
|
534
613
|
);
|
|
535
|
-
return /* @__PURE__ */
|
|
614
|
+
return /* @__PURE__ */ React3.createElement(
|
|
536
615
|
TextInput,
|
|
537
616
|
{
|
|
538
617
|
ref,
|
|
@@ -565,7 +644,7 @@ var TimeInput = forwardRef2(
|
|
|
565
644
|
},
|
|
566
645
|
[granularity, hourCycle, onChangeText, onValueChange]
|
|
567
646
|
);
|
|
568
|
-
return /* @__PURE__ */
|
|
647
|
+
return /* @__PURE__ */ React3.createElement(
|
|
569
648
|
TextInput,
|
|
570
649
|
{
|
|
571
650
|
ref,
|
|
@@ -611,7 +690,7 @@ var DateTimeInput = forwardRef2(
|
|
|
611
690
|
},
|
|
612
691
|
[resolvedOrder, separator, granularity, hourCycle, onChangeText, onValueChange]
|
|
613
692
|
);
|
|
614
|
-
return /* @__PURE__ */
|
|
693
|
+
return /* @__PURE__ */ React3.createElement(
|
|
615
694
|
TextInput,
|
|
616
695
|
{
|
|
617
696
|
ref,
|
|
@@ -631,7 +710,7 @@ TimeInput.displayName = "TimeInput";
|
|
|
631
710
|
DateTimeInput.displayName = "DateTimeInput";
|
|
632
711
|
|
|
633
712
|
// src/components/input/otp-input.tsx
|
|
634
|
-
import
|
|
713
|
+
import React4, { useCallback as useCallback3, useEffect as useEffect2, useRef as useRef3 } from "react";
|
|
635
714
|
import {
|
|
636
715
|
Animated as Animated2,
|
|
637
716
|
Pressable as Pressable2,
|
|
@@ -659,9 +738,7 @@ var useOTPInputState = ({
|
|
|
659
738
|
allowedKeys
|
|
660
739
|
}) => {
|
|
661
740
|
const isControlled = typeof value === "string";
|
|
662
|
-
const [internalValue, setInternalValue] = useState2(
|
|
663
|
-
defaultValue ?? ""
|
|
664
|
-
);
|
|
741
|
+
const [internalValue, setInternalValue] = useState2(defaultValue ?? "");
|
|
665
742
|
const [activeIndex, setActiveIndex] = useState2(-1);
|
|
666
743
|
const refs = useRef2([]);
|
|
667
744
|
const currentValue = isControlled ? value : internalValue;
|
|
@@ -733,8 +810,8 @@ var useOTPInputState = ({
|
|
|
733
810
|
};
|
|
734
811
|
|
|
735
812
|
// src/components/input/otp-input.style.ts
|
|
736
|
-
import { StyleSheet as
|
|
737
|
-
var otpStyles =
|
|
813
|
+
import { StyleSheet as StyleSheet3 } from "react-native";
|
|
814
|
+
var otpStyles = StyleSheet3.create({
|
|
738
815
|
container: {
|
|
739
816
|
gap: 6
|
|
740
817
|
},
|
|
@@ -791,7 +868,8 @@ var OTPSegment = ({
|
|
|
791
868
|
onChangeText,
|
|
792
869
|
onKeyPress,
|
|
793
870
|
onFocus,
|
|
794
|
-
onBlur
|
|
871
|
+
onBlur,
|
|
872
|
+
onPress
|
|
795
873
|
}) => {
|
|
796
874
|
const borderAnimation = useRef3(new Animated2.Value(0)).current;
|
|
797
875
|
useEffect2(() => {
|
|
@@ -801,18 +879,17 @@ var OTPSegment = ({
|
|
|
801
879
|
useNativeDriver: false
|
|
802
880
|
}).start();
|
|
803
881
|
}, [borderAnimation, isActive]);
|
|
804
|
-
return /* @__PURE__ */
|
|
882
|
+
return /* @__PURE__ */ React4.createElement(
|
|
805
883
|
Pressable2,
|
|
806
884
|
{
|
|
807
885
|
onPress: () => {
|
|
808
886
|
if (!isDisabled) {
|
|
809
|
-
|
|
810
|
-
if (typeof inputEl !== "function") return;
|
|
887
|
+
onPress();
|
|
811
888
|
}
|
|
812
889
|
},
|
|
813
890
|
disabled: isDisabled
|
|
814
891
|
},
|
|
815
|
-
/* @__PURE__ */
|
|
892
|
+
/* @__PURE__ */ React4.createElement(
|
|
816
893
|
Animated2.View,
|
|
817
894
|
{
|
|
818
895
|
style: [
|
|
@@ -834,7 +911,7 @@ var OTPSegment = ({
|
|
|
834
911
|
customSegment?.segment
|
|
835
912
|
]
|
|
836
913
|
},
|
|
837
|
-
char && isSecured ? /* @__PURE__ */
|
|
914
|
+
char && isSecured ? /* @__PURE__ */ React4.createElement(
|
|
838
915
|
View2,
|
|
839
916
|
{
|
|
840
917
|
style: [
|
|
@@ -842,7 +919,7 @@ var OTPSegment = ({
|
|
|
842
919
|
{ backgroundColor: variantStyles.textColor }
|
|
843
920
|
]
|
|
844
921
|
}
|
|
845
|
-
) : /* @__PURE__ */
|
|
922
|
+
) : /* @__PURE__ */ React4.createElement(
|
|
846
923
|
Text2,
|
|
847
924
|
{
|
|
848
925
|
style: [
|
|
@@ -856,7 +933,7 @@ var OTPSegment = ({
|
|
|
856
933
|
},
|
|
857
934
|
char
|
|
858
935
|
),
|
|
859
|
-
/* @__PURE__ */
|
|
936
|
+
/* @__PURE__ */ React4.createElement(
|
|
860
937
|
RNTextInput2,
|
|
861
938
|
{
|
|
862
939
|
ref: inputRef,
|
|
@@ -929,7 +1006,19 @@ var OTPInput = ({
|
|
|
929
1006
|
isInvalid,
|
|
930
1007
|
isDisabled
|
|
931
1008
|
});
|
|
932
|
-
|
|
1009
|
+
const focusSegment = useCallback3(
|
|
1010
|
+
(index) => {
|
|
1011
|
+
if (isDisabled) return;
|
|
1012
|
+
refs.current[index]?.focus();
|
|
1013
|
+
},
|
|
1014
|
+
[isDisabled, refs]
|
|
1015
|
+
);
|
|
1016
|
+
const handleContainerPress = useCallback3(() => {
|
|
1017
|
+
const firstEmptyIndex = segments.findIndex((segment) => !segment);
|
|
1018
|
+
const targetIndex = firstEmptyIndex === -1 ? length - 1 : firstEmptyIndex;
|
|
1019
|
+
focusSegment(targetIndex);
|
|
1020
|
+
}, [focusSegment, length, segments]);
|
|
1021
|
+
return /* @__PURE__ */ React4.createElement(
|
|
933
1022
|
View2,
|
|
934
1023
|
{
|
|
935
1024
|
style: [
|
|
@@ -939,7 +1028,7 @@ var OTPInput = ({
|
|
|
939
1028
|
customAppearance?.container
|
|
940
1029
|
]
|
|
941
1030
|
},
|
|
942
|
-
label && /* @__PURE__ */
|
|
1031
|
+
label && /* @__PURE__ */ React4.createElement(
|
|
943
1032
|
Text2,
|
|
944
1033
|
{
|
|
945
1034
|
style: [
|
|
@@ -953,12 +1042,14 @@ var OTPInput = ({
|
|
|
953
1042
|
},
|
|
954
1043
|
label
|
|
955
1044
|
),
|
|
956
|
-
/* @__PURE__ */
|
|
957
|
-
|
|
1045
|
+
/* @__PURE__ */ React4.createElement(
|
|
1046
|
+
Pressable2,
|
|
958
1047
|
{
|
|
1048
|
+
onPress: handleContainerPress,
|
|
1049
|
+
disabled: isDisabled,
|
|
959
1050
|
style: [otpStyles.segmentContainer, customAppearance?.segmentContainer]
|
|
960
1051
|
},
|
|
961
|
-
segments.map((char, index) => /* @__PURE__ */
|
|
1052
|
+
segments.map((char, index) => /* @__PURE__ */ React4.createElement(
|
|
962
1053
|
OTPSegment,
|
|
963
1054
|
{
|
|
964
1055
|
key: index,
|
|
@@ -977,11 +1068,12 @@ var OTPInput = ({
|
|
|
977
1068
|
onChangeText: (text) => handleSegmentChange(index, text),
|
|
978
1069
|
onKeyPress: (key) => handleSegmentKeyPress(index, key),
|
|
979
1070
|
onFocus: () => handleSegmentFocus(index),
|
|
980
|
-
onBlur: handleSegmentBlur
|
|
1071
|
+
onBlur: handleSegmentBlur,
|
|
1072
|
+
onPress: () => focusSegment(index)
|
|
981
1073
|
}
|
|
982
1074
|
))
|
|
983
1075
|
),
|
|
984
|
-
helperText && /* @__PURE__ */
|
|
1076
|
+
helperText && /* @__PURE__ */ React4.createElement(
|
|
985
1077
|
Text2,
|
|
986
1078
|
{
|
|
987
1079
|
style: [
|
|
@@ -997,13 +1089,13 @@ var OTPInput = ({
|
|
|
997
1089
|
OTPInput.displayName = "OTPInput";
|
|
998
1090
|
|
|
999
1091
|
// src/components/input/number-input.tsx
|
|
1000
|
-
import
|
|
1092
|
+
import React5, { forwardRef as forwardRef3 } from "react";
|
|
1001
1093
|
import { Pressable as Pressable3, View as View3 } from "react-native";
|
|
1002
1094
|
import { AddIcon, RemoveIcon } from "@xaui/icons";
|
|
1003
1095
|
import { withOpacity as withOpacity2 } from "@xaui/core";
|
|
1004
1096
|
|
|
1005
1097
|
// src/components/input/number-input.hook.ts
|
|
1006
|
-
import { useCallback as
|
|
1098
|
+
import { useCallback as useCallback4, useMemo as useMemo5, useState as useState3 } from "react";
|
|
1007
1099
|
var useNumberInputState = ({
|
|
1008
1100
|
value,
|
|
1009
1101
|
defaultValue,
|
|
@@ -1031,7 +1123,7 @@ var useNumberInputState = ({
|
|
|
1031
1123
|
if (formatter) return formatter.format(currentValue);
|
|
1032
1124
|
return String(currentValue);
|
|
1033
1125
|
}, [currentValue, formatter, isEditing, rawText]);
|
|
1034
|
-
const updateValue =
|
|
1126
|
+
const updateValue = useCallback4(
|
|
1035
1127
|
(newValue) => {
|
|
1036
1128
|
if (!isControlled) {
|
|
1037
1129
|
setInternalValue(newValue);
|
|
@@ -1040,7 +1132,7 @@ var useNumberInputState = ({
|
|
|
1040
1132
|
},
|
|
1041
1133
|
[isControlled, onValueChange]
|
|
1042
1134
|
);
|
|
1043
|
-
const clamp =
|
|
1135
|
+
const clamp = useCallback4(
|
|
1044
1136
|
(num) => {
|
|
1045
1137
|
let clamped = num;
|
|
1046
1138
|
if (minValue !== void 0 && clamped < minValue) clamped = minValue;
|
|
@@ -1049,7 +1141,7 @@ var useNumberInputState = ({
|
|
|
1049
1141
|
},
|
|
1050
1142
|
[minValue, maxValue]
|
|
1051
1143
|
);
|
|
1052
|
-
const handleTextChange =
|
|
1144
|
+
const handleTextChange = useCallback4(
|
|
1053
1145
|
(text) => {
|
|
1054
1146
|
setRawText(text);
|
|
1055
1147
|
if (text === "" || text === "-") return;
|
|
@@ -1059,11 +1151,11 @@ var useNumberInputState = ({
|
|
|
1059
1151
|
},
|
|
1060
1152
|
[updateValue]
|
|
1061
1153
|
);
|
|
1062
|
-
const handleFocus =
|
|
1154
|
+
const handleFocus = useCallback4(() => {
|
|
1063
1155
|
setIsEditing(true);
|
|
1064
1156
|
setRawText(currentValue !== void 0 ? String(currentValue) : "");
|
|
1065
1157
|
}, [currentValue]);
|
|
1066
|
-
const handleBlur =
|
|
1158
|
+
const handleBlur = useCallback4(() => {
|
|
1067
1159
|
setIsEditing(false);
|
|
1068
1160
|
if (rawText === "" || rawText === "-") {
|
|
1069
1161
|
updateValue(void 0);
|
|
@@ -1076,18 +1168,18 @@ var useNumberInputState = ({
|
|
|
1076
1168
|
}
|
|
1077
1169
|
updateValue(clamp(parsed));
|
|
1078
1170
|
}, [rawText, clamp, updateValue]);
|
|
1079
|
-
const handleClear =
|
|
1171
|
+
const handleClear = useCallback4(() => {
|
|
1080
1172
|
setRawText("");
|
|
1081
1173
|
updateValue(void 0);
|
|
1082
1174
|
}, [updateValue]);
|
|
1083
1175
|
const canIncrement = maxValue === void 0 || (currentValue ?? 0) + step <= maxValue;
|
|
1084
1176
|
const canDecrement = minValue === void 0 || (currentValue ?? 0) - step >= minValue;
|
|
1085
|
-
const handleIncrement =
|
|
1177
|
+
const handleIncrement = useCallback4(() => {
|
|
1086
1178
|
const base = currentValue ?? 0;
|
|
1087
1179
|
const newValue = clamp(base + step);
|
|
1088
1180
|
updateValue(newValue);
|
|
1089
1181
|
}, [currentValue, step, clamp, updateValue]);
|
|
1090
|
-
const handleDecrement =
|
|
1182
|
+
const handleDecrement = useCallback4(() => {
|
|
1091
1183
|
const base = currentValue ?? 0;
|
|
1092
1184
|
const newValue = clamp(base - step);
|
|
1093
1185
|
updateValue(newValue);
|
|
@@ -1106,8 +1198,8 @@ var useNumberInputState = ({
|
|
|
1106
1198
|
};
|
|
1107
1199
|
|
|
1108
1200
|
// src/components/input/number-input.style.ts
|
|
1109
|
-
import { StyleSheet as
|
|
1110
|
-
var numberInputStyles =
|
|
1201
|
+
import { StyleSheet as StyleSheet4 } from "react-native";
|
|
1202
|
+
var numberInputStyles = StyleSheet4.create({
|
|
1111
1203
|
stepperContainer: {
|
|
1112
1204
|
flexDirection: "row",
|
|
1113
1205
|
alignItems: "center",
|
|
@@ -1174,7 +1266,7 @@ var NumberInput = forwardRef3(
|
|
|
1174
1266
|
locale
|
|
1175
1267
|
});
|
|
1176
1268
|
const iconColor = withOpacity2(theme.colors.foreground, 0.7);
|
|
1177
|
-
const stepperContent = hideStepper || isReadOnly ? void 0 : /* @__PURE__ */
|
|
1269
|
+
const stepperContent = hideStepper || isReadOnly ? void 0 : /* @__PURE__ */ React5.createElement(
|
|
1178
1270
|
View3,
|
|
1179
1271
|
{
|
|
1180
1272
|
style: [
|
|
@@ -1182,7 +1274,7 @@ var NumberInput = forwardRef3(
|
|
|
1182
1274
|
customAppearance?.stepperContainer
|
|
1183
1275
|
]
|
|
1184
1276
|
},
|
|
1185
|
-
/* @__PURE__ */
|
|
1277
|
+
/* @__PURE__ */ React5.createElement(
|
|
1186
1278
|
Pressable3,
|
|
1187
1279
|
{
|
|
1188
1280
|
onPress: handleDecrement,
|
|
@@ -1195,9 +1287,9 @@ var NumberInput = forwardRef3(
|
|
|
1195
1287
|
customAppearance?.stepperButton
|
|
1196
1288
|
]
|
|
1197
1289
|
},
|
|
1198
|
-
/* @__PURE__ */
|
|
1290
|
+
/* @__PURE__ */ React5.createElement(RemoveIcon, { size: 16, color: iconColor })
|
|
1199
1291
|
),
|
|
1200
|
-
/* @__PURE__ */
|
|
1292
|
+
/* @__PURE__ */ React5.createElement(
|
|
1201
1293
|
Pressable3,
|
|
1202
1294
|
{
|
|
1203
1295
|
onPress: handleIncrement,
|
|
@@ -1210,10 +1302,10 @@ var NumberInput = forwardRef3(
|
|
|
1210
1302
|
customAppearance?.stepperButton
|
|
1211
1303
|
]
|
|
1212
1304
|
},
|
|
1213
|
-
/* @__PURE__ */
|
|
1305
|
+
/* @__PURE__ */ React5.createElement(AddIcon, { size: 16, color: iconColor })
|
|
1214
1306
|
)
|
|
1215
1307
|
);
|
|
1216
|
-
return /* @__PURE__ */
|
|
1308
|
+
return /* @__PURE__ */ React5.createElement(
|
|
1217
1309
|
TextInput,
|
|
1218
1310
|
{
|
|
1219
1311
|
ref,
|
|
@@ -1248,6 +1340,7 @@ export {
|
|
|
1248
1340
|
DateTimeInput,
|
|
1249
1341
|
NumberInput,
|
|
1250
1342
|
OTPInput,
|
|
1343
|
+
TextArea,
|
|
1251
1344
|
TextInput,
|
|
1252
1345
|
TimeInput,
|
|
1253
1346
|
getDateOrder
|
package/dist/list/index.js
CHANGED