dhre-ui-kit 0.0.190 → 0.0.192
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/index.d.ts +6 -1
- package/lib/index.js +63 -4
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +63 -4
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.mjs
CHANGED
|
@@ -3385,7 +3385,9 @@ const CustomDropdown = (props) => {
|
|
|
3385
3385
|
onValueChange,
|
|
3386
3386
|
itemContainerStyle,
|
|
3387
3387
|
menuContainerStyle,
|
|
3388
|
-
activeColor
|
|
3388
|
+
activeColor,
|
|
3389
|
+
keepPlaceholderOnFocus = false,
|
|
3390
|
+
selectedItemTextStyle
|
|
3389
3391
|
} = props;
|
|
3390
3392
|
const [value, setValue] = useState(defaultValue);
|
|
3391
3393
|
const [isFocus, setIsFocus] = useState(false);
|
|
@@ -3413,6 +3415,22 @@ const CustomDropdown = (props) => {
|
|
|
3413
3415
|
onValueChange(newValue);
|
|
3414
3416
|
}
|
|
3415
3417
|
};
|
|
3418
|
+
const renderItem = (item) => {
|
|
3419
|
+
const isSelected = item[valueField] === value;
|
|
3420
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles$7.itemContainer, itemContainerStyle] }, /* @__PURE__ */ React.createElement(
|
|
3421
|
+
Text,
|
|
3422
|
+
{
|
|
3423
|
+
style: [
|
|
3424
|
+
styles$7.itemText,
|
|
3425
|
+
itemTextStyle,
|
|
3426
|
+
// Apply itemTextStyle to all items
|
|
3427
|
+
isSelected && selectedItemTextStyle
|
|
3428
|
+
// Apply selectedItemTextStyle to the selected item
|
|
3429
|
+
]
|
|
3430
|
+
},
|
|
3431
|
+
item[labelField]
|
|
3432
|
+
));
|
|
3433
|
+
};
|
|
3416
3434
|
return /* @__PURE__ */ React.createElement(View, { style: [styles$7.container, containerStyle] }, label && renderLabel(), /* @__PURE__ */ React.createElement(
|
|
3417
3435
|
Dropdown,
|
|
3418
3436
|
{
|
|
@@ -3428,13 +3446,14 @@ const CustomDropdown = (props) => {
|
|
|
3428
3446
|
data: data ?? [],
|
|
3429
3447
|
labelField,
|
|
3430
3448
|
valueField,
|
|
3431
|
-
placeholder: !isFocus ? placeholder : "",
|
|
3449
|
+
placeholder: keepPlaceholderOnFocus || !isFocus ? placeholder : "",
|
|
3432
3450
|
value,
|
|
3433
3451
|
onFocus: () => setIsFocus(true),
|
|
3434
3452
|
onBlur: () => setIsFocus(false),
|
|
3435
3453
|
onChange: handleValueChange,
|
|
3436
3454
|
iconColor,
|
|
3437
3455
|
dropdownPosition: "bottom",
|
|
3456
|
+
renderItem,
|
|
3438
3457
|
itemTextStyle,
|
|
3439
3458
|
containerStyle: menuContainerStyle,
|
|
3440
3459
|
activeColor,
|
|
@@ -3477,6 +3496,13 @@ const styles$7 = StyleSheet.create({
|
|
|
3477
3496
|
},
|
|
3478
3497
|
itemListStyle: {
|
|
3479
3498
|
maxHeight: verticalScale(150)
|
|
3499
|
+
},
|
|
3500
|
+
itemContainer: {
|
|
3501
|
+
paddingVertical: verticalScale(8),
|
|
3502
|
+
paddingHorizontal: horizontalScale(12)
|
|
3503
|
+
},
|
|
3504
|
+
itemText: {
|
|
3505
|
+
fontSize: verticalScale(14)
|
|
3480
3506
|
}
|
|
3481
3507
|
});
|
|
3482
3508
|
|
|
@@ -3859,6 +3885,11 @@ const OTPInput = React.forwardRef(
|
|
|
3859
3885
|
React.useImperativeHandle(ref, () => ({
|
|
3860
3886
|
reset() {
|
|
3861
3887
|
setOTP("");
|
|
3888
|
+
refs.current[0]?.focus();
|
|
3889
|
+
},
|
|
3890
|
+
set(newOtp) {
|
|
3891
|
+
setOTP(newOtp);
|
|
3892
|
+
refs.current[newOtp?.length - 1]?.focus();
|
|
3862
3893
|
}
|
|
3863
3894
|
}));
|
|
3864
3895
|
const handleChange = (index, value) => {
|
|
@@ -3871,6 +3902,9 @@ const OTPInput = React.forwardRef(
|
|
|
3871
3902
|
const newOTP = otp.slice(0, -1);
|
|
3872
3903
|
setOTP(newOTP);
|
|
3873
3904
|
refs.current[index - 1]?.focus();
|
|
3905
|
+
} else if (value?.length === length) {
|
|
3906
|
+
setOTP(value);
|
|
3907
|
+
refs.current[length - 1]?.focus();
|
|
3874
3908
|
} else {
|
|
3875
3909
|
const newOTP = otp.slice(0, -1);
|
|
3876
3910
|
setOTP(newOTP);
|
|
@@ -3917,6 +3951,9 @@ const OTPInput = React.forwardRef(
|
|
|
3917
3951
|
keyboardType: "numeric",
|
|
3918
3952
|
ref: (el) => refs.current[index] = el,
|
|
3919
3953
|
returnKeyType: otp.length === length ? "done" : "next",
|
|
3954
|
+
importantForAutofill: "yes",
|
|
3955
|
+
textContentType: "oneTimeCode",
|
|
3956
|
+
autoComplete: "sms-otp",
|
|
3920
3957
|
selectionColor: theme$1.CONTENT_PRIMARY
|
|
3921
3958
|
}
|
|
3922
3959
|
))), /* @__PURE__ */ React.createElement(
|
|
@@ -4159,11 +4196,17 @@ const CustomSlideButton = ({
|
|
|
4159
4196
|
textStyle,
|
|
4160
4197
|
containerStyle,
|
|
4161
4198
|
sliderStyle,
|
|
4162
|
-
size = BUTTON_WIDTH
|
|
4199
|
+
size = BUTTON_WIDTH,
|
|
4200
|
+
slideButtonTail,
|
|
4201
|
+
slideButtonTailColor = "#fff"
|
|
4163
4202
|
}) => {
|
|
4164
4203
|
const value = useRef(0);
|
|
4165
4204
|
const cardRef = useRef(null);
|
|
4166
4205
|
const pan = useRef(new Animated.Value(0)).current;
|
|
4206
|
+
const slideTailCardRef = useRef(null);
|
|
4207
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4208
|
+
style: { width: 0 }
|
|
4209
|
+
});
|
|
4167
4210
|
const handleLayout = (event) => {
|
|
4168
4211
|
const { width } = event.nativeEvent.layout;
|
|
4169
4212
|
if (cardRef.current) {
|
|
@@ -4184,6 +4227,9 @@ const CustomSlideButton = ({
|
|
|
4184
4227
|
onPanResponderMove: (evt, gestureState) => {
|
|
4185
4228
|
if (gestureState.dx < value.current - BUTTON_WIDTH) {
|
|
4186
4229
|
pan.setValue(gestureState.dx);
|
|
4230
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4231
|
+
style: { width: gestureState.dx + BUTTON_WIDTH / 2 }
|
|
4232
|
+
});
|
|
4187
4233
|
}
|
|
4188
4234
|
},
|
|
4189
4235
|
onPanResponderRelease: (evt, gestureState) => {
|
|
@@ -4193,11 +4239,18 @@ const CustomSlideButton = ({
|
|
|
4193
4239
|
toValue: value.current - BUTTON_WIDTH - 10,
|
|
4194
4240
|
useNativeDriver: false
|
|
4195
4241
|
}).start();
|
|
4242
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4243
|
+
style: { width: value.current + BUTTON_WIDTH }
|
|
4244
|
+
// Change the width here
|
|
4245
|
+
});
|
|
4196
4246
|
} else {
|
|
4197
4247
|
Animated.spring(pan, {
|
|
4198
4248
|
toValue: 0,
|
|
4199
4249
|
useNativeDriver: false
|
|
4200
4250
|
}).start();
|
|
4251
|
+
slideTailCardRef?.current?.setNativeProps({
|
|
4252
|
+
style: { width: 0 }
|
|
4253
|
+
});
|
|
4201
4254
|
}
|
|
4202
4255
|
}
|
|
4203
4256
|
})
|
|
@@ -4207,7 +4260,13 @@ const CustomSlideButton = ({
|
|
|
4207
4260
|
...styles$2.sliderContainer,
|
|
4208
4261
|
backgroundColor: theme.SURFACE_INVERTED,
|
|
4209
4262
|
...containerStyle
|
|
4210
|
-
}, onLayout: handleLayout, ref: cardRef },
|
|
4263
|
+
}, onLayout: handleLayout, ref: cardRef }, slideButtonTail && /* @__PURE__ */ React.createElement(
|
|
4264
|
+
Animated.View,
|
|
4265
|
+
{
|
|
4266
|
+
ref: slideTailCardRef,
|
|
4267
|
+
style: [{ height: "100%", backgroundColor: slideButtonTailColor }]
|
|
4268
|
+
}
|
|
4269
|
+
), /* @__PURE__ */ React.createElement(View, { style: styles$2.buttonTextContainer }, /* @__PURE__ */ React.createElement(
|
|
4211
4270
|
CustomTypography,
|
|
4212
4271
|
{
|
|
4213
4272
|
text: label,
|