dhre-ui-kit 2.0.17 → 2.0.18
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.js +40 -34
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +42 -36
- package/lib/index.mjs.map +1 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -8674,6 +8674,30 @@ const styles$i = reactNative.StyleSheet.create({
|
|
|
8674
8674
|
seperator: { height: 1 }
|
|
8675
8675
|
});
|
|
8676
8676
|
|
|
8677
|
+
const ActionButton = ({
|
|
8678
|
+
icon,
|
|
8679
|
+
title,
|
|
8680
|
+
onPress,
|
|
8681
|
+
style,
|
|
8682
|
+
testID,
|
|
8683
|
+
titleStyle
|
|
8684
|
+
}) => /* @__PURE__ */ React__default["default"].createElement(
|
|
8685
|
+
reactNative.Pressable,
|
|
8686
|
+
{
|
|
8687
|
+
testID,
|
|
8688
|
+
onPress,
|
|
8689
|
+
style: [styles$i.actionButton, style]
|
|
8690
|
+
},
|
|
8691
|
+
icon,
|
|
8692
|
+
/* @__PURE__ */ React__default["default"].createElement(
|
|
8693
|
+
CustomTypography,
|
|
8694
|
+
{
|
|
8695
|
+
variant: "L1_REGULAR",
|
|
8696
|
+
style: [styles$i.titleStyle, titleStyle],
|
|
8697
|
+
text: title
|
|
8698
|
+
}
|
|
8699
|
+
)
|
|
8700
|
+
);
|
|
8677
8701
|
const SwipableList = (props) => {
|
|
8678
8702
|
const {
|
|
8679
8703
|
data,
|
|
@@ -8699,38 +8723,17 @@ const SwipableList = (props) => {
|
|
|
8699
8723
|
const { theme } = useTheme();
|
|
8700
8724
|
const [currentOpenId, setCurrentOpenId] = React.useState(null);
|
|
8701
8725
|
const swipeableRefs = React.useRef({});
|
|
8702
|
-
const closeSwipeable = (id) => {
|
|
8726
|
+
const closeSwipeable = React.useCallback((id) => {
|
|
8703
8727
|
swipeableRefs.current[id]?.close();
|
|
8704
|
-
};
|
|
8705
|
-
const handleSwipeStart = (id) => {
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
setCurrentOpenId(id);
|
|
8710
|
-
};
|
|
8711
|
-
const ActionButton = ({
|
|
8712
|
-
icon,
|
|
8713
|
-
title,
|
|
8714
|
-
onPress,
|
|
8715
|
-
style,
|
|
8716
|
-
testID
|
|
8717
|
-
}) => /* @__PURE__ */ React__default["default"].createElement(
|
|
8718
|
-
reactNative.Pressable,
|
|
8719
|
-
{
|
|
8720
|
-
testID,
|
|
8721
|
-
onPress,
|
|
8722
|
-
style: [styles$i.actionButton, style]
|
|
8723
|
-
},
|
|
8724
|
-
icon,
|
|
8725
|
-
/* @__PURE__ */ React__default["default"].createElement(
|
|
8726
|
-
CustomTypography,
|
|
8727
|
-
{
|
|
8728
|
-
variant: "L1_REGULAR",
|
|
8729
|
-
style: [styles$i.titleStyle, titleStyle],
|
|
8730
|
-
text: title
|
|
8728
|
+
}, []);
|
|
8729
|
+
const handleSwipeStart = React.useCallback((id) => {
|
|
8730
|
+
setCurrentOpenId((prev) => {
|
|
8731
|
+
if (prev && prev !== id) {
|
|
8732
|
+
swipeableRefs.current[prev]?.close();
|
|
8731
8733
|
}
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
+
return id;
|
|
8735
|
+
});
|
|
8736
|
+
}, []);
|
|
8734
8737
|
const leftActionHandle = (item, leftPrimaryActionIcon, leftPrimaryActionTitle, leftSecondaryActionIcon, leftSecondaryActionTitle) => /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: styles$i.actionBtn }, leftPrimaryActionIcon && /* @__PURE__ */ React__default["default"].createElement(
|
|
8735
8738
|
ActionButton,
|
|
8736
8739
|
{
|
|
@@ -8741,7 +8744,8 @@ const SwipableList = (props) => {
|
|
|
8741
8744
|
closeSwipeable(item.id);
|
|
8742
8745
|
},
|
|
8743
8746
|
style: leftPrimaryActionStyle,
|
|
8744
|
-
testID: `${testId}-LEFT-PRIMARY-${item.id}
|
|
8747
|
+
testID: `${testId}-LEFT-PRIMARY-${item.id}`,
|
|
8748
|
+
titleStyle
|
|
8745
8749
|
}
|
|
8746
8750
|
), leftSecondaryActionIcon && /* @__PURE__ */ React__default["default"].createElement(
|
|
8747
8751
|
ActionButton,
|
|
@@ -8753,7 +8757,8 @@ const SwipableList = (props) => {
|
|
|
8753
8757
|
closeSwipeable(item.id);
|
|
8754
8758
|
},
|
|
8755
8759
|
style: leftSecondaryActionStyle,
|
|
8756
|
-
testID: `${testId}-LEFT-SECONDARY-${item.id}
|
|
8760
|
+
testID: `${testId}-LEFT-SECONDARY-${item.id}`,
|
|
8761
|
+
titleStyle
|
|
8757
8762
|
}
|
|
8758
8763
|
));
|
|
8759
8764
|
const rightActionHandle = (item) => /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { style: [styles$i.actionBtn, rightPrimaryActionStyle] }, rightPrimaryActionIcon && /* @__PURE__ */ React__default["default"].createElement(
|
|
@@ -8766,10 +8771,11 @@ const SwipableList = (props) => {
|
|
|
8766
8771
|
closeSwipeable(item.id);
|
|
8767
8772
|
},
|
|
8768
8773
|
style: rightPrimaryActionStyle,
|
|
8769
|
-
testID: `${testId}-RIGHT-PRIMARY-${item.id}
|
|
8774
|
+
testID: `${testId}-RIGHT-PRIMARY-${item.id}`,
|
|
8775
|
+
titleStyle
|
|
8770
8776
|
}
|
|
8771
8777
|
));
|
|
8772
|
-
const renderItem = ({ item }) => /* @__PURE__ */ React__default["default"].createElement(
|
|
8778
|
+
const renderItem = ({ item }) => /* @__PURE__ */ React__default["default"].createElement(reactNative.View, { testID: `${testId}-LIST`, style: styles$i.container }, /* @__PURE__ */ React__default["default"].createElement(
|
|
8773
8779
|
reactNativeGestureHandler.Swipeable,
|
|
8774
8780
|
{
|
|
8775
8781
|
ref: (ref) => swipeableRefs.current[item.id] = ref,
|