dhre-ui-kit 0.0.190 → 0.0.191
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 +2 -0
- package/lib/index.js +28 -2
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +28 -2
- 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
|
|