@webority-technologies/mobile 0.0.15 → 0.0.21
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/lib/commonjs/components/Accordion/Accordion.js +60 -19
- package/lib/commonjs/components/AppBar/AppBar.js +29 -20
- package/lib/commonjs/components/Avatar/Avatar.js +38 -8
- package/lib/commonjs/components/Badge/Badge.js +66 -4
- package/lib/commonjs/components/Banner/Banner.js +146 -66
- package/lib/commonjs/components/BottomNavigation/BottomNavigation.js +37 -15
- package/lib/commonjs/components/BottomSheet/BottomSheet.js +78 -53
- package/lib/commonjs/components/Button/Button.js +12 -5
- package/lib/commonjs/components/Card/Card.js +106 -16
- package/lib/commonjs/components/Carousel/Carousel.js +66 -12
- package/lib/commonjs/components/Checkbox/Checkbox.js +11 -7
- package/lib/commonjs/components/Chip/Chip.js +44 -12
- package/lib/commonjs/components/DatePicker/DatePicker.js +185 -76
- package/lib/commonjs/components/DateRangePicker/DateRangePicker.js +133 -59
- package/lib/commonjs/components/Dialog/Dialog.js +16 -10
- package/lib/commonjs/components/Drawer/Drawer.js +13 -10
- package/lib/commonjs/components/FieldBase/FieldBase.js +494 -0
- package/lib/commonjs/components/FieldBase/index.js +32 -0
- package/lib/commonjs/components/FloatingActionButton/FloatingActionButton.js +69 -44
- package/lib/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
- package/lib/commonjs/components/FormField/FormField.js +3 -2
- package/lib/commonjs/components/ImageGallery/ImageGallery.js +132 -44
- package/lib/commonjs/components/Input/Input.js +144 -181
- package/lib/commonjs/components/ListItem/ListItem.js +90 -11
- package/lib/commonjs/components/Modal/Modal.js +55 -27
- package/lib/commonjs/components/NumberInput/NumberInput.js +60 -106
- package/lib/commonjs/components/OTPInput/OTPInput.js +65 -58
- package/lib/commonjs/components/PickerTrigger/PickerTrigger.js +185 -0
- package/lib/commonjs/components/{AppIcon → PickerTrigger}/index.js +4 -4
- package/lib/commonjs/components/ProgressBar/ProgressBar.js +19 -11
- package/lib/commonjs/components/Radio/Radio.js +11 -6
- package/lib/commonjs/components/Rating/Rating.js +85 -19
- package/lib/commonjs/components/SearchBar/SearchBar.js +90 -107
- package/lib/commonjs/components/SegmentedControl/SegmentedControl.js +22 -11
- package/lib/commonjs/components/Select/Select.js +62 -91
- package/lib/commonjs/components/Skeleton/Skeleton.js +131 -174
- package/lib/commonjs/components/Skeleton/SkeletonClock.js +117 -0
- package/lib/commonjs/components/Skeleton/SkeletonContent.js +164 -81
- package/lib/commonjs/components/Skeleton/SkeletonProvider.js +72 -10
- package/lib/commonjs/components/Skeleton/index.js +17 -16
- package/lib/commonjs/components/Slider/Slider.js +44 -25
- package/lib/commonjs/components/Stepper/Stepper.js +199 -29
- package/lib/commonjs/components/Swipeable/Swipeable.js +36 -19
- package/lib/commonjs/components/Switch/Switch.js +9 -2
- package/lib/commonjs/components/Tabs/Tabs.js +84 -21
- package/lib/commonjs/components/TimePicker/TimePicker.js +123 -45
- package/lib/commonjs/components/Toast/Toast.js +27 -16
- package/lib/commonjs/components/Tooltip/Tooltip.js +56 -32
- package/lib/commonjs/components/index.js +37 -37
- package/lib/commonjs/theme/tokens.js +55 -7
- package/lib/module/components/Accordion/Accordion.js +61 -20
- package/lib/module/components/AppBar/AppBar.js +29 -20
- package/lib/module/components/Avatar/Avatar.js +39 -9
- package/lib/module/components/Badge/Badge.js +67 -5
- package/lib/module/components/Banner/Banner.js +147 -67
- package/lib/module/components/BottomNavigation/BottomNavigation.js +37 -15
- package/lib/module/components/BottomSheet/BottomSheet.js +80 -55
- package/lib/module/components/Button/Button.js +12 -5
- package/lib/module/components/Card/Card.js +107 -17
- package/lib/module/components/Carousel/Carousel.js +67 -13
- package/lib/module/components/Checkbox/Checkbox.js +11 -7
- package/lib/module/components/Chip/Chip.js +45 -13
- package/lib/module/components/DatePicker/DatePicker.js +185 -76
- package/lib/module/components/DateRangePicker/DateRangePicker.js +134 -60
- package/lib/module/components/Dialog/Dialog.js +16 -10
- package/lib/module/components/Drawer/Drawer.js +13 -10
- package/lib/module/components/FieldBase/FieldBase.js +485 -0
- package/lib/module/components/FieldBase/index.js +4 -0
- package/lib/module/components/FloatingActionButton/FloatingActionButton.js +69 -44
- package/lib/module/components/ForceUpdateDialog/ForceUpdateDialog.js +8 -2
- package/lib/module/components/FormField/FormField.js +3 -2
- package/lib/module/components/ImageGallery/ImageGallery.js +128 -40
- package/lib/module/components/Input/Input.js +144 -179
- package/lib/module/components/ListItem/ListItem.js +91 -12
- package/lib/module/components/Modal/Modal.js +55 -27
- package/lib/module/components/NumberInput/NumberInput.js +60 -106
- package/lib/module/components/OTPInput/OTPInput.js +65 -58
- package/lib/module/components/PickerTrigger/PickerTrigger.js +181 -0
- package/lib/module/components/PickerTrigger/index.js +4 -0
- package/lib/module/components/ProgressBar/ProgressBar.js +19 -11
- package/lib/module/components/Radio/Radio.js +11 -6
- package/lib/module/components/Rating/Rating.js +86 -20
- package/lib/module/components/SearchBar/SearchBar.js +90 -107
- package/lib/module/components/SegmentedControl/SegmentedControl.js +22 -11
- package/lib/module/components/Select/Select.js +62 -91
- package/lib/module/components/Skeleton/Skeleton.js +135 -175
- package/lib/module/components/Skeleton/SkeletonClock.js +110 -0
- package/lib/module/components/Skeleton/SkeletonContent.js +167 -84
- package/lib/module/components/Skeleton/SkeletonProvider.js +71 -10
- package/lib/module/components/Skeleton/index.js +3 -2
- package/lib/module/components/Slider/Slider.js +44 -25
- package/lib/module/components/Stepper/Stepper.js +201 -31
- package/lib/module/components/Swipeable/Swipeable.js +36 -19
- package/lib/module/components/Switch/Switch.js +9 -2
- package/lib/module/components/Tabs/Tabs.js +84 -21
- package/lib/module/components/TimePicker/TimePicker.js +123 -45
- package/lib/module/components/Toast/Toast.js +27 -16
- package/lib/module/components/Tooltip/Tooltip.js +56 -32
- package/lib/module/components/index.js +2 -2
- package/lib/module/theme/tokens.js +55 -7
- package/lib/typescript/commonjs/components/Accordion/Accordion.d.ts +10 -5
- package/lib/typescript/commonjs/components/AppBar/AppBar.d.ts +8 -0
- package/lib/typescript/commonjs/components/Avatar/Avatar.d.ts +12 -6
- package/lib/typescript/commonjs/components/Badge/Badge.d.ts +7 -6
- package/lib/typescript/commonjs/components/Banner/Banner.d.ts +17 -6
- package/lib/typescript/commonjs/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/commonjs/components/Card/Card.d.ts +17 -6
- package/lib/typescript/commonjs/components/Carousel/Carousel.d.ts +7 -6
- package/lib/typescript/commonjs/components/Checkbox/Checkbox.d.ts +9 -1
- package/lib/typescript/commonjs/components/Chip/Chip.d.ts +13 -6
- package/lib/typescript/commonjs/components/DatePicker/DatePicker.d.ts +38 -3
- package/lib/typescript/commonjs/components/DateRangePicker/DateRangePicker.d.ts +36 -3
- package/lib/typescript/commonjs/components/Dialog/Dialog.d.ts +13 -1
- package/lib/typescript/commonjs/components/FieldBase/FieldBase.d.ts +172 -0
- package/lib/typescript/commonjs/components/FieldBase/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
- package/lib/typescript/commonjs/components/FloatingActionButton/index.d.ts +1 -1
- package/lib/typescript/commonjs/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
- package/lib/typescript/commonjs/components/FormField/FormField.d.ts +7 -0
- package/lib/typescript/commonjs/components/ImageGallery/ImageGallery.d.ts +6 -4
- package/lib/typescript/commonjs/components/Input/Input.d.ts +7 -1
- package/lib/typescript/commonjs/components/ListItem/ListItem.d.ts +13 -6
- package/lib/typescript/commonjs/components/NumberInput/NumberInput.d.ts +3 -0
- package/lib/typescript/commonjs/components/PickerTrigger/PickerTrigger.d.ts +57 -0
- package/lib/typescript/commonjs/components/PickerTrigger/index.d.ts +3 -0
- package/lib/typescript/commonjs/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/lib/typescript/commonjs/components/Radio/Radio.d.ts +3 -0
- package/lib/typescript/commonjs/components/Rating/Rating.d.ts +9 -6
- package/lib/typescript/commonjs/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/lib/typescript/commonjs/components/Skeleton/Skeleton.d.ts +49 -20
- package/lib/typescript/commonjs/components/Skeleton/SkeletonClock.d.ts +60 -0
- package/lib/typescript/commonjs/components/Skeleton/SkeletonContent.d.ts +80 -19
- package/lib/typescript/commonjs/components/Skeleton/SkeletonProvider.d.ts +39 -5
- package/lib/typescript/commonjs/components/Skeleton/index.d.ts +6 -4
- package/lib/typescript/commonjs/components/Slider/Slider.d.ts +12 -1
- package/lib/typescript/commonjs/components/Stepper/Stepper.d.ts +18 -6
- package/lib/typescript/commonjs/components/Swipeable/Swipeable.d.ts +2 -0
- package/lib/typescript/commonjs/components/Switch/Switch.d.ts +1 -0
- package/lib/typescript/commonjs/components/Tabs/Tabs.d.ts +26 -2
- package/lib/typescript/commonjs/components/TimePicker/TimePicker.d.ts +36 -3
- package/lib/typescript/commonjs/components/Toast/Toast.d.ts +8 -0
- package/lib/typescript/commonjs/components/Tooltip/Tooltip.d.ts +7 -1
- package/lib/typescript/commonjs/components/index.d.ts +5 -5
- package/lib/typescript/commonjs/index.d.ts +1 -1
- package/lib/typescript/commonjs/theme/index.d.ts +1 -1
- package/lib/typescript/commonjs/theme/types.d.ts +578 -12
- package/lib/typescript/module/components/Accordion/Accordion.d.ts +10 -5
- package/lib/typescript/module/components/AppBar/AppBar.d.ts +8 -0
- package/lib/typescript/module/components/Avatar/Avatar.d.ts +12 -6
- package/lib/typescript/module/components/Badge/Badge.d.ts +7 -6
- package/lib/typescript/module/components/Banner/Banner.d.ts +17 -6
- package/lib/typescript/module/components/BottomSheet/BottomSheet.d.ts +7 -0
- package/lib/typescript/module/components/Card/Card.d.ts +17 -6
- package/lib/typescript/module/components/Carousel/Carousel.d.ts +7 -6
- package/lib/typescript/module/components/Checkbox/Checkbox.d.ts +9 -1
- package/lib/typescript/module/components/Chip/Chip.d.ts +13 -6
- package/lib/typescript/module/components/DatePicker/DatePicker.d.ts +38 -3
- package/lib/typescript/module/components/DateRangePicker/DateRangePicker.d.ts +36 -3
- package/lib/typescript/module/components/Dialog/Dialog.d.ts +13 -1
- package/lib/typescript/module/components/FieldBase/FieldBase.d.ts +172 -0
- package/lib/typescript/module/components/FieldBase/index.d.ts +3 -0
- package/lib/typescript/module/components/FloatingActionButton/FloatingActionButton.d.ts +8 -6
- package/lib/typescript/module/components/FloatingActionButton/index.d.ts +1 -1
- package/lib/typescript/module/components/ForceUpdateDialog/ForceUpdateDialog.d.ts +7 -0
- package/lib/typescript/module/components/FormField/FormField.d.ts +7 -0
- package/lib/typescript/module/components/ImageGallery/ImageGallery.d.ts +6 -4
- package/lib/typescript/module/components/Input/Input.d.ts +7 -1
- package/lib/typescript/module/components/ListItem/ListItem.d.ts +13 -6
- package/lib/typescript/module/components/NumberInput/NumberInput.d.ts +3 -0
- package/lib/typescript/module/components/PickerTrigger/PickerTrigger.d.ts +57 -0
- package/lib/typescript/module/components/PickerTrigger/index.d.ts +3 -0
- package/lib/typescript/module/components/ProgressBar/ProgressBar.d.ts +2 -0
- package/lib/typescript/module/components/Radio/Radio.d.ts +3 -0
- package/lib/typescript/module/components/Rating/Rating.d.ts +9 -6
- package/lib/typescript/module/components/SegmentedControl/SegmentedControl.d.ts +3 -0
- package/lib/typescript/module/components/Skeleton/Skeleton.d.ts +49 -20
- package/lib/typescript/module/components/Skeleton/SkeletonClock.d.ts +60 -0
- package/lib/typescript/module/components/Skeleton/SkeletonContent.d.ts +80 -19
- package/lib/typescript/module/components/Skeleton/SkeletonProvider.d.ts +39 -5
- package/lib/typescript/module/components/Skeleton/index.d.ts +6 -4
- package/lib/typescript/module/components/Slider/Slider.d.ts +12 -1
- package/lib/typescript/module/components/Stepper/Stepper.d.ts +18 -6
- package/lib/typescript/module/components/Swipeable/Swipeable.d.ts +2 -0
- package/lib/typescript/module/components/Switch/Switch.d.ts +1 -0
- package/lib/typescript/module/components/Tabs/Tabs.d.ts +26 -2
- package/lib/typescript/module/components/TimePicker/TimePicker.d.ts +36 -3
- package/lib/typescript/module/components/Toast/Toast.d.ts +8 -0
- package/lib/typescript/module/components/Tooltip/Tooltip.d.ts +7 -1
- package/lib/typescript/module/components/index.d.ts +5 -5
- package/lib/typescript/module/index.d.ts +1 -1
- package/lib/typescript/module/theme/index.d.ts +1 -1
- package/lib/typescript/module/theme/types.d.ts +578 -12
- package/package.json +2 -6
- package/lib/commonjs/components/AppIcon/AppIcon.js +0 -120
- package/lib/commonjs/types/vector-icons.d.js +0 -2
- package/lib/module/components/AppIcon/AppIcon.js +0 -111
- package/lib/module/components/AppIcon/index.js +0 -4
- package/lib/module/types/vector-icons.d.js +0 -2
- package/lib/typescript/commonjs/components/AppIcon/AppIcon.d.ts +0 -20
- package/lib/typescript/commonjs/components/AppIcon/index.d.ts +0 -3
- package/lib/typescript/module/components/AppIcon/AppIcon.d.ts +0 -20
- package/lib/typescript/module/components/AppIcon/index.d.ts +0 -3
|
@@ -6,43 +6,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = exports.Input = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _reactNative = require("react-native");
|
|
9
|
-
var _Feather = _interopRequireDefault(require("react-native-vector-icons/Feather"));
|
|
10
9
|
var _index = require("../../theme/index.js");
|
|
11
10
|
var _index2 = require("../../utils/index.js");
|
|
11
|
+
var _FieldBase = require("../FieldBase/FieldBase.js");
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
-
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
14
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
paddingVertical: 8,
|
|
22
|
-
minHeight: 38,
|
|
23
|
-
multilineMinHeight: 72,
|
|
24
|
-
fontSize: 13,
|
|
25
|
-
borderRadius: 10,
|
|
26
|
-
iconSize: 16
|
|
27
|
-
},
|
|
28
|
-
md: {
|
|
29
|
-
paddingHorizontal: 14,
|
|
30
|
-
paddingVertical: 11,
|
|
31
|
-
minHeight: 46,
|
|
32
|
-
multilineMinHeight: 92,
|
|
33
|
-
fontSize: 15,
|
|
34
|
-
borderRadius: 12,
|
|
35
|
-
iconSize: 18
|
|
36
|
-
},
|
|
37
|
-
lg: {
|
|
38
|
-
paddingHorizontal: 16,
|
|
39
|
-
paddingVertical: 14,
|
|
40
|
-
minHeight: 54,
|
|
41
|
-
multilineMinHeight: 110,
|
|
42
|
-
fontSize: 16,
|
|
43
|
-
borderRadius: 14,
|
|
44
|
-
iconSize: 20
|
|
45
|
-
}
|
|
14
|
+
// FieldBase carries every dimension except `multilineMinHeight` — Input owns
|
|
15
|
+
// the multiline height ramp, so we keep a tiny per-size table for that one key.
|
|
16
|
+
const multilineMinHeightMap = {
|
|
17
|
+
sm: 72,
|
|
18
|
+
md: 92,
|
|
19
|
+
lg: 110
|
|
46
20
|
};
|
|
47
21
|
const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) => {
|
|
48
22
|
const {
|
|
@@ -66,8 +40,11 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
66
40
|
format,
|
|
67
41
|
parse,
|
|
68
42
|
style,
|
|
43
|
+
containerStyle,
|
|
69
44
|
inputStyle,
|
|
70
45
|
labelStyle,
|
|
46
|
+
messageStyle,
|
|
47
|
+
borderRadius: borderRadiusProp,
|
|
71
48
|
onFocus,
|
|
72
49
|
onBlur,
|
|
73
50
|
accessibilityLabel,
|
|
@@ -77,13 +54,16 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
77
54
|
} = props;
|
|
78
55
|
const theme = (0, _index.useTheme)();
|
|
79
56
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
...(theme.components.input?.[size] ?? {})
|
|
83
|
-
};
|
|
57
|
+
const sizeTokens = (0, _FieldBase.resolveFieldSize)(theme, size);
|
|
58
|
+
const multilineMinHeight = multilineMinHeightMap[size];
|
|
84
59
|
|
|
85
|
-
//
|
|
86
|
-
|
|
60
|
+
// Resolution chain: caller prop → component-specific token
|
|
61
|
+
// (`components.input.defaultVariant`) → shared field-family token
|
|
62
|
+
// (`components.field.defaultVariant`) → library default. The middle step lets
|
|
63
|
+
// brands flip every input-style control (Input, Select, SearchBar, …) in one
|
|
64
|
+
// place; the per-component slot still wins when a brand needs a different
|
|
65
|
+
// default for Input specifically.
|
|
66
|
+
const variant = variantProp ?? theme.components.input?.defaultVariant ?? theme.components.field?.defaultVariant ?? 'outlined';
|
|
87
67
|
const labelMode = labelModeProp ?? theme.components.input?.defaultLabelMode ?? 'float';
|
|
88
68
|
const [isFocused, setIsFocused] = (0, _react.useState)(false);
|
|
89
69
|
const [isPasswordVisible, setIsPasswordVisible] = (0, _react.useState)(false);
|
|
@@ -96,41 +76,20 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
96
76
|
// above the field — the staticLabel branch below handles both.
|
|
97
77
|
const showFloatingLabel = Boolean(label) && !multiline && labelMode === 'float';
|
|
98
78
|
|
|
99
|
-
// Animations
|
|
100
|
-
|
|
101
|
-
const errorAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
|
|
79
|
+
// Animations local to Input: floating label, shake, helper/error fade.
|
|
80
|
+
// Border + fill animations now live inside FieldBase.
|
|
102
81
|
const labelAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(shouldFloat ? 1 : 0)).current;
|
|
103
82
|
const shakeAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(0)).current;
|
|
104
83
|
const messageAnim = (0, _react.useRef)((0, _index.createAnimatedValue)(hasError || helperText ? 1 : 0)).current;
|
|
105
84
|
|
|
106
|
-
// Focus border animation
|
|
107
|
-
(0, _react.useEffect)(() => {
|
|
108
|
-
_reactNative.Animated.timing(focusAnim, {
|
|
109
|
-
toValue: isFocused ? 1 : 0,
|
|
110
|
-
duration: theme.motion.duration.fast,
|
|
111
|
-
easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
|
|
112
|
-
useNativeDriver: false
|
|
113
|
-
}).start();
|
|
114
|
-
}, [isFocused, focusAnim, theme.motion.duration.fast, theme.motion.easing.standard]);
|
|
115
|
-
|
|
116
|
-
// Error border + message animation
|
|
117
|
-
(0, _react.useEffect)(() => {
|
|
118
|
-
_reactNative.Animated.timing(errorAnim, {
|
|
119
|
-
toValue: hasError ? 1 : 0,
|
|
120
|
-
duration: theme.motion.duration.fast,
|
|
121
|
-
easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
|
|
122
|
-
useNativeDriver: false
|
|
123
|
-
}).start();
|
|
124
|
-
}, [hasError, errorAnim, theme.motion.duration.fast, theme.motion.easing.standard]);
|
|
125
|
-
|
|
126
85
|
// Floating label animation
|
|
127
86
|
(0, _react.useEffect)(() => {
|
|
128
|
-
_reactNative.Animated.
|
|
87
|
+
_reactNative.Animated.timing(labelAnim, {
|
|
129
88
|
toValue: shouldFloat ? 1 : 0,
|
|
130
89
|
duration: theme.motion.duration.fast,
|
|
131
90
|
easing: _reactNative.Easing.bezier(...theme.motion.easing.standard),
|
|
132
91
|
useNativeDriver: false
|
|
133
|
-
})
|
|
92
|
+
}).start();
|
|
134
93
|
}, [shouldFloat, labelAnim, theme.motion.duration.fast, theme.motion.easing.standard]);
|
|
135
94
|
|
|
136
95
|
// Helper / error fade
|
|
@@ -143,9 +102,15 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
143
102
|
}).start();
|
|
144
103
|
}, [hasError, helperText, messageAnim, theme.motion.easing.standard]);
|
|
145
104
|
|
|
146
|
-
// Error shake
|
|
105
|
+
// Error shake — off by default; consumers opt in via
|
|
106
|
+
// theme.components.input.shakeOnError. The haptic ships with the shake.
|
|
107
|
+
const shakeOnError = theme.components.input?.shakeOnError ?? false;
|
|
147
108
|
const prevErrorRef = (0, _react.useRef)(hasError);
|
|
148
109
|
(0, _react.useEffect)(() => {
|
|
110
|
+
if (!shakeOnError) {
|
|
111
|
+
prevErrorRef.current = hasError;
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
149
114
|
if (hasError && !prevErrorRef.current) {
|
|
150
115
|
(0, _index.setNativeValue)(shakeAnim, 0);
|
|
151
116
|
_reactNative.Animated.sequence([_reactNative.Animated.timing(shakeAnim, {
|
|
@@ -172,7 +137,7 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
172
137
|
(0, _index2.triggerHaptic)('notificationError');
|
|
173
138
|
}
|
|
174
139
|
prevErrorRef.current = hasError;
|
|
175
|
-
}, [hasError, shakeAnim]);
|
|
140
|
+
}, [hasError, shakeAnim, shakeOnError]);
|
|
176
141
|
const handleFocus = (0, _react.useCallback)(e => {
|
|
177
142
|
setIsFocused(true);
|
|
178
143
|
onFocus?.(e);
|
|
@@ -186,19 +151,25 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
186
151
|
setIsPasswordVisible(prev => !prev);
|
|
187
152
|
}, []);
|
|
188
153
|
|
|
189
|
-
//
|
|
190
|
-
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
154
|
+
// Bridge legacy Input fill-colour API (theme.components.input.fillColors[variant])
|
|
155
|
+
// onto FieldBase's FieldVariantTokens shape. Keeps consumer overrides working.
|
|
156
|
+
const fillOverrides = (0, _react.useMemo)(() => {
|
|
157
|
+
const legacy = theme.components.input?.fillColors?.[variant];
|
|
158
|
+
if (!legacy) return undefined;
|
|
159
|
+
const overrides = {};
|
|
160
|
+
if (legacy.idleEmpty !== undefined) overrides.backgroundIdleEmpty = legacy.idleEmpty;
|
|
161
|
+
if (legacy.idleFilled !== undefined) overrides.backgroundIdleFilled = legacy.idleFilled;
|
|
162
|
+
if (legacy.focus !== undefined) overrides.backgroundFocused = legacy.focus;
|
|
163
|
+
if (legacy.error !== undefined) overrides.backgroundError = legacy.error;
|
|
164
|
+
if (legacy.disabled !== undefined) overrides.backgroundDisabled = legacy.disabled;
|
|
165
|
+
return Object.keys(overrides).length > 0 ? overrides : undefined;
|
|
166
|
+
}, [theme.components.input?.fillColors, variant]);
|
|
167
|
+
|
|
168
|
+
// Selection / caret / handle colour walks the same resolution chain as the
|
|
169
|
+
// focused border so brands that override `components.field.<variant>.borderFocused`
|
|
170
|
+
// get a matching selection tint without also having to update root `border.focus`.
|
|
171
|
+
const selectionColor = (0, _react.useMemo)(() => (0, _FieldBase.resolveVariantColors)(theme, variant, fillOverrides).borderFocusedRepresentative, [theme, variant, fillOverrides]);
|
|
172
|
+
const borderRadiusOverride = borderRadiusProp ?? theme.components.input?.borderRadius;
|
|
202
173
|
|
|
203
174
|
// Floating label styles
|
|
204
175
|
const labelTranslateY = labelAnim.interpolate({
|
|
@@ -209,24 +180,53 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
209
180
|
inputRange: [0, 1],
|
|
210
181
|
outputRange: [1, 0.85]
|
|
211
182
|
});
|
|
212
|
-
|
|
183
|
+
// Single source of truth for label colour — used by BOTH static-top and
|
|
184
|
+
// floating modes. Label stays its resting colour on focus unless the consumer
|
|
185
|
+
// opts in via theme.components.input.tintLabelOnFocus.
|
|
186
|
+
const tintLabelOnFocus = theme.components.input?.tintLabelOnFocus ?? false;
|
|
187
|
+
const labelColor = hasError ? theme.colors.error : isFocused && tintLabelOnFocus ? theme.colors.border.focus : theme.colors.text.secondary;
|
|
213
188
|
const shakeTranslateX = shakeAnim.interpolate({
|
|
214
189
|
inputRange: [-1, 0, 1],
|
|
215
190
|
outputRange: [-6, 0, 6]
|
|
216
191
|
});
|
|
217
|
-
const
|
|
218
|
-
|
|
192
|
+
const fieldText = (0, _FieldBase.resolveFieldTextStyle)(theme, {
|
|
193
|
+
disabled
|
|
194
|
+
});
|
|
195
|
+
const inputTextColor = fieldText.color;
|
|
196
|
+
const placeholderTextColor = fieldText.placeholderColor;
|
|
219
197
|
const messageText = hasError ? error : helperText;
|
|
220
198
|
const messageColor = hasError ? theme.colors.error : theme.colors.text.secondary;
|
|
221
199
|
const a11yLabel = accessibilityLabel ?? label ?? placeholder;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
200
|
+
const iconColor = disabled ? theme.colors.text.disabled : theme.colors.text.secondary;
|
|
201
|
+
const trailing = (() => {
|
|
202
|
+
if (showPasswordToggle && secureTextEntry) {
|
|
203
|
+
const renderer = isPasswordVisible ? theme.icons?.eyeOff : theme.icons?.eye;
|
|
204
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
205
|
+
onPress: togglePasswordVisibility,
|
|
206
|
+
disabled: !isEditable,
|
|
207
|
+
hitSlop: 8,
|
|
208
|
+
accessibilityRole: "button",
|
|
209
|
+
accessibilityLabel: isPasswordVisible ? 'Hide password' : 'Show password',
|
|
210
|
+
children: renderer ? renderer({
|
|
211
|
+
size: sizeTokens.iconSize,
|
|
212
|
+
color: iconColor
|
|
213
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
214
|
+
style: {
|
|
215
|
+
fontSize: sizeTokens.iconSize,
|
|
216
|
+
color: iconColor
|
|
217
|
+
},
|
|
218
|
+
children: isPasswordVisible ? '✕' : '○'
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
if (rightIcon) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
223
|
+
children: rightIcon
|
|
224
|
+
});
|
|
225
|
+
return null;
|
|
226
|
+
})();
|
|
227
|
+
const leading = leftIcon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
228
|
+
children: leftIcon
|
|
229
|
+
}) : null;
|
|
230
230
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.View, {
|
|
231
231
|
style: [styles.container, {
|
|
232
232
|
transform: [{
|
|
@@ -235,7 +235,7 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
235
235
|
}, style],
|
|
236
236
|
children: [label && !showFloatingLabel ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
|
|
237
237
|
style: [styles.staticLabel, {
|
|
238
|
-
color:
|
|
238
|
+
color: labelColor,
|
|
239
239
|
fontSize: theme.typography.fontSize.sm,
|
|
240
240
|
...(0, _index.fontFor)(theme, 'medium'),
|
|
241
241
|
marginBottom: theme.spacing.xxs
|
|
@@ -246,31 +246,58 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
246
246
|
},
|
|
247
247
|
children: " *"
|
|
248
248
|
}) : null]
|
|
249
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.
|
|
250
|
-
style:
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
249
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
250
|
+
style: styles.fieldWrapper,
|
|
251
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FieldBase.FieldBase, {
|
|
252
|
+
size: size,
|
|
253
|
+
variant: variant,
|
|
254
|
+
focused: isFocused,
|
|
255
|
+
disabled: disabled,
|
|
256
|
+
error: hasError,
|
|
257
|
+
filled: hasValue,
|
|
258
|
+
minHeight: multiline ? multilineMinHeight : undefined,
|
|
259
|
+
borderRadius: borderRadiusOverride,
|
|
260
|
+
fillOverrides: fillOverrides,
|
|
261
|
+
leading: leading,
|
|
262
|
+
trailing: trailing,
|
|
263
|
+
style: containerStyle,
|
|
264
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
265
|
+
ref: ref,
|
|
266
|
+
style: [styles.input, {
|
|
267
|
+
color: inputTextColor,
|
|
268
|
+
fontSize: sizeTokens.fontSize,
|
|
269
|
+
...fieldText.weightStyle,
|
|
270
|
+
minHeight: multiline ? multilineMinHeight - sizeTokens.paddingVertical * 2 : undefined,
|
|
271
|
+
textAlignVertical: multiline ? 'top' : 'center'
|
|
272
|
+
}, inputStyle],
|
|
273
|
+
placeholder: showFloatingLabel && !shouldFloat ? undefined : placeholder,
|
|
274
|
+
placeholderTextColor: placeholderTextColor,
|
|
275
|
+
value: format && value != null ? format(value) : value,
|
|
276
|
+
onChangeText: text => {
|
|
277
|
+
if (!onChangeText) return;
|
|
278
|
+
onChangeText(parse ? parse(text) : text);
|
|
279
|
+
},
|
|
280
|
+
onFocus: handleFocus,
|
|
281
|
+
onBlur: handleBlur,
|
|
282
|
+
editable: isEditable,
|
|
283
|
+
secureTextEntry: secureTextEntry && !isPasswordVisible,
|
|
284
|
+
multiline: multiline,
|
|
285
|
+
maxLength: maxLength,
|
|
286
|
+
selectionColor: selectionColor,
|
|
287
|
+
accessibilityLabel: a11yLabel,
|
|
288
|
+
accessibilityState: {
|
|
289
|
+
disabled
|
|
290
|
+
},
|
|
291
|
+
testID: testID,
|
|
292
|
+
...rest
|
|
293
|
+
})
|
|
294
|
+
}), showFloatingLabel ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Animated.Text, {
|
|
268
295
|
pointerEvents: "none",
|
|
269
296
|
style: [styles.floatingLabel, {
|
|
270
|
-
top:
|
|
271
|
-
left:
|
|
297
|
+
top: sizeTokens.paddingVertical,
|
|
298
|
+
left: sizeTokens.paddingHorizontal + (leftIcon ? sizeTokens.iconSize + theme.spacing.sm : 0),
|
|
272
299
|
color: labelColor,
|
|
273
|
-
fontSize:
|
|
300
|
+
fontSize: sizeTokens.fontSize,
|
|
274
301
|
...(0, _index.fontFor)(theme, 'medium'),
|
|
275
302
|
backgroundColor: shouldFloat && variant === 'outlined' ? theme.colors.background.primary : 'transparent',
|
|
276
303
|
paddingHorizontal: shouldFloat && variant === 'outlined' ? 4 : 0,
|
|
@@ -286,57 +313,6 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
286
313
|
},
|
|
287
314
|
children: " *"
|
|
288
315
|
}) : null]
|
|
289
|
-
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.TextInput, {
|
|
290
|
-
ref: ref,
|
|
291
|
-
style: [styles.input, {
|
|
292
|
-
color: inputTextColor,
|
|
293
|
-
fontSize: sizeStyles.fontSize,
|
|
294
|
-
paddingVertical: sizeStyles.paddingVertical,
|
|
295
|
-
minHeight: multiline ? sizeStyles.multilineMinHeight : sizeStyles.minHeight,
|
|
296
|
-
textAlignVertical: multiline ? 'top' : 'center'
|
|
297
|
-
}, inputStyle],
|
|
298
|
-
placeholder: showFloatingLabel && !shouldFloat ? undefined : placeholder,
|
|
299
|
-
placeholderTextColor: placeholderTextColor,
|
|
300
|
-
value: format && value != null ? format(value) : value,
|
|
301
|
-
onChangeText: text => {
|
|
302
|
-
if (!onChangeText) return;
|
|
303
|
-
onChangeText(parse ? parse(text) : text);
|
|
304
|
-
},
|
|
305
|
-
onFocus: handleFocus,
|
|
306
|
-
onBlur: handleBlur,
|
|
307
|
-
editable: isEditable,
|
|
308
|
-
secureTextEntry: secureTextEntry && !isPasswordVisible,
|
|
309
|
-
multiline: multiline,
|
|
310
|
-
maxLength: maxLength,
|
|
311
|
-
selectionColor: theme.colors.border.focus,
|
|
312
|
-
accessibilityLabel: a11yLabel,
|
|
313
|
-
accessibilityState: {
|
|
314
|
-
disabled
|
|
315
|
-
},
|
|
316
|
-
testID: testID,
|
|
317
|
-
...rest
|
|
318
|
-
}), showPasswordToggle && secureTextEntry ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Pressable, {
|
|
319
|
-
onPress: togglePasswordVisibility,
|
|
320
|
-
disabled: !isEditable,
|
|
321
|
-
hitSlop: 8,
|
|
322
|
-
accessibilityRole: "button",
|
|
323
|
-
accessibilityLabel: isPasswordVisible ? 'Hide password' : 'Show password',
|
|
324
|
-
style: [styles.rightIconWrap, {
|
|
325
|
-
right: sizeStyles.paddingHorizontal - 2,
|
|
326
|
-
height: multiline ? sizeStyles.multilineMinHeight : sizeStyles.minHeight
|
|
327
|
-
}],
|
|
328
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Feather.default, {
|
|
329
|
-
name: isPasswordVisible ? 'eye-off' : 'eye',
|
|
330
|
-
size: sizeStyles.iconSize,
|
|
331
|
-
color: disabled ? theme.colors.text.disabled : theme.colors.text.secondary
|
|
332
|
-
})
|
|
333
|
-
}) : rightIcon ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
334
|
-
style: [styles.rightIconWrap, {
|
|
335
|
-
right: sizeStyles.paddingHorizontal - 2,
|
|
336
|
-
height: multiline ? sizeStyles.multilineMinHeight : sizeStyles.minHeight
|
|
337
|
-
}],
|
|
338
|
-
pointerEvents: "box-none",
|
|
339
|
-
children: rightIcon
|
|
340
316
|
}) : null]
|
|
341
317
|
}), messageText ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.Text, {
|
|
342
318
|
style: [styles.messageText, {
|
|
@@ -344,7 +320,7 @@ const Input = exports.Input = /*#__PURE__*/(0, _react.forwardRef)((props, ref) =
|
|
|
344
320
|
fontSize: theme.typography.fontSize.xs,
|
|
345
321
|
marginTop: theme.spacing.xxs,
|
|
346
322
|
opacity: messageAnim
|
|
347
|
-
}],
|
|
323
|
+
}, messageStyle],
|
|
348
324
|
accessibilityLiveRegion: hasError ? 'polite' : 'none',
|
|
349
325
|
children: messageText
|
|
350
326
|
}) : null, typeof maxLength === 'number' && typeof value === 'string' ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
@@ -365,9 +341,9 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
365
341
|
staticLabel: {
|
|
366
342
|
includeFontPadding: false
|
|
367
343
|
},
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
344
|
+
// Wraps FieldBase + the absolutely-positioned floating label so the label
|
|
345
|
+
// can sit over the field's top border without being clipped.
|
|
346
|
+
fieldWrapper: {
|
|
371
347
|
position: 'relative',
|
|
372
348
|
overflow: 'visible'
|
|
373
349
|
},
|
|
@@ -381,19 +357,6 @@ const buildStyles = _theme => _reactNative.StyleSheet.create({
|
|
|
381
357
|
position: 'absolute',
|
|
382
358
|
zIndex: 1
|
|
383
359
|
},
|
|
384
|
-
leftIconWrap: {
|
|
385
|
-
position: 'absolute',
|
|
386
|
-
top: 0,
|
|
387
|
-
justifyContent: 'center',
|
|
388
|
-
alignItems: 'center'
|
|
389
|
-
},
|
|
390
|
-
rightIconWrap: {
|
|
391
|
-
position: 'absolute',
|
|
392
|
-
top: 0,
|
|
393
|
-
justifyContent: 'center',
|
|
394
|
-
alignItems: 'center',
|
|
395
|
-
paddingHorizontal: 4
|
|
396
|
-
},
|
|
397
360
|
messageText: {
|
|
398
361
|
includeFontPadding: false
|
|
399
362
|
},
|
|
@@ -79,9 +79,16 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
79
79
|
accessibilityLabel,
|
|
80
80
|
accessibilityHint,
|
|
81
81
|
style,
|
|
82
|
+
containerStyle,
|
|
83
|
+
titleStyle,
|
|
84
|
+
subtitleStyle,
|
|
85
|
+
descriptionStyle,
|
|
86
|
+
leftSlotStyle,
|
|
87
|
+
rightSlotStyle,
|
|
82
88
|
testID
|
|
83
89
|
} = props;
|
|
84
90
|
const theme = (0, _index.useTheme)();
|
|
91
|
+
const pressHaptic = theme.components.listItem?.pressHaptic ?? false;
|
|
85
92
|
const sz = (0, _react.useMemo)(() => sizeFor(theme, size), [theme, size]);
|
|
86
93
|
const styles = (0, _react.useMemo)(() => buildStyles(theme), [theme]);
|
|
87
94
|
const isInteractive = !!onPress && !disabled;
|
|
@@ -94,7 +101,7 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
94
101
|
});
|
|
95
102
|
const handlePress = event => {
|
|
96
103
|
if (!isInteractive) return;
|
|
97
|
-
(0, _hapticUtils.triggerHaptic)('selection');
|
|
104
|
+
if (pressHaptic) (0, _hapticUtils.triggerHaptic)('selection');
|
|
98
105
|
onPress?.(event);
|
|
99
106
|
};
|
|
100
107
|
const a11yLabel = accessibilityLabel ?? title;
|
|
@@ -103,9 +110,9 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
103
110
|
paddingVertical: sz.paddingVertical,
|
|
104
111
|
minHeight: sz.minHeight,
|
|
105
112
|
backgroundColor: selected ? theme.colors.surface.selected : 'transparent'
|
|
106
|
-
}, divider ? styles.divider : null, disabled ? styles.disabled : null],
|
|
113
|
+
}, divider ? styles.divider : null, disabled ? styles.disabled : null, containerStyle],
|
|
107
114
|
children: [left ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
108
|
-
style: styles.leftSlot,
|
|
115
|
+
style: [styles.leftSlot, leftSlotStyle],
|
|
109
116
|
children: left
|
|
110
117
|
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
111
118
|
style: styles.middle,
|
|
@@ -114,26 +121,26 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
114
121
|
fontSize: sz.titleSize,
|
|
115
122
|
...(0, _index.fontFor)(theme, 'medium'),
|
|
116
123
|
color: disabled ? theme.colors.text.disabled : theme.colors.text.primary
|
|
117
|
-
}],
|
|
124
|
+
}, titleStyle],
|
|
118
125
|
numberOfLines: 1,
|
|
119
126
|
children: title ?? ' '
|
|
120
127
|
}), subtitle ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
121
128
|
style: [styles.subtitle, {
|
|
122
129
|
fontSize: sz.subtitleSize,
|
|
123
130
|
color: disabled ? theme.colors.text.disabled : theme.colors.text.secondary
|
|
124
|
-
}],
|
|
131
|
+
}, subtitleStyle],
|
|
125
132
|
numberOfLines: 1,
|
|
126
133
|
children: subtitle
|
|
127
134
|
}) : null, description ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
|
|
128
135
|
style: [styles.description, {
|
|
129
136
|
fontSize: sz.subtitleSize,
|
|
130
137
|
color: disabled ? theme.colors.text.disabled : theme.colors.text.tertiary
|
|
131
|
-
}],
|
|
138
|
+
}, descriptionStyle],
|
|
132
139
|
numberOfLines: 2,
|
|
133
140
|
children: description
|
|
134
141
|
}) : null]
|
|
135
142
|
}), right || chevron ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
136
|
-
style: styles.rightSlot,
|
|
143
|
+
style: [styles.rightSlot, rightSlotStyle],
|
|
137
144
|
children: [right, chevron ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
138
145
|
style: right ? styles.chevronWithRight : null,
|
|
139
146
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Chevron, {
|
|
@@ -194,15 +201,87 @@ const ListItem = exports.ListItem = /*#__PURE__*/(0, _react.forwardRef)((props,
|
|
|
194
201
|
children: rendered
|
|
195
202
|
}) : rendered;
|
|
196
203
|
if (loading) {
|
|
197
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
198
|
-
|
|
199
|
-
mode: "auto",
|
|
200
|
-
children: final
|
|
204
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ListItemSkeleton, {
|
|
205
|
+
...props
|
|
201
206
|
});
|
|
202
207
|
}
|
|
203
208
|
return final;
|
|
204
209
|
});
|
|
205
210
|
ListItem.displayName = 'ListItem';
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Placeholder shape for `<ListItem>`. Mirrors the row anatomy: optional
|
|
214
|
+
* leading slot (avatar/icon), title + subtitle/description stack, optional
|
|
215
|
+
* trailing chevron. Heights respect the configured `size`.
|
|
216
|
+
*/
|
|
217
|
+
const ListItemSkeleton = ({
|
|
218
|
+
subtitle,
|
|
219
|
+
description,
|
|
220
|
+
left,
|
|
221
|
+
right,
|
|
222
|
+
chevron,
|
|
223
|
+
size = 'md',
|
|
224
|
+
containerStyle,
|
|
225
|
+
style
|
|
226
|
+
}) => {
|
|
227
|
+
const theme = (0, _index.useTheme)();
|
|
228
|
+
const sz = sizeFor(theme, size);
|
|
229
|
+
const titleHeight = Math.round(sz.titleSize * 1.15);
|
|
230
|
+
const subtitleHeight = Math.round(sz.subtitleSize * 1.15);
|
|
231
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
232
|
+
style: [{
|
|
233
|
+
flexDirection: 'row',
|
|
234
|
+
alignItems: 'center',
|
|
235
|
+
paddingHorizontal: theme.spacing.md,
|
|
236
|
+
paddingVertical: sz.paddingVertical,
|
|
237
|
+
minHeight: sz.minHeight
|
|
238
|
+
}, containerStyle, style],
|
|
239
|
+
children: [left !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
240
|
+
style: {
|
|
241
|
+
marginRight: theme.spacing.sm
|
|
242
|
+
},
|
|
243
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Skeleton, {
|
|
244
|
+
shape: "circle",
|
|
245
|
+
width: 40,
|
|
246
|
+
height: 40
|
|
247
|
+
})
|
|
248
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
|
|
249
|
+
style: {
|
|
250
|
+
flex: 1
|
|
251
|
+
},
|
|
252
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Skeleton, {
|
|
253
|
+
shape: "text",
|
|
254
|
+
width: "70%",
|
|
255
|
+
height: titleHeight,
|
|
256
|
+
style: {
|
|
257
|
+
marginBottom: theme.spacing.xs
|
|
258
|
+
}
|
|
259
|
+
}), subtitle !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Skeleton, {
|
|
260
|
+
shape: "text",
|
|
261
|
+
width: "50%",
|
|
262
|
+
height: subtitleHeight,
|
|
263
|
+
style: description !== undefined ? {
|
|
264
|
+
marginBottom: theme.spacing.xs
|
|
265
|
+
} : undefined
|
|
266
|
+
}) : null, description !== undefined ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Skeleton, {
|
|
267
|
+
shape: "text",
|
|
268
|
+
width: "85%",
|
|
269
|
+
height: subtitleHeight
|
|
270
|
+
}) : null]
|
|
271
|
+
}), right !== undefined || chevron ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
|
|
272
|
+
style: {
|
|
273
|
+
marginLeft: theme.spacing.sm
|
|
274
|
+
},
|
|
275
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index3.Skeleton, {
|
|
276
|
+
width: 20,
|
|
277
|
+
height: 20,
|
|
278
|
+
radius: "sm"
|
|
279
|
+
})
|
|
280
|
+
}) : null]
|
|
281
|
+
});
|
|
282
|
+
};
|
|
283
|
+
ListItemSkeleton.displayName = 'ListItemSkeleton';
|
|
284
|
+
ListItem.Skeleton = ListItemSkeleton;
|
|
206
285
|
const buildStyles = theme => _reactNative.StyleSheet.create({
|
|
207
286
|
row: {
|
|
208
287
|
flexDirection: 'row',
|