@particle-network/ui-native 0.1.3 → 0.1.4-beta.1
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/dist/components/UXButton/button.types.d.ts +2 -2
- package/dist/components/UXCheckbox/checkbox.js +5 -4
- package/dist/components/UXChip/styles.js +13 -7
- package/dist/components/UXChip/types.d.ts +1 -1
- package/dist/components/UXHint/index.js +3 -2
- package/dist/components/UXListBox/UXListBoxItem.js +3 -2
- package/dist/components/UXRadio/radio.js +5 -4
- package/dist/components/UXTabs/tab.js +3 -2
- package/dist/components/UXTabs/types.d.ts +1 -1
- package/dist/components/UXToast/ToastView.js +3 -2
- package/dist/components/date-picker/date-button.d.ts +8 -0
- package/dist/components/date-picker/date-button.js +21 -0
- package/dist/components/date-picker/date-picker.d.ts +3 -0
- package/dist/components/date-picker/date-picker.js +117 -0
- package/dist/components/date-picker/date-range-picker.d.ts +3 -0
- package/dist/components/date-picker/date-range-picker.js +195 -0
- package/dist/components/date-picker/date-wheel-picker.d.ts +3 -0
- package/dist/components/date-picker/date-wheel-picker.js +121 -0
- package/dist/components/date-picker/index.d.ts +3 -0
- package/dist/components/date-picker/index.js +2 -0
- package/dist/components/date-picker/time-wheel-picker.d.ts +7 -0
- package/dist/components/date-picker/time-wheel-picker.js +64 -0
- package/dist/components/date-picker/types.d.ts +93 -0
- package/dist/components/date-picker/types.js +0 -0
- package/dist/components/date-picker/utils.d.ts +6 -0
- package/dist/components/date-picker/utils.js +2 -0
- package/dist/components/date-picker/wheel-column.d.ts +12 -0
- package/dist/components/date-picker/wheel-column.js +152 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/input/input.js +3 -2
- package/dist/components/input/number-input.js +3 -2
- package/dist/config/config.default.js +1 -1
- package/dist/config/config.street.d.ts +2 -0
- package/dist/config/{config.ux.js → config.street.js} +2 -2
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +2 -2
- package/dist/hooks/index.d.ts +2 -0
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/useI18n.d.ts +5 -0
- package/dist/hooks/useI18n.js +7 -0
- package/dist/hooks/useLocale.d.ts +8 -0
- package/dist/hooks/useLocale.js +9 -0
- package/dist/icons/{DotIcon.d.ts → index.d.ts} +1 -2
- package/dist/icons/index.js +152 -0
- package/dist/icons/types.d.ts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/locales/en.d.ts +35 -0
- package/dist/locales/en.js +35 -0
- package/dist/locales/index.d.ts +107 -0
- package/dist/locales/index.js +12 -0
- package/dist/locales/zh.d.ts +2 -0
- package/dist/locales/zh.js +35 -0
- package/dist/provider/ThemeContext.js +2 -0
- package/dist/provider/ThemeProvider.d.ts +4 -2
- package/dist/provider/ThemeProvider.js +9 -3
- package/dist/types/theme.d.ts +4 -0
- package/package.json +5 -3
- package/dist/config/config.ux.d.ts +0 -2
- package/dist/icons/CheckIcon.d.ts +0 -4
- package/dist/icons/CheckIcon.js +0 -20
- package/dist/icons/CheckboxOffIcon.d.ts +0 -4
- package/dist/icons/CheckboxOffIcon.js +0 -21
- package/dist/icons/CheckboxOnIcon.d.ts +0 -4
- package/dist/icons/CheckboxOnIcon.js +0 -26
- package/dist/icons/CloseIcon.d.ts +0 -4
- package/dist/icons/CloseIcon.js +0 -21
- package/dist/icons/DotIcon.js +0 -23
- package/dist/icons/QuestionIcon.d.ts +0 -4
- package/dist/icons/QuestionIcon.js +0 -21
- package/dist/icons/RadioOffIcon.d.ts +0 -4
- package/dist/icons/RadioOffIcon.js +0 -22
- package/dist/icons/RadioOnIcon.d.ts +0 -4
- package/dist/icons/RadioOnIcon.js +0 -42
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { useI18n, useLocale } from "../../hooks/index.js";
|
|
4
|
+
import { HStack } from "../layout/HStack.js";
|
|
5
|
+
import wheel_column from "./wheel-column.js";
|
|
6
|
+
const MONTHS_EN = [
|
|
7
|
+
'Jan',
|
|
8
|
+
'Feb',
|
|
9
|
+
'Mar',
|
|
10
|
+
'Apr',
|
|
11
|
+
'May',
|
|
12
|
+
'Jun',
|
|
13
|
+
'Jul',
|
|
14
|
+
'Aug',
|
|
15
|
+
'Sep',
|
|
16
|
+
'Oct',
|
|
17
|
+
'Nov',
|
|
18
|
+
'Dec'
|
|
19
|
+
];
|
|
20
|
+
const MONTHS_ZH = [
|
|
21
|
+
'1月',
|
|
22
|
+
'2月',
|
|
23
|
+
'3月',
|
|
24
|
+
'4月',
|
|
25
|
+
'5月',
|
|
26
|
+
'6月',
|
|
27
|
+
'7月',
|
|
28
|
+
'8月',
|
|
29
|
+
'9月',
|
|
30
|
+
'10月',
|
|
31
|
+
'11月',
|
|
32
|
+
'12月'
|
|
33
|
+
];
|
|
34
|
+
const DateWheelPicker = ({ selectedDate, onDateChange, minDate, maxDate })=>{
|
|
35
|
+
const i18n = useI18n();
|
|
36
|
+
const { locale } = useLocale();
|
|
37
|
+
const [month, setMonth] = useState(selectedDate.getMonth());
|
|
38
|
+
const [day, setDay] = useState(selectedDate.getDate());
|
|
39
|
+
const [year, setYear] = useState(selectedDate.getFullYear());
|
|
40
|
+
const years = useMemo(()=>{
|
|
41
|
+
const currentYear = new Date().getFullYear();
|
|
42
|
+
const minYear = minDate?.getFullYear() ?? currentYear - 100;
|
|
43
|
+
const maxYear = maxDate?.getFullYear() ?? currentYear + 100;
|
|
44
|
+
return Array.from({
|
|
45
|
+
length: maxYear - minYear + 1
|
|
46
|
+
}, (_, i)=>({
|
|
47
|
+
label: 'en' === locale ? (minYear + i).toString().padStart(4, '0') : `${minYear + i}年`,
|
|
48
|
+
value: minYear + i
|
|
49
|
+
}));
|
|
50
|
+
}, [
|
|
51
|
+
minDate,
|
|
52
|
+
maxDate,
|
|
53
|
+
locale
|
|
54
|
+
]);
|
|
55
|
+
const daysInMonth = useMemo(()=>new Date(year, month + 1, 0).getDate(), [
|
|
56
|
+
year,
|
|
57
|
+
month
|
|
58
|
+
]);
|
|
59
|
+
const days = useMemo(()=>Array.from({
|
|
60
|
+
length: daysInMonth
|
|
61
|
+
}, (_, i)=>({
|
|
62
|
+
label: 'en' === locale ? (i + 1).toString().padStart(2, '0') : `${i + 1}日`,
|
|
63
|
+
value: i + 1
|
|
64
|
+
})), [
|
|
65
|
+
daysInMonth,
|
|
66
|
+
locale
|
|
67
|
+
]);
|
|
68
|
+
const months = useMemo(()=>('en' === locale ? MONTHS_EN : MONTHS_ZH).map((m, index)=>({
|
|
69
|
+
label: m,
|
|
70
|
+
value: index
|
|
71
|
+
})), [
|
|
72
|
+
locale
|
|
73
|
+
]);
|
|
74
|
+
useEffect(()=>{
|
|
75
|
+
if (day > daysInMonth) setDay(daysInMonth);
|
|
76
|
+
}, [
|
|
77
|
+
day,
|
|
78
|
+
daysInMonth
|
|
79
|
+
]);
|
|
80
|
+
useEffect(()=>{
|
|
81
|
+
const newDate = new Date(year, month, day);
|
|
82
|
+
newDate.setHours(selectedDate.getHours());
|
|
83
|
+
newDate.setMinutes(selectedDate.getMinutes());
|
|
84
|
+
newDate.setSeconds(selectedDate.getSeconds());
|
|
85
|
+
onDateChange(newDate);
|
|
86
|
+
}, [
|
|
87
|
+
month,
|
|
88
|
+
day,
|
|
89
|
+
year
|
|
90
|
+
]);
|
|
91
|
+
return /*#__PURE__*/ jsxs(HStack, {
|
|
92
|
+
fullWidth: true,
|
|
93
|
+
children: [
|
|
94
|
+
'zh' === locale && /*#__PURE__*/ jsx(wheel_column, {
|
|
95
|
+
data: years,
|
|
96
|
+
label: i18n.datePicker.year,
|
|
97
|
+
selectedValue: year,
|
|
98
|
+
onValueChange: setYear
|
|
99
|
+
}),
|
|
100
|
+
/*#__PURE__*/ jsx(wheel_column, {
|
|
101
|
+
data: months,
|
|
102
|
+
label: i18n.datePicker.month,
|
|
103
|
+
selectedValue: month,
|
|
104
|
+
onValueChange: setMonth
|
|
105
|
+
}),
|
|
106
|
+
/*#__PURE__*/ jsx(wheel_column, {
|
|
107
|
+
data: days,
|
|
108
|
+
label: i18n.datePicker.day,
|
|
109
|
+
selectedValue: day,
|
|
110
|
+
onValueChange: setDay
|
|
111
|
+
}),
|
|
112
|
+
'en' === locale && /*#__PURE__*/ jsx(wheel_column, {
|
|
113
|
+
data: years,
|
|
114
|
+
label: i18n.datePicker.year,
|
|
115
|
+
selectedValue: year,
|
|
116
|
+
onValueChange: setYear
|
|
117
|
+
})
|
|
118
|
+
]
|
|
119
|
+
});
|
|
120
|
+
};
|
|
121
|
+
export { DateWheelPicker };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { useI18n } from "../../hooks/index.js";
|
|
4
|
+
import { HStack } from "../layout/HStack.js";
|
|
5
|
+
import wheel_column from "./wheel-column.js";
|
|
6
|
+
const hours = Array.from({
|
|
7
|
+
length: 24
|
|
8
|
+
}, (_, i)=>({
|
|
9
|
+
label: i.toString().padStart(2, '0'),
|
|
10
|
+
value: i
|
|
11
|
+
}));
|
|
12
|
+
const minutes = Array.from({
|
|
13
|
+
length: 60
|
|
14
|
+
}, (_, i)=>({
|
|
15
|
+
label: i.toString().padStart(2, '0'),
|
|
16
|
+
value: i
|
|
17
|
+
}));
|
|
18
|
+
const seconds = Array.from({
|
|
19
|
+
length: 60
|
|
20
|
+
}, (_, i)=>({
|
|
21
|
+
label: i.toString().padStart(2, '0'),
|
|
22
|
+
value: i
|
|
23
|
+
}));
|
|
24
|
+
const TimeWheelPicker = ({ selectedDate, onDateChange })=>{
|
|
25
|
+
const i18n = useI18n();
|
|
26
|
+
const [hour, setHour] = useState(selectedDate.getHours());
|
|
27
|
+
const [minute, setMinute] = useState(selectedDate.getMinutes());
|
|
28
|
+
const [second, setSecond] = useState(selectedDate.getSeconds());
|
|
29
|
+
useEffect(()=>{
|
|
30
|
+
const newDate = new Date(selectedDate);
|
|
31
|
+
newDate.setHours(hour);
|
|
32
|
+
newDate.setMinutes(minute);
|
|
33
|
+
newDate.setSeconds(second);
|
|
34
|
+
onDateChange(newDate);
|
|
35
|
+
}, [
|
|
36
|
+
hour,
|
|
37
|
+
minute,
|
|
38
|
+
second
|
|
39
|
+
]);
|
|
40
|
+
return /*#__PURE__*/ jsxs(HStack, {
|
|
41
|
+
fullWidth: true,
|
|
42
|
+
children: [
|
|
43
|
+
/*#__PURE__*/ jsx(wheel_column, {
|
|
44
|
+
data: hours,
|
|
45
|
+
label: i18n.datePicker.hour,
|
|
46
|
+
selectedValue: hour,
|
|
47
|
+
onValueChange: setHour
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ jsx(wheel_column, {
|
|
50
|
+
data: minutes,
|
|
51
|
+
label: i18n.datePicker.minute,
|
|
52
|
+
selectedValue: minute,
|
|
53
|
+
onValueChange: setMinute
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ jsx(wheel_column, {
|
|
56
|
+
data: seconds,
|
|
57
|
+
label: i18n.datePicker.second,
|
|
58
|
+
selectedValue: second,
|
|
59
|
+
onValueChange: setSecond
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
export { TimeWheelPicker };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { HStackProps } from '../layout/HStack';
|
|
2
|
+
import type { UXPressableProps } from '../UXPressable';
|
|
3
|
+
export interface UXDatePickerProps extends Omit<UXPressableProps, 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* 当前值
|
|
6
|
+
*/
|
|
7
|
+
value?: Date;
|
|
8
|
+
/**
|
|
9
|
+
* 默认值
|
|
10
|
+
*/
|
|
11
|
+
defaultValue?: Date;
|
|
12
|
+
/**
|
|
13
|
+
* 确认回调
|
|
14
|
+
*/
|
|
15
|
+
onConfirm?: (value: Date) => void;
|
|
16
|
+
/**
|
|
17
|
+
* 日期格式
|
|
18
|
+
*/
|
|
19
|
+
format?: string;
|
|
20
|
+
/**
|
|
21
|
+
* 最小日期
|
|
22
|
+
*/
|
|
23
|
+
minDate?: Date;
|
|
24
|
+
/**
|
|
25
|
+
* 最大日期
|
|
26
|
+
*/
|
|
27
|
+
maxDate?: Date;
|
|
28
|
+
/**
|
|
29
|
+
* 日期占位符
|
|
30
|
+
*/
|
|
31
|
+
placeholder?: string;
|
|
32
|
+
/**
|
|
33
|
+
* 是否禁用
|
|
34
|
+
*/
|
|
35
|
+
isDisabled?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* 是否只读
|
|
38
|
+
*/
|
|
39
|
+
isReadOnly?: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface UXDateRangePickerProps extends Omit<HStackProps, 'children'> {
|
|
42
|
+
/**
|
|
43
|
+
* 当前值
|
|
44
|
+
*/
|
|
45
|
+
value?: DateRangeValue;
|
|
46
|
+
/**
|
|
47
|
+
* 默认值
|
|
48
|
+
*/
|
|
49
|
+
defaultValue?: DateRangeValue;
|
|
50
|
+
/**
|
|
51
|
+
* 确认回调
|
|
52
|
+
*/
|
|
53
|
+
onConfirm?: (value: DateRangeValue) => void;
|
|
54
|
+
/**
|
|
55
|
+
* 日期格式
|
|
56
|
+
*/
|
|
57
|
+
format?: string;
|
|
58
|
+
/**
|
|
59
|
+
* 最小日期
|
|
60
|
+
*/
|
|
61
|
+
minDate?: Date;
|
|
62
|
+
/**
|
|
63
|
+
* 最大日期
|
|
64
|
+
*/
|
|
65
|
+
maxDate?: Date;
|
|
66
|
+
/**
|
|
67
|
+
* 开始日期占位符
|
|
68
|
+
*/
|
|
69
|
+
startPlaceholder?: string;
|
|
70
|
+
/**
|
|
71
|
+
* 结束日期占位符
|
|
72
|
+
*/
|
|
73
|
+
endPlaceholder?: string;
|
|
74
|
+
/**
|
|
75
|
+
* 是否禁用
|
|
76
|
+
*/
|
|
77
|
+
isDisabled?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* 是否只读
|
|
80
|
+
*/
|
|
81
|
+
isReadOnly?: boolean;
|
|
82
|
+
}
|
|
83
|
+
export interface DateRangeValue {
|
|
84
|
+
start?: Date;
|
|
85
|
+
end?: Date;
|
|
86
|
+
}
|
|
87
|
+
export interface WheelPickerProps {
|
|
88
|
+
selectedDate: Date;
|
|
89
|
+
onDateChange: (date: Date) => void;
|
|
90
|
+
minDate?: Date;
|
|
91
|
+
maxDate?: Date;
|
|
92
|
+
}
|
|
93
|
+
export type PickerType = 'date' | 'time';
|
|
File without changes
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface WheelColumnProps {
|
|
3
|
+
data: {
|
|
4
|
+
label: string;
|
|
5
|
+
value: number;
|
|
6
|
+
}[];
|
|
7
|
+
selectedValue: number;
|
|
8
|
+
onValueChange: (value: number) => void;
|
|
9
|
+
label: string;
|
|
10
|
+
}
|
|
11
|
+
declare const WheelColumn: React.FC<WheelColumnProps>;
|
|
12
|
+
export default WheelColumn;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import react, { useEffect } from "react";
|
|
3
|
+
import { ScrollView } from "react-native";
|
|
4
|
+
import { Box } from "../layout/Box/index.js";
|
|
5
|
+
import { VStack } from "../layout/VStack.js";
|
|
6
|
+
import { Text } from "../Text/index.js";
|
|
7
|
+
import { UXPressable } from "../UXPressable/index.js";
|
|
8
|
+
const ITEM_HEIGHT = 44;
|
|
9
|
+
const WheelColumn = ({ data, selectedValue, onValueChange, label })=>{
|
|
10
|
+
const scrollViewRef = react.useRef(null);
|
|
11
|
+
const isScrolling = react.useRef(false);
|
|
12
|
+
const [scrollOffset, setScrollOffset] = react.useState(0);
|
|
13
|
+
const paddedData = react.useMemo(()=>{
|
|
14
|
+
const emptyItems = [
|
|
15
|
+
{
|
|
16
|
+
label: '',
|
|
17
|
+
value: -1
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
label: '',
|
|
21
|
+
value: -2
|
|
22
|
+
}
|
|
23
|
+
];
|
|
24
|
+
return [
|
|
25
|
+
...emptyItems,
|
|
26
|
+
...data,
|
|
27
|
+
...emptyItems
|
|
28
|
+
];
|
|
29
|
+
}, [
|
|
30
|
+
data
|
|
31
|
+
]);
|
|
32
|
+
const getItemOpacity = (index)=>{
|
|
33
|
+
const itemOffset = index * ITEM_HEIGHT;
|
|
34
|
+
const relativeOffset = itemOffset - scrollOffset;
|
|
35
|
+
const visibleIndex = Math.round(relativeOffset / ITEM_HEIGHT);
|
|
36
|
+
const opacityMap = {
|
|
37
|
+
0: 0.3,
|
|
38
|
+
1: 0.7,
|
|
39
|
+
2: 1,
|
|
40
|
+
3: 0.7,
|
|
41
|
+
4: 0.3
|
|
42
|
+
};
|
|
43
|
+
return opacityMap[visibleIndex] ?? 0.3;
|
|
44
|
+
};
|
|
45
|
+
useEffect(()=>{
|
|
46
|
+
const index = data.findIndex((item)=>item.value === selectedValue);
|
|
47
|
+
if (-1 !== index && scrollViewRef.current && !isScrolling.current) {
|
|
48
|
+
const targetY = index * ITEM_HEIGHT;
|
|
49
|
+
scrollViewRef.current.scrollTo({
|
|
50
|
+
y: targetY,
|
|
51
|
+
animated: false
|
|
52
|
+
});
|
|
53
|
+
setScrollOffset(targetY);
|
|
54
|
+
}
|
|
55
|
+
}, [
|
|
56
|
+
selectedValue,
|
|
57
|
+
data
|
|
58
|
+
]);
|
|
59
|
+
const handleScroll = (event)=>{
|
|
60
|
+
const offsetY = event.nativeEvent.contentOffset.y;
|
|
61
|
+
setScrollOffset(offsetY);
|
|
62
|
+
const index = Math.round(offsetY / ITEM_HEIGHT);
|
|
63
|
+
if (data[index] && data[index].value !== selectedValue) onValueChange(data[index].value);
|
|
64
|
+
};
|
|
65
|
+
const handleScrollBegin = ()=>{
|
|
66
|
+
isScrolling.current = true;
|
|
67
|
+
};
|
|
68
|
+
const handleScrollEnd = ()=>{
|
|
69
|
+
isScrolling.current = false;
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/ jsxs(VStack, {
|
|
72
|
+
fill: true,
|
|
73
|
+
items: "center",
|
|
74
|
+
gap: 8,
|
|
75
|
+
children: [
|
|
76
|
+
/*#__PURE__*/ jsx(Text, {
|
|
77
|
+
body2Bold: true,
|
|
78
|
+
color: "secondary",
|
|
79
|
+
children: label
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ jsxs(Box, {
|
|
82
|
+
fullWidth: true,
|
|
83
|
+
position: "relative",
|
|
84
|
+
h: 5 * ITEM_HEIGHT,
|
|
85
|
+
children: [
|
|
86
|
+
/*#__PURE__*/ jsx(ScrollView, {
|
|
87
|
+
ref: scrollViewRef,
|
|
88
|
+
nestedScrollEnabled: true,
|
|
89
|
+
scrollEnabled: true,
|
|
90
|
+
showsVerticalScrollIndicator: false,
|
|
91
|
+
snapToInterval: ITEM_HEIGHT,
|
|
92
|
+
decelerationRate: "fast",
|
|
93
|
+
scrollEventThrottle: 16,
|
|
94
|
+
onScrollBeginDrag: handleScrollBegin,
|
|
95
|
+
onMomentumScrollBegin: handleScrollBegin,
|
|
96
|
+
onMomentumScrollEnd: handleScrollEnd,
|
|
97
|
+
onScrollEndDrag: handleScrollEnd,
|
|
98
|
+
onScroll: handleScroll,
|
|
99
|
+
children: paddedData.map((item, idx)=>{
|
|
100
|
+
const opacity = getItemOpacity(idx);
|
|
101
|
+
return /*#__PURE__*/ jsx(UXPressable, {
|
|
102
|
+
center: true,
|
|
103
|
+
ph: 20,
|
|
104
|
+
pv: 8,
|
|
105
|
+
h: ITEM_HEIGHT,
|
|
106
|
+
onPress: ()=>{
|
|
107
|
+
if (-1 !== item.value && -2 !== item.value) {
|
|
108
|
+
const dataIndex = data.findIndex((d)=>d.value === item.value);
|
|
109
|
+
if (-1 !== dataIndex) {
|
|
110
|
+
const targetY = dataIndex * ITEM_HEIGHT;
|
|
111
|
+
isScrolling.current = true;
|
|
112
|
+
scrollViewRef.current?.scrollTo({
|
|
113
|
+
y: targetY,
|
|
114
|
+
animated: true
|
|
115
|
+
});
|
|
116
|
+
setScrollOffset(targetY);
|
|
117
|
+
onValueChange(item.value);
|
|
118
|
+
setTimeout(()=>{
|
|
119
|
+
isScrolling.current = false;
|
|
120
|
+
}, 300);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
children: /*#__PURE__*/ jsx(Text, {
|
|
125
|
+
body1Bold: true,
|
|
126
|
+
color: "foreground",
|
|
127
|
+
style: {
|
|
128
|
+
opacity
|
|
129
|
+
},
|
|
130
|
+
children: item.label
|
|
131
|
+
})
|
|
132
|
+
}, `${item.value}-${idx}`);
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
135
|
+
/*#__PURE__*/ jsx(Box, {
|
|
136
|
+
position: "absolute",
|
|
137
|
+
zIndex: -1,
|
|
138
|
+
top: 2 * ITEM_HEIGHT,
|
|
139
|
+
left: 0,
|
|
140
|
+
right: 0,
|
|
141
|
+
h: ITEM_HEIGHT,
|
|
142
|
+
borderTop: 1,
|
|
143
|
+
borderBottom: 1,
|
|
144
|
+
borderColor: "divider"
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
const wheel_column = WheelColumn;
|
|
152
|
+
export { wheel_column as default };
|
package/dist/components/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { TextInput } from "react-native";
|
|
4
4
|
import { useColors } from "../../hooks/index.js";
|
|
5
|
-
import
|
|
5
|
+
import { Icon } from "../../icons/index.js";
|
|
6
6
|
import { HStack } from "../layout/HStack.js";
|
|
7
7
|
import { VStack } from "../layout/VStack.js";
|
|
8
8
|
import { Text } from "../Text/index.js";
|
|
@@ -142,7 +142,8 @@ const UXInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
142
142
|
}),
|
|
143
143
|
isClearable && !!internalValue && !isDisabled && !isReadOnly && /*#__PURE__*/ jsx(UXPressable, {
|
|
144
144
|
onPress: handleClear,
|
|
145
|
-
children: /*#__PURE__*/ jsx(
|
|
145
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
146
|
+
name: "close",
|
|
146
147
|
style: styles.clearButton
|
|
147
148
|
})
|
|
148
149
|
}),
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { Platform, TextInput } from "react-native";
|
|
4
4
|
import { useColors } from "../../hooks/index.js";
|
|
5
|
-
import
|
|
5
|
+
import { Icon } from "../../icons/index.js";
|
|
6
6
|
import { HStack } from "../layout/HStack.js";
|
|
7
7
|
import { VStack } from "../layout/VStack.js";
|
|
8
8
|
import { Text } from "../Text/index.js";
|
|
@@ -236,7 +236,8 @@ const UXNumberInput = /*#__PURE__*/ forwardRef((props, ref)=>{
|
|
|
236
236
|
}),
|
|
237
237
|
isClearable && !isNaN(internalValue) && !isDisabled && !isReadOnly && /*#__PURE__*/ jsx(UXPressable, {
|
|
238
238
|
onPress: handleClear,
|
|
239
|
-
children: /*#__PURE__*/ jsx(
|
|
239
|
+
children: /*#__PURE__*/ jsx(Icon, {
|
|
240
|
+
name: "close",
|
|
240
241
|
style: styles.clearButton,
|
|
241
242
|
color: "secondary"
|
|
242
243
|
})
|
package/dist/config/index.d.ts
CHANGED
package/dist/config/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defaultComponentConfig } from "./config.default.js";
|
|
2
|
-
import {
|
|
2
|
+
import { streetComponentConfig } from "./config.street.js";
|
|
3
3
|
const builtinComponentConfig = {
|
|
4
|
-
|
|
4
|
+
street: streetComponentConfig,
|
|
5
5
|
default: defaultComponentConfig
|
|
6
6
|
};
|
|
7
7
|
export { builtinComponentConfig };
|
package/dist/hooks/index.d.ts
CHANGED
package/dist/hooks/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "./useColors.js";
|
|
2
2
|
export * from "./useComponentConfig.js";
|
|
3
|
+
export * from "./useI18n.js";
|
|
3
4
|
export * from "./useKeyboard.js";
|
|
5
|
+
export * from "./useLocale.js";
|
|
4
6
|
export * from "./useMs.js";
|
|
5
7
|
export * from "./useRadius.js";
|
|
6
8
|
export * from "./useSpacing.js";
|