@hero-design/rn 8.3.4 → 8.5.0-alpha.0

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.
Files changed (36) hide show
  1. package/.turbo/turbo-build.log +66 -9
  2. package/assets/fonts/hero-icons-mobile.ttf +0 -0
  3. package/es/index.js +473 -133
  4. package/lib/index.js +473 -133
  5. package/package.json +5 -7
  6. package/rollup.config.js +0 -1
  7. package/src/components/Carousel/CarouselItem.tsx +3 -1
  8. package/src/components/Carousel/StyledCarousel.tsx +2 -0
  9. package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +18 -15
  10. package/src/components/Icon/HeroIcon/glyphMap.json +1 -1
  11. package/src/components/Icon/IconList.ts +9 -0
  12. package/src/components/List/ListItem.tsx +1 -5
  13. package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +8 -8
  14. package/src/components/Select/BaseOptionList.tsx +5 -12
  15. package/src/components/Select/MultiSelect/OptionList.tsx +6 -6
  16. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +3 -0
  17. package/src/components/Select/MultiSelect/index.tsx +9 -0
  18. package/src/components/Select/SingleSelect/OptionList.tsx +5 -3
  19. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +24 -4
  20. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +21 -3
  21. package/src/components/Select/SingleSelect/index.tsx +8 -0
  22. package/src/components/Swipeable/Buttons.tsx +65 -0
  23. package/src/components/Swipeable/StyledSwipeable.tsx +14 -2
  24. package/src/components/Swipeable/SwipeableAction.tsx +15 -7
  25. package/src/components/Swipeable/index.tsx +531 -136
  26. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +1 -1
  27. package/src/theme/components/carousel.ts +1 -1
  28. package/types/components/Calendar/helpers.d.ts +2 -2
  29. package/types/components/Select/helpers.d.ts +1 -1
  30. package/types/components/Swipeable/Buttons.d.ts +15 -0
  31. package/types/components/Swipeable/StyledSwipeable.d.ts +15 -2
  32. package/types/components/Swipeable/SwipeableAction.d.ts +10 -6
  33. package/types/components/Swipeable/index.d.ts +24 -41
  34. package/types/components/Toolbar/index.d.ts +2 -3
  35. package/types/testHelpers/renderWithTheme.d.ts +1 -1
  36. package/.turbo/turbo-publish:npm.log +0 -0
package/lib/index.js CHANGED
@@ -8,7 +8,6 @@ var reactNativeVectorIcons = require('react-native-vector-icons');
8
8
  var reactNativeSafeAreaContext = require('react-native-safe-area-context');
9
9
  var DateTimePicker = require('@react-native-community/datetimepicker');
10
10
  var RnSlider = require('@react-native-community/slider');
11
- var reactNativeGestureHandler = require('react-native-gesture-handler');
12
11
  var PagerView = require('react-native-pager-view');
13
12
  var events = require('events');
14
13
  var reactNativeWebview = require('react-native-webview');
@@ -5636,7 +5635,7 @@ var index$a = components.reduce(function (acc, comp) {
5636
5635
  });
5637
5636
  }, styled);
5638
5637
 
5639
- var StyledWrapper$b = index$a(reactNative.Animated.View)(function () {
5638
+ var StyledWrapper$c = index$a(reactNative.Animated.View)(function () {
5640
5639
  return {
5641
5640
  margin: 0,
5642
5641
  padding: 0,
@@ -5710,7 +5709,7 @@ var Collapse = function Collapse(_ref) {
5710
5709
  var height = _ref2.height;
5711
5710
  setContentHeight(height);
5712
5711
  }, []);
5713
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$b, {
5712
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$c, {
5714
5713
  style: {
5715
5714
  height: collapseAnim
5716
5715
  },
@@ -5723,7 +5722,7 @@ var Collapse = function Collapse(_ref) {
5723
5722
  }, children)));
5724
5723
  };
5725
5724
 
5726
- var StyledWrapper$a = index$a(reactNative.View)(function () {
5725
+ var StyledWrapper$b = index$a(reactNative.View)(function () {
5727
5726
  return {};
5728
5727
  });
5729
5728
  var StyledItemWrapper = index$a(reactNative.View)(function (_ref) {
@@ -5776,7 +5775,7 @@ var StyledText$3 = index$a(reactNative.Text)(function (_ref) {
5776
5775
  });
5777
5776
  });
5778
5777
 
5779
- var _excluded$m = ["children", "fontSize", "fontWeight", "intent", "typeface"];
5778
+ var _excluded$l = ["children", "fontSize", "fontWeight", "intent", "typeface"];
5780
5779
  var Text = function Text(_ref) {
5781
5780
  var children = _ref.children,
5782
5781
  _ref$fontSize = _ref.fontSize,
@@ -5787,7 +5786,7 @@ var Text = function Text(_ref) {
5787
5786
  intent = _ref$intent === void 0 ? 'body' : _ref$intent,
5788
5787
  _ref$typeface = _ref.typeface,
5789
5788
  typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
5790
- nativeProps = _objectWithoutProperties(_ref, _excluded$m);
5789
+ nativeProps = _objectWithoutProperties(_ref, _excluded$l);
5791
5790
  return /*#__PURE__*/React__default["default"].createElement(StyledText$3, _extends$1({}, nativeProps, {
5792
5791
  themeFontSize: fontSize,
5793
5792
  themeFontWeight: fontWeight,
@@ -6266,10 +6265,10 @@ var StyledHeroIcon = index$a(HeroIcon)(function (_ref) {
6266
6265
  };
6267
6266
  });
6268
6267
 
6269
- var _excluded$l = ["style"];
6268
+ var _excluded$k = ["style"];
6270
6269
  var AnimatedIcon = function AnimatedIcon(_ref) {
6271
6270
  var style = _ref.style,
6272
- otherProps = _objectWithoutProperties(_ref, _excluded$l);
6271
+ otherProps = _objectWithoutProperties(_ref, _excluded$k);
6273
6272
  var rotateAnimation = React.useRef(new reactNative.Animated.Value(0));
6274
6273
  React.useEffect(function () {
6275
6274
  var animation = reactNative.Animated.loop(reactNative.Animated.timing(rotateAnimation.current, {
@@ -6375,7 +6374,7 @@ var AccordionItem = function AccordionItem(_ref) {
6375
6374
  }, content));
6376
6375
  };
6377
6376
 
6378
- var _excluded$k = ["key"];
6377
+ var _excluded$j = ["key"];
6379
6378
  var Accordion = function Accordion(_ref) {
6380
6379
  var items = _ref.items,
6381
6380
  activeItemKey = _ref.activeItemKey,
@@ -6391,12 +6390,12 @@ var Accordion = function Accordion(_ref) {
6391
6390
  _usePropsOrInternalSt2 = _slicedToArray(_usePropsOrInternalSt, 2),
6392
6391
  _activeItemKey = _usePropsOrInternalSt2[0],
6393
6392
  _onItemPress = _usePropsOrInternalSt2[1];
6394
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$a, {
6393
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$b, {
6395
6394
  style: style,
6396
6395
  testID: testID
6397
6396
  }, items.map(function (_ref2, index) {
6398
6397
  var key = _ref2.key,
6399
- props = _objectWithoutProperties(_ref2, _excluded$k);
6398
+ props = _objectWithoutProperties(_ref2, _excluded$j);
6400
6399
  var open = _activeItemKey === key;
6401
6400
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, {
6402
6401
  key: key
@@ -6578,7 +6577,7 @@ var Attachment = function Attachment(_ref) {
6578
6577
  })) : null);
6579
6578
  };
6580
6579
 
6581
- var StyledWrapper$9 = index$a(reactNative.TouchableOpacity)(function (_ref) {
6580
+ var StyledWrapper$a = index$a(reactNative.TouchableOpacity)(function (_ref) {
6582
6581
  var themeSize = _ref.themeSize,
6583
6582
  themeIntent = _ref.themeIntent,
6584
6583
  theme = _ref.theme;
@@ -6633,7 +6632,7 @@ var Avatar = function Avatar(_ref) {
6633
6632
  hasImageError = _useState2[0],
6634
6633
  setHasImageError = _useState2[1];
6635
6634
  if (title === undefined && source === undefined) return null;
6636
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$9, {
6635
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$a, {
6637
6636
  testID: testID,
6638
6637
  onPress: onPress,
6639
6638
  disabled: onPress === undefined,
@@ -6657,7 +6656,7 @@ var Avatar = function Avatar(_ref) {
6657
6656
  };
6658
6657
 
6659
6658
  var VISIBLE_RATIO = 0.7;
6660
- var StyledWrapper$8 = index$a(reactNative.View)(function (_ref) {
6659
+ var StyledWrapper$9 = index$a(reactNative.View)(function (_ref) {
6661
6660
  var theme = _ref.theme,
6662
6661
  themeSize = _ref.themeSize,
6663
6662
  themeAvatarCount = _ref.themeAvatarCount;
@@ -6719,7 +6718,7 @@ var AvatarStack = function AvatarStack(_ref) {
6719
6718
  });
6720
6719
  avatars.push(remainingAvatar);
6721
6720
  }
6722
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$8, {
6721
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$9, {
6723
6722
  themeSize: size,
6724
6723
  themeAvatarCount: avatars.length,
6725
6724
  style: style,
@@ -6778,7 +6777,7 @@ var StyledStatus = index$a(reactNative.Animated.View)(function (_ref3) {
6778
6777
  };
6779
6778
  });
6780
6779
 
6781
- var _excluded$j = ["children", "visible", "intent", "style", "testID"];
6780
+ var _excluded$i = ["children", "visible", "intent", "style", "testID"];
6782
6781
  var Status = function Status(_ref) {
6783
6782
  var children = _ref.children,
6784
6783
  _ref$visible = _ref.visible,
@@ -6787,7 +6786,7 @@ var Status = function Status(_ref) {
6787
6786
  intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
6788
6787
  style = _ref.style,
6789
6788
  testID = _ref.testID,
6790
- nativeProps = _objectWithoutProperties(_ref, _excluded$j);
6789
+ nativeProps = _objectWithoutProperties(_ref, _excluded$i);
6791
6790
  var _React$useRef = React__default["default"].useRef(new reactNative.Animated.Value(visible ? 1 : 0)),
6792
6791
  opacity = _React$useRef.current;
6793
6792
  var isFirstRendering = React__default["default"].useRef(true);
@@ -6820,7 +6819,7 @@ var Status = function Status(_ref) {
6820
6819
  }));
6821
6820
  };
6822
6821
 
6823
- var _excluded$i = ["content", "visible", "max", "intent", "style", "testID"];
6822
+ var _excluded$h = ["content", "visible", "max", "intent", "style", "testID"];
6824
6823
  var DEFAULT_MAX_NUMBER = 99;
6825
6824
  var getPaddingState = function getPaddingState(content) {
6826
6825
  return content.length > 1 ? 'wideContent' : 'narrowContent';
@@ -6835,7 +6834,7 @@ var Badge = function Badge(_ref) {
6835
6834
  intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
6836
6835
  style = _ref.style,
6837
6836
  testID = _ref.testID,
6838
- nativeProps = _objectWithoutProperties(_ref, _excluded$i);
6837
+ nativeProps = _objectWithoutProperties(_ref, _excluded$h);
6839
6838
  var _React$useRef = React__default["default"].useRef(new reactNative.Animated.Value(visible ? 1 : 0)),
6840
6839
  opacity = _React$useRef.current;
6841
6840
  var isFirstRendering = React__default["default"].useRef(true);
@@ -6939,7 +6938,7 @@ function omit(keys, obj) {
6939
6938
  return result;
6940
6939
  }
6941
6940
 
6942
- var _excluded$h = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
6941
+ var _excluded$g = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
6943
6942
  var getInactiveIcon = function getInactiveIcon(icon) {
6944
6943
  var inactiveIcon = "".concat(icon, "-outlined");
6945
6944
  return isHeroIcon(inactiveIcon) ? inactiveIcon : icon;
@@ -6950,7 +6949,7 @@ var BottomNavigation = function BottomNavigation(_ref) {
6950
6949
  renderActiveTabOnly = _ref$renderActiveTabO === void 0 ? false : _ref$renderActiveTabO,
6951
6950
  selectedTabKey = _ref.selectedTabKey,
6952
6951
  tabs = _ref.tabs,
6953
- nativeProps = _objectWithoutProperties(_ref, _excluded$h);
6952
+ nativeProps = _objectWithoutProperties(_ref, _excluded$g);
6954
6953
  var insets = reactNativeSafeAreaContext.useSafeAreaInsets();
6955
6954
  /**
6956
6955
  * List of loaded tabs, tabs will be loaded when navigated to.
@@ -7037,13 +7036,13 @@ var StyledDivider = index$a(reactNative.View)(function (_ref) {
7037
7036
  }, horizontalMargin), verticalMargin);
7038
7037
  });
7039
7038
 
7040
- var _excluded$g = ["marginHorizontal", "marginVertical", "style", "testID"];
7039
+ var _excluded$f = ["marginHorizontal", "marginVertical", "style", "testID"];
7041
7040
  var Divider = function Divider(_ref) {
7042
7041
  var marginHorizontal = _ref.marginHorizontal,
7043
7042
  marginVertical = _ref.marginVertical,
7044
7043
  style = _ref.style,
7045
7044
  testID = _ref.testID,
7046
- nativeProps = _objectWithoutProperties(_ref, _excluded$g);
7045
+ nativeProps = _objectWithoutProperties(_ref, _excluded$f);
7047
7046
  return /*#__PURE__*/React__default["default"].createElement(StyledDivider, _extends$1({}, nativeProps, {
7048
7047
  themeMarginHorizontal: marginHorizontal,
7049
7048
  themeMarginVertical: marginVertical,
@@ -7054,7 +7053,7 @@ var Divider = function Divider(_ref) {
7054
7053
 
7055
7054
  var AnimatedPressable$1 = reactNative.Animated.createAnimatedComponent(reactNative.Pressable);
7056
7055
  var AnimatedSafeAreaView = reactNative.Animated.createAnimatedComponent(reactNative.SafeAreaView);
7057
- var StyledWrapper$7 = index$a(reactNative.View)(_objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
7056
+ var StyledWrapper$8 = index$a(reactNative.View)(_objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
7058
7057
  flexDirection: 'column-reverse'
7059
7058
  }));
7060
7059
  var StyledKeyboardAvoidingView = index$a(reactNative.KeyboardAvoidingView)(function () {
@@ -7173,7 +7172,7 @@ var StyledLoadingDot = index$a(reactNative.View)(function (_ref2) {
7173
7172
  }, themeStyling());
7174
7173
  });
7175
7174
 
7176
- var _excluded$f = ["count", "size", "testID", "themeVariant"];
7175
+ var _excluded$e = ["count", "size", "testID", "themeVariant"];
7177
7176
  var AnimatedLoadingIndicatorWrapper = reactNative.Animated.createAnimatedComponent(StyledLoadingIndicatorWrapper);
7178
7177
  var AnimatedLoadingDot = reactNative.Animated.createAnimatedComponent(StyledLoadingDot);
7179
7178
  var renderDotComponent = function renderDotComponent(_ref) {
@@ -7205,7 +7204,7 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
7205
7204
  size = _ref2$size === void 0 ? 12 : _ref2$size,
7206
7205
  testID = _ref2.testID,
7207
7206
  themeVariant = _ref2.themeVariant,
7208
- nativeProps = _objectWithoutProperties(_ref2, _excluded$f);
7207
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$e);
7209
7208
  var progressAnimation = React.useRef(new reactNative.Animated.Value(0));
7210
7209
  React.useEffect(function () {
7211
7210
  var animation = reactNative.Animated.loop(reactNative.Animated.timing(progressAnimation.current, {
@@ -7601,11 +7600,11 @@ var Header = function Header(_ref) {
7601
7600
  })) : null), showDivider ? /*#__PURE__*/React__default["default"].createElement(Divider, null) : null);
7602
7601
  };
7603
7602
 
7604
- var _excluded$e = ["scrollEventThrottle"];
7603
+ var _excluded$d = ["scrollEventThrottle"];
7605
7604
  var BottomSheetScrollView = function BottomSheetScrollView(_ref) {
7606
7605
  var _ref$scrollEventThrot = _ref.scrollEventThrottle,
7607
7606
  scrollEventThrottle = _ref$scrollEventThrot === void 0 ? 100 : _ref$scrollEventThrot,
7608
- props = _objectWithoutProperties(_ref, _excluded$e);
7607
+ props = _objectWithoutProperties(_ref, _excluded$d);
7609
7608
  var _useContext = React.useContext(BottomSheetContext),
7610
7609
  setInternalShowDivider = _useContext.setInternalShowDivider;
7611
7610
  var onScrollBeginDrag = React.useCallback(function (e) {
@@ -7713,7 +7712,7 @@ var BottomSheet = function BottomSheet(_ref) {
7713
7712
  transparent: true,
7714
7713
  testID: testID,
7715
7714
  onShow: onOpen
7716
- }, /*#__PURE__*/React__default["default"].createElement(StyledWrapper$7, {
7715
+ }, /*#__PURE__*/React__default["default"].createElement(StyledWrapper$8, {
7717
7716
  pointerEvents: "box-none"
7718
7717
  }, /*#__PURE__*/React__default["default"].createElement(StyledKeyboardAvoidingView, _extends$1({
7719
7718
  behavior: reactNative.Platform.OS === 'ios' ? 'padding' : 'height'
@@ -7920,7 +7919,7 @@ var borderWidths = {
7920
7919
  var config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, colors), space), radii), borderWidths);
7921
7920
  var flexPropsKey = ['alignContent', 'alignItems', 'alignSelf', 'display', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent'];
7922
7921
 
7923
- var _excluded$d = ["theme"];
7922
+ var _excluded$c = ["theme"];
7924
7923
  var getThemeValue = function getThemeValue(theme, key, props) {
7925
7924
  var propConfig = config[key];
7926
7925
  var propValue = props[key];
@@ -7947,18 +7946,18 @@ var mapStylePropToThemeValue = function mapStylePropToThemeValue(theme, props) {
7947
7946
  var configKeys = Object.keys(config);
7948
7947
  var StyledBox = index$a(reactNative.View)(function (_ref5) {
7949
7948
  var theme = _ref5.theme,
7950
- otherProps = _objectWithoutProperties(_ref5, _excluded$d);
7949
+ otherProps = _objectWithoutProperties(_ref5, _excluded$c);
7951
7950
  var styleProps = pick(configKeys, otherProps);
7952
7951
  var flexProps = pick(_toConsumableArray(flexPropsKey), otherProps);
7953
7952
  return _objectSpread2(_objectSpread2({}, mapStylePropToThemeValue(theme, styleProps)), flexProps);
7954
7953
  });
7955
7954
 
7956
- var _excluded$c = ["children", "style", "testID"];
7955
+ var _excluded$b = ["children", "style", "testID"];
7957
7956
  var Box = function Box(_ref) {
7958
7957
  var children = _ref.children,
7959
7958
  style = _ref.style,
7960
7959
  testID = _ref.testID,
7961
- otherProps = _objectWithoutProperties(_ref, _excluded$c);
7960
+ otherProps = _objectWithoutProperties(_ref, _excluded$b);
7962
7961
  return /*#__PURE__*/React__default["default"].createElement(StyledBox, _extends$1({}, otherProps, {
7963
7962
  style: style,
7964
7963
  testID: testID
@@ -10569,7 +10568,7 @@ var CarouselPaginator = function CarouselPaginator(_ref) {
10569
10568
  }));
10570
10569
  };
10571
10570
 
10572
- var _excluded$b = ["rounded", "size", "testID", "style"];
10571
+ var _excluded$a = ["rounded", "size", "testID", "style"];
10573
10572
  var Image = function Image(_ref) {
10574
10573
  var _ref$rounded = _ref.rounded,
10575
10574
  rounded = _ref$rounded === void 0 ? false : _ref$rounded,
@@ -10577,7 +10576,7 @@ var Image = function Image(_ref) {
10577
10576
  size = _ref$size === void 0 ? '6xlarge' : _ref$size,
10578
10577
  testID = _ref.testID,
10579
10578
  style = _ref.style,
10580
- imageNativeProps = _objectWithoutProperties(_ref, _excluded$b);
10579
+ imageNativeProps = _objectWithoutProperties(_ref, _excluded$a);
10581
10580
  var theme = useTheme();
10582
10581
  var imageSize = theme.__hd__.image.sizes[size];
10583
10582
  return /*#__PURE__*/React__default["default"].createElement(reactNative.Image, _extends$1({
@@ -10662,7 +10661,7 @@ var CarouselItem = function CarouselItem(_ref) {
10662
10661
  }, content, /*#__PURE__*/React__default["default"].createElement(StyledCarouselHeading, null, heading), body ? /*#__PURE__*/React__default["default"].createElement(Typography.Text, null, body) : null));
10663
10662
  };
10664
10663
 
10665
- var _excluded$a = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style"];
10664
+ var _excluded$9 = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style"];
10666
10665
  function useStateFromProp(initialValue) {
10667
10666
  var _useState = React.useState(initialValue),
10668
10667
  _useState2 = _slicedToArray(_useState, 2),
@@ -10680,7 +10679,7 @@ var Carousel = function Carousel(_ref) {
10680
10679
  _ref$selectedItemInde = _ref.selectedItemIndex,
10681
10680
  selectedItemIndex = _ref$selectedItemInde === void 0 ? 0 : _ref$selectedItemInde,
10682
10681
  style = _ref.style,
10683
- nativeProps = _objectWithoutProperties(_ref, _excluded$a);
10682
+ nativeProps = _objectWithoutProperties(_ref, _excluded$9);
10684
10683
  var carouselRef = React.useRef(null);
10685
10684
  var _useStateFromProp = useStateFromProp(selectedItemIndex),
10686
10685
  _useStateFromProp2 = _slicedToArray(_useStateFromProp, 2),
@@ -10780,12 +10779,12 @@ var Indicator = index$a(reactNative.View)(function (_ref2) {
10780
10779
  };
10781
10780
  });
10782
10781
 
10783
- var _excluded$9 = ["intent", "children"];
10782
+ var _excluded$8 = ["intent", "children"];
10784
10783
  var DataCard = function DataCard(_ref) {
10785
10784
  var _ref$intent = _ref.intent,
10786
10785
  intent = _ref$intent === void 0 ? 'info' : _ref$intent,
10787
10786
  children = _ref.children,
10788
- nativeProps = _objectWithoutProperties(_ref, _excluded$9);
10787
+ nativeProps = _objectWithoutProperties(_ref, _excluded$8);
10789
10788
  return /*#__PURE__*/React__default["default"].createElement(StyledDataCard, nativeProps, /*#__PURE__*/React__default["default"].createElement(Indicator, {
10790
10789
  themeIntent: intent,
10791
10790
  testID: "data-card-indicator"
@@ -10803,11 +10802,11 @@ var StyledCard = index$a(reactNative.View)(function (_ref) {
10803
10802
  });
10804
10803
  });
10805
10804
 
10806
- var _excluded$8 = ["intent", "children"];
10805
+ var _excluded$7 = ["intent", "children"];
10807
10806
  var Card = function Card(_ref) {
10808
10807
  var intent = _ref.intent,
10809
10808
  children = _ref.children,
10810
- nativeProps = _objectWithoutProperties(_ref, _excluded$8);
10809
+ nativeProps = _objectWithoutProperties(_ref, _excluded$7);
10811
10810
  return /*#__PURE__*/React__default["default"].createElement(StyledCard, _extends$1({}, nativeProps, {
10812
10811
  themeIntent: intent
10813
10812
  }), children);
@@ -10816,7 +10815,7 @@ var index$8 = Object.assign(Card, {
10816
10815
  Data: DataCard
10817
10816
  });
10818
10817
 
10819
- var StyledWrapper$6 = index$a(reactNative.TouchableOpacity)(function (_ref) {
10818
+ var StyledWrapper$7 = index$a(reactNative.TouchableOpacity)(function (_ref) {
10820
10819
  var theme = _ref.theme,
10821
10820
  themeWithBorder = _ref.themeWithBorder,
10822
10821
  themeDisabled = _ref.themeDisabled;
@@ -10873,7 +10872,7 @@ var Checkbox = function Checkbox(_ref) {
10873
10872
  onPress = _ref.onPress,
10874
10873
  style = _ref.style,
10875
10874
  testID = _ref.testID;
10876
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$6, {
10875
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$7, {
10877
10876
  onPress: onPress,
10878
10877
  disabled: disabled,
10879
10878
  themeDisabled: disabled,
@@ -11041,7 +11040,7 @@ var StyledErrorAndMaxLengthContainer = index$a(reactNative.View)(function () {
11041
11040
  };
11042
11041
  });
11043
11042
 
11044
- var _excluded$7 = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "helpText", "value", "defaultValue", "renderInputValue"];
11043
+ var _excluded$6 = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "helpText", "value", "defaultValue", "renderInputValue"];
11045
11044
  var getVariant$1 = function getVariant(_ref) {
11046
11045
  var disabled = _ref.disabled,
11047
11046
  error = _ref.error,
@@ -11087,7 +11086,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
11087
11086
  value = _ref2.value,
11088
11087
  defaultValue = _ref2.defaultValue,
11089
11088
  renderInputValue = _ref2.renderInputValue,
11090
- nativeProps = _objectWithoutProperties(_ref2, _excluded$7);
11089
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$6);
11091
11090
  var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
11092
11091
  var isEmptyValue = displayText.length === 0;
11093
11092
  var actualSuffix = loading ? 'loading' : suffix;
@@ -11673,7 +11672,7 @@ var index$7 = Object.assign(Drawer, {
11673
11672
  Dragable: DragableDrawer
11674
11673
  });
11675
11674
 
11676
- var StyledWrapper$5 = index$a(reactNative.View)(function (_ref) {
11675
+ var StyledWrapper$6 = index$a(reactNative.View)(function (_ref) {
11677
11676
  var theme = _ref.theme;
11678
11677
  return {
11679
11678
  display: 'flex',
@@ -11715,7 +11714,7 @@ var Empty = function Empty(_ref) {
11715
11714
  _ref$variant = _ref.variant,
11716
11715
  variant = _ref$variant === void 0 ? 'light' : _ref$variant;
11717
11716
  var theme = useTheme();
11718
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$5, {
11717
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$6, {
11719
11718
  style: style,
11720
11719
  testID: testID
11721
11720
  }, image !== undefined && /*#__PURE__*/React__default["default"].cloneElement(image, _objectSpread2(_objectSpread2({}, image.props), {}, {
@@ -11765,11 +11764,11 @@ var StyledFABText = index$a(reactNative.Text)(function (_ref3) {
11765
11764
  };
11766
11765
  });
11767
11766
 
11768
- var _excluded$6 = ["active"];
11767
+ var _excluded$5 = ["active"];
11769
11768
  var AnimatedIcons = reactNative.Animated.createAnimatedComponent(StyledFABIcon);
11770
11769
  var AnimatedFABIcon = function AnimatedFABIcon(_ref) {
11771
11770
  var active = _ref.active,
11772
- iconProps = _objectWithoutProperties(_ref, _excluded$6);
11771
+ iconProps = _objectWithoutProperties(_ref, _excluded$5);
11773
11772
  var rotateAnimation = React.useRef(new reactNative.Animated.Value(active ? 1 : 0));
11774
11773
  React.useEffect(function () {
11775
11774
  var animation = reactNative.Animated.timing(rotateAnimation.current, {
@@ -12205,7 +12204,7 @@ var List = {
12205
12204
  BasicItem: BasicListItem
12206
12205
  };
12207
12206
 
12208
- var StyledWrapper$4 = index$a(reactNative.View)(function () {
12207
+ var StyledWrapper$5 = index$a(reactNative.View)(function () {
12209
12208
  return {
12210
12209
  alignContent: 'flex-start'
12211
12210
  };
@@ -12383,7 +12382,7 @@ function PinInput(_ref2) {
12383
12382
  reactNative.InteractionManager.runAfterInteractions(focus);
12384
12383
  }
12385
12384
  }, [inputRef]);
12386
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$4, {
12385
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$5, {
12387
12386
  style: style,
12388
12387
  testID: testID
12389
12388
  }, /*#__PURE__*/React__default["default"].createElement(StyledPinWrapper, null, _toConsumableArray(Array(length).keys()).map(function (index) {
@@ -12500,7 +12499,7 @@ var StyledStrokeEnd = index$a(reactNative.View)(function (_ref6) {
12500
12499
  };
12501
12500
  });
12502
12501
 
12503
- var _excluded$5 = ["value", "renderValue", "intent", "style", "testID"];
12502
+ var _excluded$4 = ["value", "renderValue", "intent", "style", "testID"];
12504
12503
  var HalfCircle = function HalfCircle(_ref) {
12505
12504
  var type = _ref.type,
12506
12505
  themeIntent = _ref.themeIntent;
@@ -12521,7 +12520,7 @@ var ProgressCircle = function ProgressCircle(_ref2) {
12521
12520
  intent = _ref2$intent === void 0 ? 'primary' : _ref2$intent,
12522
12521
  style = _ref2.style,
12523
12522
  testID = _ref2.testID,
12524
- nativeProps = _objectWithoutProperties(_ref2, _excluded$5);
12523
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$4);
12525
12524
  var theme = useTheme$1();
12526
12525
  var radius = theme.__hd__.progress.sizes.circleDiameter / 2;
12527
12526
  var progressAnimatedValue = React.useRef(new reactNative.Animated.Value(0));
@@ -12618,7 +12617,7 @@ var ProgressCircle = function ProgressCircle(_ref2) {
12618
12617
  }, renderValue(value)))));
12619
12618
  };
12620
12619
 
12621
- var StyledWrapper$3 = index$a(reactNative.View)(function (_ref) {
12620
+ var StyledWrapper$4 = index$a(reactNative.View)(function (_ref) {
12622
12621
  var theme = _ref.theme,
12623
12622
  themeIntent = _ref.themeIntent;
12624
12623
  return {
@@ -12638,14 +12637,14 @@ var StyledInner = index$a(reactNative.Animated.View)(function (_ref2) {
12638
12637
  };
12639
12638
  });
12640
12639
 
12641
- var _excluded$4 = ["value", "intent", "style", "testID"];
12640
+ var _excluded$3 = ["value", "intent", "style", "testID"];
12642
12641
  var ProgressBar = function ProgressBar(_ref) {
12643
12642
  var value = _ref.value,
12644
12643
  _ref$intent = _ref.intent,
12645
12644
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
12646
12645
  style = _ref.style,
12647
12646
  testID = _ref.testID,
12648
- nativeProps = _objectWithoutProperties(_ref, _excluded$4);
12647
+ nativeProps = _objectWithoutProperties(_ref, _excluded$3);
12649
12648
  var _useState = React.useState(0),
12650
12649
  _useState2 = _slicedToArray(_useState, 2),
12651
12650
  width = _useState2[0],
@@ -12671,7 +12670,7 @@ var ProgressBar = function ProgressBar(_ref) {
12671
12670
  outputRange: [999, 0],
12672
12671
  extrapolate: 'clamp'
12673
12672
  });
12674
- return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$3, _extends$1({}, nativeProps, {
12673
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$4, _extends$1({}, nativeProps, {
12675
12674
  testID: testID,
12676
12675
  style: style,
12677
12676
  themeIntent: intent
@@ -12836,14 +12835,14 @@ var AnimatedSpinner = function AnimatedSpinner(_ref) {
12836
12835
  }, dotProps))));
12837
12836
  };
12838
12837
 
12839
- var _excluded$3 = ["testID", "size", "intent"];
12838
+ var _excluded$2 = ["testID", "size", "intent"];
12840
12839
  var Spinner = function Spinner(_ref) {
12841
12840
  var testID = _ref.testID,
12842
12841
  _ref$size = _ref.size,
12843
12842
  size = _ref$size === void 0 ? 'medium' : _ref$size,
12844
12843
  _ref$intent = _ref.intent,
12845
12844
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
12846
- nativeProps = _objectWithoutProperties(_ref, _excluded$3);
12845
+ nativeProps = _objectWithoutProperties(_ref, _excluded$2);
12847
12846
  return /*#__PURE__*/React__default["default"].createElement(StyledView$1, nativeProps, /*#__PURE__*/React__default["default"].createElement(StyledSpinnerContainer, {
12848
12847
  testID: testID
12849
12848
  }, /*#__PURE__*/React__default["default"].createElement(AnimatedSpinner, {
@@ -12852,12 +12851,60 @@ var Spinner = function Spinner(_ref) {
12852
12851
  })));
12853
12852
  };
12854
12853
 
12854
+ var Buttons = function Buttons(_ref) {
12855
+ var _buttons$length;
12856
+ var buttons = _ref.buttons,
12857
+ isLeftButtons = _ref.isLeftButtons,
12858
+ leftButtonContainerStyle = _ref.leftButtonContainerStyle,
12859
+ rightButtonContainerStyle = _ref.rightButtonContainerStyle,
12860
+ panAnimatedValue = _ref.panAnimatedValue,
12861
+ width = _ref.width,
12862
+ canSwipeLeft = _ref.canSwipeLeft,
12863
+ canSwipeRight = _ref.canSwipeRight,
12864
+ buttonWidth = _ref.buttonWidth;
12865
+ var count = (_buttons$length = buttons === null || buttons === void 0 ? void 0 : buttons.length) !== null && _buttons$length !== void 0 ? _buttons$length : 0;
12866
+ var leftEnd = canSwipeLeft ? -width : 0;
12867
+ var rightEnd = canSwipeRight ? width : 0;
12868
+ var inputRange = isLeftButtons ? [0, rightEnd] : [leftEnd, 0];
12869
+ return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, buttons === null || buttons === void 0 ? void 0 : buttons.map(function (buttonContent, index) {
12870
+ var outputMultiplier = -index / count;
12871
+ var outputRange = isLeftButtons ? [0, rightEnd * outputMultiplier] : [leftEnd * outputMultiplier, 0];
12872
+ var transform = [{
12873
+ translateX: panAnimatedValue.x.interpolate({
12874
+ inputRange: inputRange,
12875
+ outputRange: outputRange,
12876
+ extrapolate: 'clamp'
12877
+ })
12878
+ }];
12879
+ var buttonStyle = [reactNative.StyleSheet.absoluteFill, {
12880
+ width: buttonWidth,
12881
+ transform: transform
12882
+ }, isLeftButtons ? leftButtonContainerStyle : rightButtonContainerStyle];
12883
+ return /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, {
12884
+ key: index,
12885
+ style: buttonStyle
12886
+ }, buttonContent);
12887
+ }));
12888
+ };
12889
+
12855
12890
  var StyledRectButton = index$a(reactNative.TouchableOpacity)(function (_ref) {
12856
12891
  var theme = _ref.theme,
12857
12892
  themeIntent = _ref.themeIntent;
12858
12893
  return {
12859
12894
  flex: 1,
12860
- backgroundColor: theme.__hd__.swipeable.colors[themeIntent]
12895
+ backgroundColor: theme.__hd__.swipeable.colors[themeIntent],
12896
+ alignItems: 'center',
12897
+ justifyContent: 'center'
12898
+ };
12899
+ });
12900
+ var StyledWrapper$3 = index$a(reactNative.View)(function () {
12901
+ return {
12902
+ flexDirection: 'row'
12903
+ };
12904
+ });
12905
+ var StyledContent = index$a(reactNative.Animated.View)(function () {
12906
+ return {
12907
+ flex: 1
12861
12908
  };
12862
12909
  });
12863
12910
 
@@ -12866,86 +12913,381 @@ var SwipeableAction = function SwipeableAction(_ref) {
12866
12913
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
12867
12914
  onPress = _ref.onPress,
12868
12915
  style = _ref.style,
12869
- children = _ref.children,
12870
- testID = _ref.testID;
12916
+ testID = _ref.testID,
12917
+ label = _ref.label,
12918
+ icon = _ref.icon;
12871
12919
  return /*#__PURE__*/React__default["default"].createElement(StyledRectButton, {
12872
12920
  onPress: onPress,
12873
12921
  themeIntent: intent,
12874
12922
  style: style,
12875
12923
  testID: testID
12876
- }, children);
12924
+ }, /*#__PURE__*/React__default["default"].createElement(Icon, {
12925
+ icon: icon,
12926
+ size: "xsmall"
12927
+ }), /*#__PURE__*/React__default["default"].createElement(Typography.Text, {
12928
+ fontSize: "small"
12929
+ }, label));
12930
+ };
12931
+
12932
+ var _excluded$1 = ["children", "leftActions", "leftContent", "rightActions", "rightContent", "style", "leftActionsWidth", "leftButtonWidth", "onSwipeLeftStart", "onSwipeLeftEnd", "rightActionsWidth", "rightButtonWidth", "onSwipeRightStart", "onSwipeRightEnd", "swipeState", "onStateChange"];
12933
+ var swipeStartMinDistance = 15;
12934
+ var getReleaseAnimationConfig = function getReleaseAnimationConfig(swipeState, props) {
12935
+ var totalLeftButtonsWidth = props.totalLeftButtonsWidth,
12936
+ totalRightButtonsWidth = props.totalRightButtonsWidth;
12937
+ var swipeReleaseAnimationConfig = {
12938
+ toValue: {
12939
+ x: 0,
12940
+ y: 0
12941
+ },
12942
+ duration: 100,
12943
+ easing: reactNative.Easing.elastic(0.5),
12944
+ useNativeDriver: true
12945
+ };
12946
+ if (swipeState === 'leftOpen') {
12947
+ return _objectSpread2(_objectSpread2({}, swipeReleaseAnimationConfig), {}, {
12948
+ toValue: {
12949
+ x: totalLeftButtonsWidth,
12950
+ y: 0
12951
+ }
12952
+ });
12953
+ }
12954
+ if (swipeState === 'rightOpen') {
12955
+ return _objectSpread2(_objectSpread2({}, swipeReleaseAnimationConfig), {}, {
12956
+ toValue: {
12957
+ x: totalRightButtonsWidth * -1,
12958
+ y: 0
12959
+ }
12960
+ });
12961
+ }
12962
+ return swipeReleaseAnimationConfig;
12877
12963
  };
12878
-
12879
- var _excluded$2 = ["children", "state", "onStateChange", "leftActions", "leftActionsWidth", "rightActions", "rightActionsWidth"];
12880
- var renderActions = function renderActions(actions, width, progress, direction) {
12881
- var trans = progress.interpolate({
12882
- inputRange: [0, 1],
12883
- outputRange: direction === 'left' ? [-width, 0] : [width, 0],
12884
- extrapolate: 'clamp'
12964
+ var getPos = function getPos(_ref) {
12965
+ var swipeState = _ref.swipeState,
12966
+ totalLeftButtonsWidth = _ref.totalLeftButtonsWidth,
12967
+ totalRightButtonsWidth = _ref.totalRightButtonsWidth;
12968
+ if (swipeState === 'leftOpen') {
12969
+ return {
12970
+ x: totalLeftButtonsWidth,
12971
+ y: 0
12972
+ };
12973
+ }
12974
+ if (swipeState === 'rightOpen') {
12975
+ return {
12976
+ x: totalRightButtonsWidth * -1,
12977
+ y: 0
12978
+ };
12979
+ }
12980
+ return {
12981
+ x: 0,
12982
+ y: 0
12983
+ };
12984
+ };
12985
+ var Swipeable = function Swipeable(_ref2) {
12986
+ var children = _ref2.children,
12987
+ _ref2$leftActions = _ref2.leftActions,
12988
+ leftActions = _ref2$leftActions === void 0 ? [] : _ref2$leftActions,
12989
+ leftContent = _ref2.leftContent,
12990
+ _ref2$rightActions = _ref2.rightActions,
12991
+ rightActions = _ref2$rightActions === void 0 ? [] : _ref2$rightActions,
12992
+ rightContent = _ref2.rightContent,
12993
+ style = _ref2.style,
12994
+ _ref2$leftActionsWidt = _ref2.leftActionsWidth,
12995
+ leftActionsWidth = _ref2$leftActionsWidt === void 0 ? scale(85) : _ref2$leftActionsWidt,
12996
+ _ref2$leftButtonWidth = _ref2.leftButtonWidth,
12997
+ leftButtonWidth = _ref2$leftButtonWidth === void 0 ? scale(85) : _ref2$leftButtonWidth,
12998
+ _ref2$onSwipeLeftStar = _ref2.onSwipeLeftStart,
12999
+ onSwipeLeftStart = _ref2$onSwipeLeftStar === void 0 ? noop : _ref2$onSwipeLeftStar,
13000
+ _ref2$onSwipeLeftEnd = _ref2.onSwipeLeftEnd,
13001
+ onSwipeLeftEnd = _ref2$onSwipeLeftEnd === void 0 ? noop : _ref2$onSwipeLeftEnd,
13002
+ _ref2$rightActionsWid = _ref2.rightActionsWidth,
13003
+ rightActionsWidth = _ref2$rightActionsWid === void 0 ? scale(85) : _ref2$rightActionsWid,
13004
+ _ref2$rightButtonWidt = _ref2.rightButtonWidth,
13005
+ rightButtonWidth = _ref2$rightButtonWidt === void 0 ? scale(85) : _ref2$rightButtonWidt,
13006
+ _ref2$onSwipeRightSta = _ref2.onSwipeRightStart,
13007
+ onSwipeRightStart = _ref2$onSwipeRightSta === void 0 ? noop : _ref2$onSwipeRightSta,
13008
+ _ref2$onSwipeRightEnd = _ref2.onSwipeRightEnd,
13009
+ onSwipeRightEnd = _ref2$onSwipeRightEnd === void 0 ? noop : _ref2$onSwipeRightEnd,
13010
+ _ref2$swipeState = _ref2.swipeState,
13011
+ swipeState = _ref2$swipeState === void 0 ? 'closed' : _ref2$swipeState,
13012
+ _ref2$onStateChange = _ref2.onStateChange,
13013
+ onStateChange = _ref2$onStateChange === void 0 ? noop : _ref2$onStateChange,
13014
+ rest = _objectWithoutProperties(_ref2, _excluded$1);
13015
+ var propsWithDefaultValue = _objectSpread2({
13016
+ children: children,
13017
+ leftActions: leftActions,
13018
+ leftContent: leftContent,
13019
+ rightActions: rightActions,
13020
+ rightContent: rightContent,
13021
+ style: style,
13022
+ leftActionsWidth: leftActionsWidth,
13023
+ leftButtonWidth: leftButtonWidth,
13024
+ onSwipeLeftStart: onSwipeLeftStart,
13025
+ onSwipeLeftEnd: onSwipeLeftEnd,
13026
+ rightActionsWidth: rightActionsWidth,
13027
+ rightButtonWidth: rightButtonWidth,
13028
+ onSwipeRightStart: onSwipeRightStart,
13029
+ onSwipeRightEnd: onSwipeRightEnd,
13030
+ swipeState: swipeState,
13031
+ onStateChange: onStateChange
13032
+ }, rest);
13033
+ var unmountedRef = React__default["default"].useRef(false);
13034
+ React.useEffect(function () {
13035
+ return function () {
13036
+ unmountedRef.current = true;
13037
+ };
13038
+ }, []);
13039
+ var totalLeftButtonsWidth = leftActions.length * leftButtonWidth;
13040
+ var totalRightButtonsWidth = rightActions.length * rightButtonWidth;
13041
+ var _React$useState = React__default["default"].useState(0),
13042
+ _React$useState2 = _slicedToArray(_React$useState, 2),
13043
+ width = _React$useState2[0],
13044
+ setWidth = _React$useState2[1];
13045
+ var hasLeftButtons = !leftContent && leftActions && leftActions.length > 0;
13046
+ var hasRightButtons = !rightContent && rightActions && rightActions.length > 0;
13047
+ var canSwipeRight = !!leftContent || !!hasLeftButtons;
13048
+ var canSwipeLeft = !!rightContent || !!hasRightButtons;
13049
+ var propsRef = React__default["default"].useRef(undefined);
13050
+ var _React$useState3 = React__default["default"].useState({
13051
+ pan: new reactNative.Animated.ValueXY(getPos({
13052
+ swipeState: swipeState,
13053
+ totalLeftButtonsWidth: totalLeftButtonsWidth,
13054
+ totalRightButtonsWidth: totalRightButtonsWidth
13055
+ })),
13056
+ lastOffset: {
13057
+ x: 0,
13058
+ y: 0
13059
+ },
13060
+ leftActionActivated: false,
13061
+ rightActionActivated: true,
13062
+ swipeState: 'closed'
13063
+ }),
13064
+ _React$useState4 = _slicedToArray(_React$useState3, 2),
13065
+ state = _React$useState4[0],
13066
+ setState = _React$useState4[1];
13067
+ propsRef.current = _objectSpread2(_objectSpread2({}, propsWithDefaultValue), {}, {
13068
+ canSwipeLeft: canSwipeLeft,
13069
+ canSwipeRight: canSwipeRight,
13070
+ totalLeftButtonsWidth: totalLeftButtonsWidth,
13071
+ totalRightButtonsWidth: totalRightButtonsWidth,
13072
+ hasLeftButtons: hasLeftButtons,
13073
+ hasRightButtons: hasRightButtons,
13074
+ unmountedRef: unmountedRef
12885
13075
  });
12886
- return /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, {
12887
- style: {
12888
- width: width,
12889
- flexDirection: 'row',
12890
- transform: [{
12891
- translateX: trans
12892
- }]
12893
- }
12894
- }, actions);
12895
- };
12896
- var Swipeable = function Swipeable(_ref) {
12897
- var children = _ref.children,
12898
- state = _ref.state,
12899
- onStateChange = _ref.onStateChange,
12900
- leftActions = _ref.leftActions,
12901
- leftActionsWidth = _ref.leftActionsWidth,
12902
- rightActions = _ref.rightActions,
12903
- rightActionsWidth = _ref.rightActionsWidth,
12904
- swipeableProps = _objectWithoutProperties(_ref, _excluded$2);
12905
- var _useWindowDimensions = reactNative.useWindowDimensions(),
12906
- width = _useWindowDimensions.width;
12907
- var swipeableRef = React.useRef(null);
12908
- var renderLeftActions = React.useCallback(function (progress) {
12909
- return renderActions(leftActions, leftActionsWidth || width, progress, 'left');
12910
- }, [leftActions, leftActionsWidth, width]);
12911
- var renderRightActions = React.useCallback(function (progress) {
12912
- return renderActions(rightActions, rightActionsWidth || width, progress, 'right');
12913
- }, [rightActions, rightActionsWidth, width]);
12914
13076
  React.useEffect(function () {
12915
- if (swipeableRef.current === null) return;
12916
- switch (state) {
12917
- case 'leftOpen':
12918
- swipeableRef.current.openLeft();
12919
- break;
12920
- case 'rightOpen':
12921
- swipeableRef.current.openRight();
12922
- break;
12923
- case 'closed':
12924
- swipeableRef.current.close();
12925
- break;
13077
+ var animation = null;
13078
+ if (state.swipeState !== swipeState) {
13079
+ animation = animationToNewState(swipeState, state.pan, totalLeftButtonsWidth, totalRightButtonsWidth);
13080
+ animation.start();
12926
13081
  }
12927
- }, [state]);
12928
- return /*#__PURE__*/React__default["default"].createElement(reactNativeGestureHandler.GestureHandlerRootView, null, /*#__PURE__*/React__default["default"].createElement(reactNativeGestureHandler.Swipeable, _extends$1({}, swipeableProps, {
12929
- ref: swipeableRef
12930
- }, leftActions !== undefined && {
12931
- renderLeftActions: renderLeftActions
12932
- }, rightActions !== undefined && {
12933
- renderRightActions: renderRightActions
12934
- }, {
12935
- onSwipeableLeftOpen: function onSwipeableLeftOpen() {
12936
- return onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange('leftOpen');
13082
+ return function () {
13083
+ if (animation) {
13084
+ animation.stop();
13085
+ }
13086
+ };
13087
+ }, [swipeState]);
13088
+ var transform = [{
13089
+ translateX: state.pan.x.interpolate({
13090
+ inputRange: [canSwipeLeft ? -width : 0, canSwipeRight ? width : 0],
13091
+ outputRange: [canSwipeLeft ? -width + reactNative.StyleSheet.hairlineWidth : 0, canSwipeRight ? width - reactNative.StyleSheet.hairlineWidth : 0],
13092
+ extrapolate: 'clamp'
13093
+ })
13094
+ }];
13095
+ var panResponder = React__default["default"].useRef(reactNative.PanResponder.create({
13096
+ onMoveShouldSetPanResponder: function onMoveShouldSetPanResponder(_, gestureState) {
13097
+ return Math.abs(gestureState.dx) > swipeStartMinDistance;
13098
+ },
13099
+ onMoveShouldSetPanResponderCapture: function onMoveShouldSetPanResponderCapture(_, gestureState) {
13100
+ return Math.abs(gestureState.dx) > swipeStartMinDistance;
13101
+ },
13102
+ onPanResponderGrant: function onPanResponderGrant() {
13103
+ setState(function (prevState) {
13104
+ prevState.pan.setOffset(prevState.lastOffset);
13105
+ return prevState;
13106
+ });
13107
+ },
13108
+ onPanResponderMove: function onPanResponderMove(event, gestureState) {
13109
+ setState(function (prevState) {
13110
+ return hanleOnPanResponderMove(prevState, propsRef.current, event, gestureState);
13111
+ });
12937
13112
  },
12938
- onSwipeableRightOpen: function onSwipeableRightOpen() {
12939
- return onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange('rightOpen');
13113
+ onPanResponderRelease: function onPanResponderRelease(event, gestureState) {
13114
+ setState(function (prevState) {
13115
+ return hanleOnPanResponderEnd(prevState, propsRef.current, event, gestureState);
13116
+ });
12940
13117
  },
12941
- onSwipeableClose: function onSwipeableClose() {
12942
- return onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange('closed');
13118
+ onPanResponderTerminationRequest: function onPanResponderTerminationRequest() {
13119
+ return false;
13120
+ },
13121
+ onPanResponderTerminate: function onPanResponderTerminate(event, gestureState) {
13122
+ setState(function (prevState) {
13123
+ return hanleOnPanResponderEnd(prevState, propsRef.current, event, gestureState);
13124
+ });
13125
+ }
13126
+ })).current;
13127
+ return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$3, _extends$1({
13128
+ onLayout: function onLayout(event) {
13129
+ var width = event.nativeEvent.layout.width;
13130
+ setWidth(width);
13131
+ },
13132
+ style: [{
13133
+ flexDirection: 'row'
13134
+ }, style]
13135
+ }, panResponder.panHandlers, rest), canSwipeRight && /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, {
13136
+ style: [{
13137
+ transform: transform,
13138
+ marginLeft: -width,
13139
+ width: width
13140
+ }]
13141
+ }, leftContent || /*#__PURE__*/React__default["default"].createElement(Buttons, {
13142
+ buttons: leftActions,
13143
+ isLeftButtons: true,
13144
+ panAnimatedValue: state.pan,
13145
+ width: width,
13146
+ canSwipeLeft: canSwipeLeft,
13147
+ canSwipeRight: canSwipeRight,
13148
+ buttonWidth: leftButtonWidth
13149
+ })), /*#__PURE__*/React__default["default"].createElement(StyledContent, {
13150
+ style: {
13151
+ transform: transform
13152
+ }
13153
+ }, children), canSwipeLeft && /*#__PURE__*/React__default["default"].createElement(reactNative.Animated.View, {
13154
+ style: [{
13155
+ transform: transform,
13156
+ marginRight: -width,
13157
+ width: width
13158
+ }]
13159
+ }, rightContent || /*#__PURE__*/React__default["default"].createElement(Buttons, {
13160
+ buttons: rightActions,
13161
+ isLeftButtons: false,
13162
+ panAnimatedValue: state.pan,
13163
+ width: width,
13164
+ canSwipeRight: canSwipeRight,
13165
+ canSwipeLeft: canSwipeLeft,
13166
+ buttonWidth: rightButtonWidth
13167
+ })));
13168
+ };
13169
+ var animationToNewState = function animationToNewState(swipeState, pan, totalLeftButtonsWidth, totalRightButtonsWidth) {
13170
+ var animationConfig = getReleaseAnimationConfig(swipeState, {
13171
+ totalLeftButtonsWidth: totalLeftButtonsWidth,
13172
+ totalRightButtonsWidth: totalRightButtonsWidth
13173
+ });
13174
+ pan.flattenOffset();
13175
+ return reactNative.Animated.timing(pan, animationConfig);
13176
+ };
13177
+ var hanleOnPanResponderEnd = function hanleOnPanResponderEnd(state, contextValues, event, gestureState) {
13178
+ var totalLeftButtonsWidth = contextValues.totalLeftButtonsWidth,
13179
+ totalRightButtonsWidth = contextValues.totalRightButtonsWidth,
13180
+ unmountedRef = contextValues.unmountedRef,
13181
+ onSwipeLeftEnd = contextValues.onSwipeLeftEnd,
13182
+ onSwipeRightEnd = contextValues.onSwipeRightEnd,
13183
+ onStateChange = contextValues.onStateChange;
13184
+ var leftActionActivated = state.leftActionActivated,
13185
+ rightActionActivated = state.rightActionActivated,
13186
+ pan = state.pan,
13187
+ swipeState = state.swipeState;
13188
+ var animationConfig = getReleaseAnimationConfig(swipeState, {
13189
+ totalLeftButtonsWidth: totalLeftButtonsWidth,
13190
+ totalRightButtonsWidth: totalRightButtonsWidth
13191
+ });
13192
+ animationToNewState(swipeState, pan, totalLeftButtonsWidth, totalRightButtonsWidth).start(function () {
13193
+ if (unmountedRef.current) {
13194
+ return;
12943
13195
  }
12944
- }), children));
13196
+ if (leftActionActivated && onSwipeLeftEnd) {
13197
+ onSwipeLeftEnd(event, gestureState);
13198
+ }
13199
+ if (rightActionActivated && onSwipeRightEnd) {
13200
+ onSwipeRightEnd(event, gestureState);
13201
+ }
13202
+ onStateChange(swipeState);
13203
+ });
13204
+ return _objectSpread2(_objectSpread2({}, state), {}, {
13205
+ lastOffset: {
13206
+ x: animationConfig.toValue.x,
13207
+ y: animationConfig.toValue.y
13208
+ },
13209
+ leftActionActivated: false,
13210
+ rightActionActivated: false
13211
+ });
13212
+ };
13213
+ var hanleOnPanResponderMove = function hanleOnPanResponderMove(state, contextValues, event, gestureState) {
13214
+ var leftActionsWidth = contextValues.leftActionsWidth,
13215
+ rightActionsWidth = contextValues.rightActionsWidth,
13216
+ onSwipeLeftStart = contextValues.onSwipeLeftStart,
13217
+ onSwipeRightStart = contextValues.onSwipeRightStart,
13218
+ canSwipeRight = contextValues.canSwipeRight,
13219
+ canSwipeLeft = contextValues.canSwipeLeft,
13220
+ hasLeftButtons = contextValues.hasLeftButtons,
13221
+ hasRightButtons = contextValues.hasRightButtons;
13222
+ var lastOffset = state.lastOffset,
13223
+ leftActionActivated = state.leftActionActivated,
13224
+ swipeState = state.swipeState,
13225
+ rightActionActivated = state.rightActionActivated;
13226
+ var dx = gestureState.dx,
13227
+ vx = gestureState.vx;
13228
+ var x = dx + lastOffset.x;
13229
+ var isSwipingLeft = vx < 0;
13230
+ var isSwipingRight = vx > 0;
13231
+ var leftActionsActivated = swipeState === 'leftOpen';
13232
+ var rightActionsActivated = swipeState === 'rightOpen';
13233
+ var nextLeftActionActivated = leftActionActivated;
13234
+ var nextLeftButtonsActivated = leftActionsActivated;
13235
+ var nextRightActionActivated = rightActionActivated;
13236
+ var nextRightButtonsActivated = rightActionsActivated;
13237
+ reactNative.Animated.event([null, {
13238
+ dx: state.pan.x,
13239
+ dy: state.pan.y
13240
+ }], {
13241
+ useNativeDriver: false
13242
+ })(event, gestureState);
13243
+ if (!leftActionActivated && canSwipeRight && x >= leftActionsWidth) {
13244
+ nextLeftActionActivated = true;
13245
+ onSwipeRightStart(event, gestureState);
13246
+ }
13247
+ if (leftActionActivated && canSwipeRight && x < leftActionsWidth) {
13248
+ nextLeftActionActivated = false;
13249
+ }
13250
+ if (!rightActionActivated && canSwipeLeft && x <= -rightActionsWidth) {
13251
+ nextRightActionActivated = true;
13252
+ onSwipeLeftStart(event, gestureState);
13253
+ }
13254
+ if (rightActionActivated && canSwipeLeft && x > -rightActionsWidth) {
13255
+ nextRightActionActivated = false;
13256
+ }
13257
+ if (!leftActionsActivated && hasLeftButtons && !isSwipingLeft && x >= leftActionsWidth) {
13258
+ nextLeftButtonsActivated = true;
13259
+ }
13260
+ if (leftActionsActivated && hasLeftButtons && isSwipingLeft) {
13261
+ nextLeftButtonsActivated = false;
13262
+ }
13263
+ if (!rightActionsActivated && hasRightButtons && !isSwipingRight && x <= -rightActionsWidth) {
13264
+ nextRightButtonsActivated = true;
13265
+ }
13266
+ if (rightActionsActivated && hasRightButtons && isSwipingRight) {
13267
+ nextRightButtonsActivated = false;
13268
+ }
13269
+ var needsUpdate = nextLeftActionActivated !== leftActionActivated || nextLeftButtonsActivated !== leftActionsActivated || nextRightActionActivated !== rightActionActivated || nextRightButtonsActivated !== rightActionsActivated;
13270
+ if (needsUpdate) {
13271
+ var nextSwipeState = function () {
13272
+ if (nextLeftButtonsActivated) {
13273
+ return 'leftOpen';
13274
+ } else if (nextRightButtonsActivated) {
13275
+ return 'rightOpen';
13276
+ } else {
13277
+ return 'closed';
13278
+ }
13279
+ }();
13280
+ return _objectSpread2(_objectSpread2({}, state), {}, {
13281
+ leftActionActivated: nextLeftActionActivated,
13282
+ rightActionActivated: nextRightActionActivated,
13283
+ swipeState: nextSwipeState
13284
+ });
13285
+ } else {
13286
+ return state;
13287
+ }
12945
13288
  };
12946
- var index$5 = Object.assign(Swipeable, {
12947
- Action: SwipeableAction,
12948
- Content: reactNativeGestureHandler.RectButton
13289
+ var index$5 = Object.assign( /*#__PURE__*/React__default["default"].memo(Swipeable), {
13290
+ Action: SwipeableAction
12949
13291
  });
12950
13292
 
12951
13293
  var Circle = index$a(reactNative.View)(function (_ref) {
@@ -14286,7 +14628,7 @@ var StyledText = index$a(reactNative.Text)(function (_ref3) {
14286
14628
  };
14287
14629
  });
14288
14630
 
14289
- var _excluded$1 = ["content", "variant", "intent", "style", "testID"];
14631
+ var _excluded = ["content", "variant", "intent", "style", "testID"];
14290
14632
  var Tag = function Tag(_ref) {
14291
14633
  var content = _ref.content,
14292
14634
  _ref$variant = _ref.variant,
@@ -14295,7 +14637,7 @@ var Tag = function Tag(_ref) {
14295
14637
  intent = _ref$intent === void 0 ? 'primary' : _ref$intent,
14296
14638
  style = _ref.style,
14297
14639
  testID = _ref.testID,
14298
- nativeProps = _objectWithoutProperties(_ref, _excluded$1);
14640
+ nativeProps = _objectWithoutProperties(_ref, _excluded);
14299
14641
  return /*#__PURE__*/React__default["default"].createElement(StyledView, _extends$1({}, nativeProps, {
14300
14642
  themeIntent: intent,
14301
14643
  themeVariant: variant,
@@ -14856,11 +15198,9 @@ var ToolbarGroup = function ToolbarGroup(_ref) {
14856
15198
  }));
14857
15199
  };
14858
15200
 
14859
- var _excluded = ["children"];
14860
15201
  var Toolbar = function Toolbar(_ref) {
14861
- var children = _ref.children,
14862
- rest = _objectWithoutProperties(_ref, _excluded);
14863
- return /*#__PURE__*/React__default["default"].createElement(ToolbarWrapper, rest, children);
15202
+ var children = _ref.children;
15203
+ return /*#__PURE__*/React__default["default"].createElement(ToolbarWrapper, null, children);
14864
15204
  };
14865
15205
  var index$1 = Object.assign(Toolbar, {
14866
15206
  Group: ToolbarGroup