@hero-design/rn 8.44.1 → 8.45.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.
package/lib/index.js CHANGED
@@ -7830,27 +7830,300 @@ var Avatar = function Avatar(_ref) {
7830
7830
  }));
7831
7831
  };
7832
7832
 
7833
+ var isIOS = reactNative.Platform.OS === 'ios';
7834
+ var isAndroid = reactNative.Platform.OS === 'android';
7835
+ function pick(keys, obj) {
7836
+ return keys.filter(function (key) {
7837
+ return key in obj;
7838
+ }).reduce(function (result, cur) {
7839
+ return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, cur, obj[cur]));
7840
+ }, {});
7841
+ }
7842
+ function omit(keys, obj) {
7843
+ var result = obj;
7844
+ keys.forEach(function (key) {
7845
+ delete result[key];
7846
+ });
7847
+ return result;
7848
+ }
7849
+
7850
+ var colors = {
7851
+ backgroundColor: {
7852
+ property: 'backgroundColor',
7853
+ scale: 'colors'
7854
+ },
7855
+ bgColor: {
7856
+ property: 'backgroundColor',
7857
+ scale: 'colors'
7858
+ },
7859
+ borderColor: {
7860
+ property: 'borderColor',
7861
+ scale: 'colors'
7862
+ },
7863
+ borderTopColor: {
7864
+ property: 'borderTopColor',
7865
+ scale: 'colors'
7866
+ },
7867
+ borderBottomColor: {
7868
+ property: 'borderBottomColor',
7869
+ scale: 'colors'
7870
+ },
7871
+ borderStartColor: {
7872
+ property: 'borderStartColor',
7873
+ scale: 'colors'
7874
+ },
7875
+ borderEndColor: {
7876
+ property: 'borderEndColor',
7877
+ scale: 'colors'
7878
+ },
7879
+ borderLeftColor: {
7880
+ property: 'borderLeftColor',
7881
+ scale: 'colors'
7882
+ },
7883
+ borderRightColor: {
7884
+ property: 'borderRightColor',
7885
+ scale: 'colors'
7886
+ }
7887
+ };
7888
+ var space = {
7889
+ margin: {
7890
+ property: 'margin',
7891
+ scale: 'space'
7892
+ },
7893
+ marginBottom: {
7894
+ property: 'marginBottom',
7895
+ scale: 'space'
7896
+ },
7897
+ marginEnd: {
7898
+ property: 'marginEnd',
7899
+ scale: 'space'
7900
+ },
7901
+ marginHorizontal: {
7902
+ property: 'marginHorizontal',
7903
+ scale: 'space'
7904
+ },
7905
+ marginLeft: {
7906
+ property: 'marginLeft',
7907
+ scale: 'space'
7908
+ },
7909
+ marginRight: {
7910
+ property: 'marginRight',
7911
+ scale: 'space'
7912
+ },
7913
+ marginStart: {
7914
+ property: 'marginStart',
7915
+ scale: 'space'
7916
+ },
7917
+ marginTop: {
7918
+ property: 'marginTop',
7919
+ scale: 'space'
7920
+ },
7921
+ marginVertical: {
7922
+ property: 'marginVertical',
7923
+ scale: 'space'
7924
+ },
7925
+ padding: {
7926
+ property: 'padding',
7927
+ scale: 'space'
7928
+ },
7929
+ paddingBottom: {
7930
+ property: 'paddingBottom',
7931
+ scale: 'space'
7932
+ },
7933
+ paddingEnd: {
7934
+ property: 'paddingEnd',
7935
+ scale: 'space'
7936
+ },
7937
+ paddingHorizontal: {
7938
+ property: 'paddingHorizontal',
7939
+ scale: 'space'
7940
+ },
7941
+ paddingLeft: {
7942
+ property: 'paddingLeft',
7943
+ scale: 'space'
7944
+ },
7945
+ paddingRight: {
7946
+ property: 'paddingRight',
7947
+ scale: 'space'
7948
+ },
7949
+ paddingStart: {
7950
+ property: 'paddingStart',
7951
+ scale: 'space'
7952
+ },
7953
+ paddingTop: {
7954
+ property: 'paddingTop',
7955
+ scale: 'space'
7956
+ },
7957
+ paddingVertical: {
7958
+ property: 'paddingVertical',
7959
+ scale: 'space'
7960
+ }
7961
+ };
7962
+ var radii = {
7963
+ borderBottomEndRadius: {
7964
+ property: 'borderBottomEndRadius',
7965
+ scale: 'radii'
7966
+ },
7967
+ borderBottomLeftRadius: {
7968
+ property: 'borderBottomLeftRadius',
7969
+ scale: 'radii'
7970
+ },
7971
+ borderBottomRightRadius: {
7972
+ property: 'borderBottomRightRadius',
7973
+ scale: 'radii'
7974
+ },
7975
+ borderBottomStartRadius: {
7976
+ property: 'borderBottomStartRadius',
7977
+ scale: 'radii'
7978
+ },
7979
+ borderTopEndRadius: {
7980
+ property: 'borderTopEndRadius',
7981
+ scale: 'radii'
7982
+ },
7983
+ borderTopLeftRadius: {
7984
+ property: 'borderTopLeftRadius',
7985
+ scale: 'radii'
7986
+ },
7987
+ borderTopRightRadius: {
7988
+ property: 'borderTopRightRadius',
7989
+ scale: 'radii'
7990
+ },
7991
+ borderTopStartRadius: {
7992
+ property: 'borderTopStartRadius',
7993
+ scale: 'radii'
7994
+ },
7995
+ borderRadius: {
7996
+ property: 'borderRadius',
7997
+ scale: 'radii'
7998
+ }
7999
+ };
8000
+ var borderWidths = {
8001
+ borderWidth: {
8002
+ property: 'borderWidth',
8003
+ scale: 'borderWidths'
8004
+ },
8005
+ borderBottomWidth: {
8006
+ property: 'borderBottomWidth',
8007
+ scale: 'borderWidths'
8008
+ },
8009
+ borderTopWidth: {
8010
+ property: 'borderTopWidth',
8011
+ scale: 'borderWidths'
8012
+ },
8013
+ borderLeftWidth: {
8014
+ property: 'borderLeftWidth',
8015
+ scale: 'borderWidths'
8016
+ },
8017
+ borderRightWidth: {
8018
+ property: 'borderRightWidth',
8019
+ scale: 'borderWidths'
8020
+ }
8021
+ };
8022
+ var config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, colors), space), radii), borderWidths);
8023
+ var flexPropsKey = ['alignContent', 'alignItems', 'alignSelf', 'display', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent'];
8024
+
8025
+ var _excluded$t = ["theme"];
8026
+ var getThemeValue = function getThemeValue(theme, key, props) {
8027
+ var propConfig = config[key];
8028
+ var propValue = props[key];
8029
+ if (!propValue) return undefined;
8030
+ var scale = propConfig.scale,
8031
+ property = propConfig.property;
8032
+ switch (scale) {
8033
+ case 'colors':
8034
+ return _defineProperty({}, property, theme.colors[propValue]);
8035
+ case 'space':
8036
+ return _defineProperty({}, property, theme.space[propValue]);
8037
+ case 'radii':
8038
+ return _defineProperty({}, property, theme.radii[propValue]);
8039
+ case 'borderWidths':
8040
+ return _defineProperty({}, property, theme.borderWidths[propValue]);
8041
+ }
8042
+ };
8043
+ var mapStylePropToThemeValue = function mapStylePropToThemeValue(theme, props) {
8044
+ var entries = Object.keys(props);
8045
+ return entries.reduce(function (result, key) {
8046
+ return _objectSpread2(_objectSpread2({}, result), getThemeValue(theme, key, props));
8047
+ }, {});
8048
+ };
8049
+ var configKeys = Object.keys(config);
8050
+ var StyledBox = index$a(reactNative.View)(function (_ref5) {
8051
+ var theme = _ref5.theme,
8052
+ otherProps = _objectWithoutProperties(_ref5, _excluded$t);
8053
+ var styleProps = pick(configKeys, otherProps);
8054
+ var flexProps = pick(_toConsumableArray(flexPropsKey), otherProps);
8055
+ return _objectSpread2(_objectSpread2({}, mapStylePropToThemeValue(theme, styleProps)), flexProps);
8056
+ });
8057
+
8058
+ var _excluded$s = ["children", "style", "testID"];
8059
+ var Box = function Box(_ref) {
8060
+ var children = _ref.children,
8061
+ style = _ref.style,
8062
+ testID = _ref.testID,
8063
+ otherProps = _objectWithoutProperties(_ref, _excluded$s);
8064
+ return /*#__PURE__*/React__default["default"].createElement(StyledBox, _extends$1({}, otherProps, {
8065
+ style: style,
8066
+ testID: testID
8067
+ }), children);
8068
+ };
8069
+
7833
8070
  var VISIBLE_RATIO = 0.7;
7834
8071
  var StyledWrapper$a = index$a(reactNative.View)(function (_ref) {
7835
8072
  var theme = _ref.theme,
7836
8073
  themeSize = _ref.themeSize,
7837
- themeAvatarCount = _ref.themeAvatarCount;
8074
+ themeAvatarCount = _ref.themeAvatarCount,
8075
+ _ref$themeVariant = _ref.themeVariant,
8076
+ themeVariant = _ref$themeVariant === void 0 ? 'horizontal' : _ref$themeVariant,
8077
+ _ref$themeHasSurplus = _ref.themeHasSurplus,
8078
+ themeHasSurplus = _ref$themeHasSurplus === void 0 ? false : _ref$themeHasSurplus;
7838
8079
  var avatarSize = theme.__hd__.avatar.sizes[themeSize];
8080
+ var widthAndHeightByVariant = {
8081
+ horizontal: {
8082
+ width: avatarSize * (1 + VISIBLE_RATIO * (themeHasSurplus ? themeAvatarCount : themeAvatarCount - 1)),
8083
+ height: avatarSize
8084
+ },
8085
+ vertical: {
8086
+ width: avatarSize,
8087
+ height: avatarSize * (1 + VISIBLE_RATIO * (themeHasSurplus ? themeAvatarCount : themeAvatarCount - 1))
8088
+ }
8089
+ };
7839
8090
  return {
7840
- flexDirection: 'row',
7841
- height: avatarSize,
7842
- width: avatarSize * (1 + VISIBLE_RATIO * (themeAvatarCount - 1))
8091
+ flexDirection: themeVariant === 'horizontal' ? 'row' : 'column',
8092
+ height: widthAndHeightByVariant[themeVariant].height,
8093
+ width: widthAndHeightByVariant[themeVariant].width
7843
8094
  };
7844
8095
  });
7845
8096
  var StyledAvatar = index$a(Avatar)(function (_ref2) {
7846
8097
  var theme = _ref2.theme,
7847
8098
  themeIndex = _ref2.themeIndex,
7848
8099
  _ref2$size = _ref2.size,
7849
- size = _ref2$size === void 0 ? 'small' : _ref2$size;
8100
+ size = _ref2$size === void 0 ? 'small' : _ref2$size,
8101
+ _ref2$themeVariant = _ref2.themeVariant,
8102
+ themeVariant = _ref2$themeVariant === void 0 ? 'horizontal' : _ref2$themeVariant;
7850
8103
  var avatarSize = theme.__hd__.avatar.sizes[size];
8104
+ var offset = avatarSize * VISIBLE_RATIO * themeIndex;
7851
8105
  return {
7852
8106
  position: 'absolute',
7853
- left: avatarSize * VISIBLE_RATIO * themeIndex
8107
+ left: themeVariant === 'horizontal' ? offset : undefined,
8108
+ top: themeVariant === 'vertical' ? offset : undefined
8109
+ };
8110
+ });
8111
+ var StyledSurplusContainer = index$a(Box)(function (_ref3) {
8112
+ var theme = _ref3.theme,
8113
+ themeIndex = _ref3.themeIndex,
8114
+ themeVariant = _ref3.themeVariant,
8115
+ _ref3$themeSize = _ref3.themeSize,
8116
+ themeSize = _ref3$themeSize === void 0 ? 'small' : _ref3$themeSize;
8117
+ var avatarSize = theme.__hd__.avatar.sizes[themeSize];
8118
+ var offset = avatarSize * VISIBLE_RATIO * themeIndex;
8119
+ return {
8120
+ position: 'absolute',
8121
+ left: themeVariant === 'horizontal' ? offset : undefined,
8122
+ top: themeVariant === 'vertical' ? offset : undefined,
8123
+ borderRadius: theme.__hd__.avatar.radii.rounded,
8124
+ width: theme.__hd__.avatar.sizes[themeSize],
8125
+ height: theme.__hd__.avatar.sizes[themeSize],
8126
+ overflow: 'hidden'
7854
8127
  };
7855
8128
  });
7856
8129
 
@@ -7877,35 +8150,86 @@ var useAvatarColors = function useAvatarColors() {
7877
8150
  return shuffledColors;
7878
8151
  };
7879
8152
 
7880
- var AvatarStack = function AvatarStack(_ref) {
7881
- var children = _ref.children,
7882
- max = _ref.max,
7883
- _ref$size = _ref.size,
7884
- size = _ref$size === void 0 ? 'small' : _ref$size,
7885
- style = _ref.style,
7886
- testID = _ref.testID;
8153
+ var Surplus = function Surplus(_ref) {
8154
+ var value = _ref.value,
8155
+ renderSurplus = _ref.renderSurplus,
8156
+ size = _ref.size,
8157
+ _ref$variant = _ref.variant,
8158
+ variant = _ref$variant === void 0 ? 'horizontal' : _ref$variant,
8159
+ index = _ref.index,
8160
+ backgroundColor = _ref.backgroundColor;
8161
+ if (value > 0) {
8162
+ if (renderSurplus) {
8163
+ return /*#__PURE__*/React__default["default"].createElement(StyledSurplusContainer, {
8164
+ testID: "surplus-container",
8165
+ themeSize: size,
8166
+ themeVariant: variant,
8167
+ themeIndex: index,
8168
+ style: {
8169
+ backgroundColor: backgroundColor
8170
+ }
8171
+ }, renderSurplus(value));
8172
+ }
8173
+ return /*#__PURE__*/React__default["default"].createElement(StyledAvatar, {
8174
+ testID: "surplus-container",
8175
+ themeVariant: variant,
8176
+ title: "+".concat(value),
8177
+ size: size,
8178
+ themeIndex: index,
8179
+ style: {
8180
+ backgroundColor: backgroundColor
8181
+ }
8182
+ });
8183
+ }
8184
+ return null;
8185
+ };
8186
+ var AvatarStack = function AvatarStack(_ref2) {
8187
+ var children = _ref2.children,
8188
+ max = _ref2.max,
8189
+ _ref2$size = _ref2.size,
8190
+ size = _ref2$size === void 0 ? 'small' : _ref2$size,
8191
+ style = _ref2.style,
8192
+ testID = _ref2.testID,
8193
+ _ref2$variant = _ref2.variant,
8194
+ variant = _ref2$variant === void 0 ? 'horizontal' : _ref2$variant,
8195
+ total = _ref2.total,
8196
+ renderSurplus = _ref2.renderSurplus;
7887
8197
  var colors = useAvatarColors();
7888
8198
  var avatars = children.slice(0, max);
7889
- if (max !== undefined && children.length - max > 0) {
7890
- var remainingAvatar = /*#__PURE__*/React__default["default"].createElement(Avatar, {
7891
- title: "+".concat(children.length - max),
7892
- size: size
7893
- });
7894
- avatars.push(remainingAvatar);
7895
- }
8199
+ var remainingAvatar = function () {
8200
+ var remain = 0;
8201
+ // Remaining value will prioritize total prop if it exists
8202
+ if (total && total > children.length) {
8203
+ remain = total - avatars.length;
8204
+ } else if (max && children.length > max) {
8205
+ remain = children.length - max;
8206
+ }
8207
+ return remain;
8208
+ }();
7896
8209
  return /*#__PURE__*/React__default["default"].createElement(StyledWrapper$a, {
7897
8210
  themeSize: size,
7898
8211
  themeAvatarCount: avatars.length,
8212
+ themeHasSurplus: remainingAvatar > 0,
7899
8213
  style: style,
7900
- testID: testID
8214
+ testID: testID,
8215
+ themeVariant: variant
7901
8216
  }, avatars.map(function (avt, index) {
7902
- return /*#__PURE__*/React__default["default"].createElement(StyledAvatar, _extends$1({}, avt.props, {
8217
+ return /*#__PURE__*/React__default["default"].createElement(StyledAvatar, _extends$1({
8218
+ themeVariant: variant
8219
+ }, avt.props, {
7903
8220
  size: size,
7904
8221
  themeIndex: index,
7905
8222
  style: {
7906
8223
  backgroundColor: colors[index % colors.length]
7907
8224
  }
7908
8225
  }));
8226
+ }), /*#__PURE__*/React__default["default"].createElement(Surplus, {
8227
+ value: remainingAvatar,
8228
+ index: avatars.length,
8229
+ size: size,
8230
+ variant: variant,
8231
+ renderSurplus: renderSurplus,
8232
+ backgroundColor: colors[avatars.length % colors.length]
7909
8233
  }));
7910
8234
  };
7911
8235
 
@@ -7950,7 +8274,7 @@ var StyledStatus = index$a(reactNative.Animated.View)(function (_ref3) {
7950
8274
  };
7951
8275
  });
7952
8276
 
7953
- var _excluded$t = ["children", "visible", "intent", "style", "testID"];
8277
+ var _excluded$r = ["children", "visible", "intent", "style", "testID"];
7954
8278
  var Status = function Status(_ref) {
7955
8279
  var children = _ref.children,
7956
8280
  _ref$visible = _ref.visible,
@@ -7959,7 +8283,7 @@ var Status = function Status(_ref) {
7959
8283
  intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
7960
8284
  style = _ref.style,
7961
8285
  testID = _ref.testID,
7962
- nativeProps = _objectWithoutProperties(_ref, _excluded$t);
8286
+ nativeProps = _objectWithoutProperties(_ref, _excluded$r);
7963
8287
  var _React$useRef = React__default["default"].useRef(new reactNative.Animated.Value(visible ? 1 : 0)),
7964
8288
  opacity = _React$useRef.current;
7965
8289
  var isFirstRendering = React__default["default"].useRef(true);
@@ -7992,7 +8316,7 @@ var Status = function Status(_ref) {
7992
8316
  }));
7993
8317
  };
7994
8318
 
7995
- var _excluded$s = ["content", "visible", "max", "intent", "style", "testID"];
8319
+ var _excluded$q = ["content", "visible", "max", "intent", "style", "testID"];
7996
8320
  var DEFAULT_MAX_NUMBER = 99;
7997
8321
  var getPaddingState = function getPaddingState(content) {
7998
8322
  return content.length > 1 ? 'wideContent' : 'narrowContent';
@@ -8007,7 +8331,7 @@ var Badge = function Badge(_ref) {
8007
8331
  intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
8008
8332
  style = _ref.style,
8009
8333
  testID = _ref.testID,
8010
- nativeProps = _objectWithoutProperties(_ref, _excluded$s);
8334
+ nativeProps = _objectWithoutProperties(_ref, _excluded$q);
8011
8335
  var _React$useRef = React__default["default"].useRef(new reactNative.Animated.Value(visible ? 1 : 0)),
8012
8336
  opacity = _React$useRef.current;
8013
8337
  var isFirstRendering = React__default["default"].useRef(true);
@@ -8094,24 +8418,7 @@ var StyledBottomBarText = index$a(Typography.Caption)(function (_ref3) {
8094
8418
  };
8095
8419
  });
8096
8420
 
8097
- var isIOS = reactNative.Platform.OS === 'ios';
8098
- var isAndroid = reactNative.Platform.OS === 'android';
8099
- function pick(keys, obj) {
8100
- return keys.filter(function (key) {
8101
- return key in obj;
8102
- }).reduce(function (result, cur) {
8103
- return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, cur, obj[cur]));
8104
- }, {});
8105
- }
8106
- function omit(keys, obj) {
8107
- var result = obj;
8108
- keys.forEach(function (key) {
8109
- delete result[key];
8110
- });
8111
- return result;
8112
- }
8113
-
8114
- var _excluded$r = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
8421
+ var _excluded$p = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
8115
8422
  var getInactiveIcon = function getInactiveIcon(icon) {
8116
8423
  var inactiveIcon = "".concat(icon, "-outlined");
8117
8424
  return isHeroIcon(inactiveIcon) ? inactiveIcon : icon;
@@ -8122,7 +8429,7 @@ var BottomNavigation = function BottomNavigation(_ref) {
8122
8429
  renderActiveTabOnly = _ref$renderActiveTabO === void 0 ? false : _ref$renderActiveTabO,
8123
8430
  selectedTabKey = _ref.selectedTabKey,
8124
8431
  tabs = _ref.tabs,
8125
- nativeProps = _objectWithoutProperties(_ref, _excluded$r);
8432
+ nativeProps = _objectWithoutProperties(_ref, _excluded$p);
8126
8433
  useDeprecation('BottomNavigation is deprecated and will be removed in the next major release. Please remove it.');
8127
8434
  var insets = reactNativeSafeAreaContext.useSafeAreaInsets();
8128
8435
  /**
@@ -8209,13 +8516,13 @@ var StyledDivider = index$a(reactNative.View)(function (_ref) {
8209
8516
  }, horizontalMargin), verticalMargin);
8210
8517
  });
8211
8518
 
8212
- var _excluded$q = ["marginHorizontal", "marginVertical", "style", "testID"];
8519
+ var _excluded$o = ["marginHorizontal", "marginVertical", "style", "testID"];
8213
8520
  var Divider = function Divider(_ref) {
8214
8521
  var marginHorizontal = _ref.marginHorizontal,
8215
8522
  marginVertical = _ref.marginVertical,
8216
8523
  style = _ref.style,
8217
8524
  testID = _ref.testID,
8218
- nativeProps = _objectWithoutProperties(_ref, _excluded$q);
8525
+ nativeProps = _objectWithoutProperties(_ref, _excluded$o);
8219
8526
  return /*#__PURE__*/React__default["default"].createElement(StyledDivider, _extends$1({}, nativeProps, {
8220
8527
  themeMarginHorizontal: marginHorizontal,
8221
8528
  themeMarginVertical: marginVertical,
@@ -8339,7 +8646,7 @@ var StyledLoadingDot = index$a(reactNative.View)(function (_ref) {
8339
8646
  }, themeStyling());
8340
8647
  });
8341
8648
 
8342
- var _excluded$p = ["count", "size", "testID", "themeVariant"];
8649
+ var _excluded$n = ["count", "size", "testID", "themeVariant"];
8343
8650
  var AnimatedLoadingIndicatorWrapper = reactNative.Animated.createAnimatedComponent(StyledLoadingIndicatorWrapper);
8344
8651
  var AnimatedLoadingDot = reactNative.Animated.createAnimatedComponent(StyledLoadingDot);
8345
8652
  var renderDotComponent = function renderDotComponent(_ref) {
@@ -8371,7 +8678,7 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
8371
8678
  size = _ref2$size === void 0 ? 12 : _ref2$size,
8372
8679
  testID = _ref2.testID,
8373
8680
  themeVariant = _ref2.themeVariant,
8374
- nativeProps = _objectWithoutProperties(_ref2, _excluded$p);
8681
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$n);
8375
8682
  var progressAnimation = React.useRef(new reactNative.Animated.Value(0));
8376
8683
  React.useEffect(function () {
8377
8684
  var animation = reactNative.Animated.loop(reactNative.Animated.timing(progressAnimation.current, {
@@ -8813,11 +9120,11 @@ var Header = function Header(_ref) {
8813
9120
  })) : null), showDivider ? /*#__PURE__*/React__default["default"].createElement(Divider, null) : null);
8814
9121
  };
8815
9122
 
8816
- var _excluded$o = ["scrollEventThrottle"];
9123
+ var _excluded$m = ["scrollEventThrottle"];
8817
9124
  var BottomSheetScrollView = function BottomSheetScrollView(_ref) {
8818
9125
  var _ref$scrollEventThrot = _ref.scrollEventThrottle,
8819
9126
  scrollEventThrottle = _ref$scrollEventThrot === void 0 ? 100 : _ref$scrollEventThrot,
8820
- props = _objectWithoutProperties(_ref, _excluded$o);
9127
+ props = _objectWithoutProperties(_ref, _excluded$m);
8821
9128
  var _useContext = React.useContext(BottomSheetContext),
8822
9129
  setInternalShowDivider = _useContext.setInternalShowDivider;
8823
9130
  var onScrollBeginDrag = React.useCallback(function (e) {
@@ -8930,253 +9237,33 @@ var BottomSheet = function BottomSheet(_ref) {
8930
9237
  }, /*#__PURE__*/React__default["default"].createElement(StyledKeyboardAvoidingView, _extends$1({
8931
9238
  behavior: reactNative.Platform.OS === 'ios' ? 'padding' : 'height'
8932
9239
  }, keyboardAvoidingViewProps), /*#__PURE__*/React__default["default"].createElement(StyledBackdrop$2, {
8933
- style: {
8934
- opacity: interpolateOpacity
8935
- },
8936
- onPress: onRequestClose
8937
- }), /*#__PURE__*/React__default["default"].createElement(StyledBottomSheet, {
8938
- style: [style, {
8939
- transform: [{
8940
- scaleY: height > 0 ? 1 : 0
8941
- }, {
8942
- translateY: interpolateY
8943
- }]
8944
- }]
8945
- }, header !== undefined ? /*#__PURE__*/React__default["default"].createElement(Header, {
8946
- content: header,
8947
- showDivider: internalShowDivider,
8948
- onRequestClose: onRequestClose,
8949
- showCloseButton: showCloseButton
8950
- }) : null, /*#__PURE__*/React__default["default"].createElement(BottomSheetContext.Provider, {
8951
- value: BottomSheetContextValue
8952
- }, children), footer ? /*#__PURE__*/React__default["default"].createElement(Footer$1, {
8953
- showDivider: showDivider
8954
- }, footer) : null))));
8955
- };
8956
- var BottomSheet$1 = Object.assign(BottomSheet, {
8957
- ScrollView: BottomSheetScrollView
8958
- });
8959
-
8960
- var colors = {
8961
- backgroundColor: {
8962
- property: 'backgroundColor',
8963
- scale: 'colors'
8964
- },
8965
- bgColor: {
8966
- property: 'backgroundColor',
8967
- scale: 'colors'
8968
- },
8969
- borderColor: {
8970
- property: 'borderColor',
8971
- scale: 'colors'
8972
- },
8973
- borderTopColor: {
8974
- property: 'borderTopColor',
8975
- scale: 'colors'
8976
- },
8977
- borderBottomColor: {
8978
- property: 'borderBottomColor',
8979
- scale: 'colors'
8980
- },
8981
- borderStartColor: {
8982
- property: 'borderStartColor',
8983
- scale: 'colors'
8984
- },
8985
- borderEndColor: {
8986
- property: 'borderEndColor',
8987
- scale: 'colors'
8988
- },
8989
- borderLeftColor: {
8990
- property: 'borderLeftColor',
8991
- scale: 'colors'
8992
- },
8993
- borderRightColor: {
8994
- property: 'borderRightColor',
8995
- scale: 'colors'
8996
- }
8997
- };
8998
- var space = {
8999
- margin: {
9000
- property: 'margin',
9001
- scale: 'space'
9002
- },
9003
- marginBottom: {
9004
- property: 'marginBottom',
9005
- scale: 'space'
9006
- },
9007
- marginEnd: {
9008
- property: 'marginEnd',
9009
- scale: 'space'
9010
- },
9011
- marginHorizontal: {
9012
- property: 'marginHorizontal',
9013
- scale: 'space'
9014
- },
9015
- marginLeft: {
9016
- property: 'marginLeft',
9017
- scale: 'space'
9018
- },
9019
- marginRight: {
9020
- property: 'marginRight',
9021
- scale: 'space'
9022
- },
9023
- marginStart: {
9024
- property: 'marginStart',
9025
- scale: 'space'
9026
- },
9027
- marginTop: {
9028
- property: 'marginTop',
9029
- scale: 'space'
9030
- },
9031
- marginVertical: {
9032
- property: 'marginVertical',
9033
- scale: 'space'
9034
- },
9035
- padding: {
9036
- property: 'padding',
9037
- scale: 'space'
9038
- },
9039
- paddingBottom: {
9040
- property: 'paddingBottom',
9041
- scale: 'space'
9042
- },
9043
- paddingEnd: {
9044
- property: 'paddingEnd',
9045
- scale: 'space'
9046
- },
9047
- paddingHorizontal: {
9048
- property: 'paddingHorizontal',
9049
- scale: 'space'
9050
- },
9051
- paddingLeft: {
9052
- property: 'paddingLeft',
9053
- scale: 'space'
9054
- },
9055
- paddingRight: {
9056
- property: 'paddingRight',
9057
- scale: 'space'
9058
- },
9059
- paddingStart: {
9060
- property: 'paddingStart',
9061
- scale: 'space'
9062
- },
9063
- paddingTop: {
9064
- property: 'paddingTop',
9065
- scale: 'space'
9066
- },
9067
- paddingVertical: {
9068
- property: 'paddingVertical',
9069
- scale: 'space'
9070
- }
9071
- };
9072
- var radii = {
9073
- borderBottomEndRadius: {
9074
- property: 'borderBottomEndRadius',
9075
- scale: 'radii'
9076
- },
9077
- borderBottomLeftRadius: {
9078
- property: 'borderBottomLeftRadius',
9079
- scale: 'radii'
9080
- },
9081
- borderBottomRightRadius: {
9082
- property: 'borderBottomRightRadius',
9083
- scale: 'radii'
9084
- },
9085
- borderBottomStartRadius: {
9086
- property: 'borderBottomStartRadius',
9087
- scale: 'radii'
9088
- },
9089
- borderTopEndRadius: {
9090
- property: 'borderTopEndRadius',
9091
- scale: 'radii'
9092
- },
9093
- borderTopLeftRadius: {
9094
- property: 'borderTopLeftRadius',
9095
- scale: 'radii'
9096
- },
9097
- borderTopRightRadius: {
9098
- property: 'borderTopRightRadius',
9099
- scale: 'radii'
9100
- },
9101
- borderTopStartRadius: {
9102
- property: 'borderTopStartRadius',
9103
- scale: 'radii'
9104
- },
9105
- borderRadius: {
9106
- property: 'borderRadius',
9107
- scale: 'radii'
9108
- }
9109
- };
9110
- var borderWidths = {
9111
- borderWidth: {
9112
- property: 'borderWidth',
9113
- scale: 'borderWidths'
9114
- },
9115
- borderBottomWidth: {
9116
- property: 'borderBottomWidth',
9117
- scale: 'borderWidths'
9118
- },
9119
- borderTopWidth: {
9120
- property: 'borderTopWidth',
9121
- scale: 'borderWidths'
9122
- },
9123
- borderLeftWidth: {
9124
- property: 'borderLeftWidth',
9125
- scale: 'borderWidths'
9126
- },
9127
- borderRightWidth: {
9128
- property: 'borderRightWidth',
9129
- scale: 'borderWidths'
9130
- }
9131
- };
9132
- var config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, colors), space), radii), borderWidths);
9133
- var flexPropsKey = ['alignContent', 'alignItems', 'alignSelf', 'display', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent'];
9134
-
9135
- var _excluded$n = ["theme"];
9136
- var getThemeValue = function getThemeValue(theme, key, props) {
9137
- var propConfig = config[key];
9138
- var propValue = props[key];
9139
- if (!propValue) return undefined;
9140
- var scale = propConfig.scale,
9141
- property = propConfig.property;
9142
- switch (scale) {
9143
- case 'colors':
9144
- return _defineProperty({}, property, theme.colors[propValue]);
9145
- case 'space':
9146
- return _defineProperty({}, property, theme.space[propValue]);
9147
- case 'radii':
9148
- return _defineProperty({}, property, theme.radii[propValue]);
9149
- case 'borderWidths':
9150
- return _defineProperty({}, property, theme.borderWidths[propValue]);
9151
- }
9152
- };
9153
- var mapStylePropToThemeValue = function mapStylePropToThemeValue(theme, props) {
9154
- var entries = Object.keys(props);
9155
- return entries.reduce(function (result, key) {
9156
- return _objectSpread2(_objectSpread2({}, result), getThemeValue(theme, key, props));
9157
- }, {});
9240
+ style: {
9241
+ opacity: interpolateOpacity
9242
+ },
9243
+ onPress: onRequestClose
9244
+ }), /*#__PURE__*/React__default["default"].createElement(StyledBottomSheet, {
9245
+ style: [style, {
9246
+ transform: [{
9247
+ scaleY: height > 0 ? 1 : 0
9248
+ }, {
9249
+ translateY: interpolateY
9250
+ }]
9251
+ }]
9252
+ }, header !== undefined ? /*#__PURE__*/React__default["default"].createElement(Header, {
9253
+ content: header,
9254
+ showDivider: internalShowDivider,
9255
+ onRequestClose: onRequestClose,
9256
+ showCloseButton: showCloseButton
9257
+ }) : null, /*#__PURE__*/React__default["default"].createElement(BottomSheetContext.Provider, {
9258
+ value: BottomSheetContextValue
9259
+ }, children), footer ? /*#__PURE__*/React__default["default"].createElement(Footer$1, {
9260
+ showDivider: showDivider
9261
+ }, footer) : null))));
9158
9262
  };
9159
- var configKeys = Object.keys(config);
9160
- var StyledBox = index$a(reactNative.View)(function (_ref5) {
9161
- var theme = _ref5.theme,
9162
- otherProps = _objectWithoutProperties(_ref5, _excluded$n);
9163
- var styleProps = pick(configKeys, otherProps);
9164
- var flexProps = pick(_toConsumableArray(flexPropsKey), otherProps);
9165
- return _objectSpread2(_objectSpread2({}, mapStylePropToThemeValue(theme, styleProps)), flexProps);
9263
+ var BottomSheet$1 = Object.assign(BottomSheet, {
9264
+ ScrollView: BottomSheetScrollView
9166
9265
  });
9167
9266
 
9168
- var _excluded$m = ["children", "style", "testID"];
9169
- var Box = function Box(_ref) {
9170
- var children = _ref.children,
9171
- style = _ref.style,
9172
- testID = _ref.testID,
9173
- otherProps = _objectWithoutProperties(_ref, _excluded$m);
9174
- return /*#__PURE__*/React__default["default"].createElement(StyledBox, _extends$1({}, otherProps, {
9175
- style: style,
9176
- testID: testID
9177
- }), children);
9178
- };
9179
-
9180
9267
  function requiredArgs(required, args) {
9181
9268
  if (args.length < required) {
9182
9269
  throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
@@ -11756,243 +11843,58 @@ var Calendar = function Calendar(_ref) {
11756
11843
  })), /*#__PURE__*/React__default["default"].createElement(StyledCalendarRow, null, daysOfPreviousMonth.map(function (date) {
11757
11844
  return date ? /*#__PURE__*/React__default["default"].createElement(CalendarRowItem, {
11758
11845
  key: date.toDateString(),
11759
- date: date,
11760
- isCurrent: isEqDate(now, date),
11761
- isSelected: isEqDate(value, date),
11762
- onPress: function onPress() {
11763
- return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11764
- },
11765
- textIntent: "subdued",
11766
- marked: parsedMaskedDate[date.toDateString()]
11767
- }) : /*#__PURE__*/React__default["default"].createElement(StyledDisabledCalendarRowItem, {
11768
- testID: "calendar-disabled-cell"
11769
- });
11770
- }), daysOfCurrentMonth.map(function (date) {
11771
- return date ? /*#__PURE__*/React__default["default"].createElement(CalendarRowItem, {
11772
- key: date.toDateString(),
11773
- date: date,
11774
- isCurrent: isEqDate(now, date),
11775
- isSelected: isEqDate(value, date),
11776
- onPress: function onPress() {
11777
- return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11778
- },
11779
- marked: parsedMaskedDate[date.toDateString()]
11780
- }) : /*#__PURE__*/React__default["default"].createElement(StyledDisabledCalendarRowItem, {
11781
- testID: "calendar-disabled-cell"
11782
- });
11783
- }), daysOfNextMonth.map(function (date) {
11784
- return date ? /*#__PURE__*/React__default["default"].createElement(CalendarRowItem, {
11785
- key: date.toDateString(),
11786
- date: date,
11787
- isCurrent: isEqDate(now, date),
11788
- isSelected: isEqDate(value, date),
11789
- onPress: function onPress() {
11790
- return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11791
- },
11792
- textIntent: "subdued",
11793
- marked: parsedMaskedDate[date.toDateString()]
11794
- }) : /*#__PURE__*/React__default["default"].createElement(StyledDisabledCalendarRowItem, {
11795
- testID: "calendar-disabled-cell"
11796
- });
11797
- })), reactNative.Platform.OS === 'android' && monthPickerVisible && /*#__PURE__*/React__default["default"].createElement(reactNativeMonthYearPicker.MonthYearPickerDialogueAndroid, {
11798
- doneButtonLabel: monthPickerConfirmLabel,
11799
- cancelButtonLabel: monthPickerCancelLabel,
11800
- value: value,
11801
- minimumDate: minDate,
11802
- maximumDate: maxDate,
11803
- onChange: function onChange(action, date) {
11804
- setMonthPickerVisible(false);
11805
- onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(false);
11806
- if (action === 'dateSetAction' && !!date) {
11807
- onMonthChange(date);
11808
- }
11809
- }
11810
- })));
11811
- };
11812
-
11813
- var _excluded$l = ["rounded", "size", "testID", "style"];
11814
- var Image = function Image(_ref) {
11815
- var _ref$rounded = _ref.rounded,
11816
- rounded = _ref$rounded === void 0 ? false : _ref$rounded,
11817
- _ref$size = _ref.size,
11818
- size = _ref$size === void 0 ? '6xlarge' : _ref$size,
11819
- testID = _ref.testID,
11820
- style = _ref.style,
11821
- imageNativeProps = _objectWithoutProperties(_ref, _excluded$l);
11822
- var theme = useTheme();
11823
- var imageSize = theme.__hd__.image.sizes[size];
11824
- return /*#__PURE__*/React__default["default"].createElement(reactNative.Image, _extends$1({
11825
- testID: testID,
11826
- style: [{
11827
- width: imageSize,
11828
- height: imageSize,
11829
- borderRadius: rounded ? imageSize / 2 : 0
11830
- }, style]
11831
- }, imageNativeProps));
11832
- };
11833
-
11834
- var StyledPageControl$2 = index$a(reactNative.View)(function () {
11835
- return {
11836
- flexDirection: 'row',
11837
- alignItems: 'center'
11838
- };
11839
- });
11840
- var StyledPageControlAnimatedView = index$a(reactNative.Animated.View)(function (_ref) {
11841
- var theme = _ref.theme;
11842
- return {
11843
- height: theme.__hd__.pageControl.sizes.paginatorHeight,
11844
- width: theme.__hd__.pageControl.sizes.paginatorWidth,
11845
- borderRadius: theme.__hd__.pageControl.radii.paginatorBorderRadius,
11846
- backgroundColor: theme.__hd__.pageControl.colors.paginatorBackgroundColor,
11847
- marginHorizontal: theme.__hd__.pageControl.space.paginatorMarginHorizontal
11848
- };
11849
- });
11850
-
11851
- var PageControl = function PageControl(_ref) {
11852
- var numberOfPages = _ref.numberOfPages,
11853
- _ref$currentPage = _ref.currentPage,
11854
- currentPage = _ref$currentPage === void 0 ? 0 : _ref$currentPage,
11855
- testID = _ref.testID,
11856
- style = _ref.style;
11857
- var theme = useTheme();
11858
- var animatedValue = React__default["default"].useRef(new reactNative.Animated.Value(currentPage)).current;
11859
- React__default["default"].useEffect(function () {
11860
- animatedValue.setValue(currentPage);
11861
- }, [currentPage]);
11862
- return /*#__PURE__*/React__default["default"].createElement(StyledPageControl$2, {
11863
- testID: testID,
11864
- style: style
11865
- }, new Array(numberOfPages).fill('').map(function (_, index) {
11866
- var inputRange = [index - 1, index, index + 1];
11867
- var indicatorWidth = animatedValue.interpolate({
11868
- inputRange: inputRange,
11869
- outputRange: [theme.space.small, theme.space.large, theme.space.small],
11870
- extrapolate: 'clamp'
11871
- });
11872
- var opacity = animatedValue.interpolate({
11873
- inputRange: inputRange,
11874
- outputRange: [0.5, 1, 0.5],
11875
- extrapolate: 'clamp'
11876
- });
11877
- return /*#__PURE__*/React__default["default"].createElement(StyledPageControlAnimatedView, {
11878
- accessibilityState: {
11879
- selected: index === currentPage
11880
- },
11881
- style: [{
11882
- width: indicatorWidth,
11883
- opacity: opacity
11884
- }],
11885
- key: index.toString(),
11886
- testID: "page-control-indicator".concat(index)
11887
- });
11888
- }));
11889
- };
11890
-
11891
- var StyledBackDrop = index$a(reactNative.View)(function (_ref) {
11892
- var themeSlideBackground = _ref.themeSlideBackground;
11893
- return {
11894
- position: 'absolute',
11895
- backgroundColor: themeSlideBackground,
11896
- top: 0,
11897
- bottom: 0,
11898
- right: 0,
11899
- left: 0
11900
- };
11901
- });
11902
- var StyledCarouselView = index$a(reactNative.View)(function () {
11903
- return {
11904
- flexGrow: 2,
11905
- justifyContent: 'space-between'
11906
- };
11907
- });
11908
- var StyledCarouselHeading = index$a(Typography.Title)(function (_ref2) {
11909
- var theme = _ref2.theme;
11910
- return {
11911
- marginTop: theme.__hd__.carousel.space.headingMarginTop,
11912
- marginBottom: theme.__hd__.carousel.space.headingMarginBottom
11913
- };
11914
- });
11915
- var StyledCarouselImage = index$a(Image)(function () {
11916
- return {
11917
- flexGrow: 2,
11918
- flex: 1,
11919
- width: '100%',
11920
- resizeMode: 'contain'
11921
- };
11922
- });
11923
- var StyledCustomSizeCarouselImage = index$a(Image)(function (_ref3) {
11924
- var height = _ref3.height,
11925
- _ref3$resizeMode = _ref3.resizeMode,
11926
- resizeMode = _ref3$resizeMode === void 0 ? 'contain' : _ref3$resizeMode,
11927
- width = _ref3.width;
11928
- return {
11929
- alignSelf: 'center',
11930
- width: width,
11931
- height: height,
11932
- resizeMode: resizeMode
11933
- };
11934
- });
11935
- var StyledCarouselContentWrapper = index$a(Box)(function (_ref4) {
11936
- var width = _ref4.width;
11937
- return {
11938
- width: width
11939
- };
11940
- });
11941
- var StyledCarouselFooterWrapper = index$a(reactNative.View)(function (_ref5) {
11942
- var theme = _ref5.theme;
11943
- return {
11944
- paddingHorizontal: theme.__hd__.carousel.space.footerPaddingHorizontal,
11945
- flexDirection: 'row',
11946
- justifyContent: 'space-between',
11947
- paddingVertical: theme.__hd__.carousel.space.footerPaddingVertical,
11948
- marginBottom: theme.__hd__.carousel.space.footerMarginBottom
11949
- };
11950
- });
11951
- var StyledPageControl$1 = index$a(PageControl)(function (_ref6) {
11952
- var theme = _ref6.theme;
11953
- return {
11954
- paddingVertical: theme.__hd__.carousel.space.pageControlPaddingVertical
11955
- };
11956
- });
11957
- var StyledPageControlWrapper = index$a(reactNative.View)(function (_ref7) {
11958
- var theme = _ref7.theme;
11959
- return {
11960
- alignItems: 'center',
11961
- justifyContent: 'center',
11962
- height: theme.__hd__.carousel.space.pageControlWrapperHeight
11963
- };
11964
- });
11965
-
11966
- function isCarouselImageProps(image) {
11967
- return _typeof(image) === 'object';
11968
- }
11969
- var CarouselItem = function CarouselItem(_ref) {
11970
- var width = _ref.width,
11971
- image = _ref.image,
11972
- content = _ref.content,
11973
- heading = _ref.heading,
11974
- body = _ref.body;
11975
- return /*#__PURE__*/React__default["default"].createElement(Box, {
11976
- style: {
11977
- width: width
11846
+ date: date,
11847
+ isCurrent: isEqDate(now, date),
11848
+ isSelected: isEqDate(value, date),
11849
+ onPress: function onPress() {
11850
+ return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11851
+ },
11852
+ textIntent: "subdued",
11853
+ marked: parsedMaskedDate[date.toDateString()]
11854
+ }) : /*#__PURE__*/React__default["default"].createElement(StyledDisabledCalendarRowItem, {
11855
+ testID: "calendar-disabled-cell"
11856
+ });
11857
+ }), daysOfCurrentMonth.map(function (date) {
11858
+ return date ? /*#__PURE__*/React__default["default"].createElement(CalendarRowItem, {
11859
+ key: date.toDateString(),
11860
+ date: date,
11861
+ isCurrent: isEqDate(now, date),
11862
+ isSelected: isEqDate(value, date),
11863
+ onPress: function onPress() {
11864
+ return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11865
+ },
11866
+ marked: parsedMaskedDate[date.toDateString()]
11867
+ }) : /*#__PURE__*/React__default["default"].createElement(StyledDisabledCalendarRowItem, {
11868
+ testID: "calendar-disabled-cell"
11869
+ });
11870
+ }), daysOfNextMonth.map(function (date) {
11871
+ return date ? /*#__PURE__*/React__default["default"].createElement(CalendarRowItem, {
11872
+ key: date.toDateString(),
11873
+ date: date,
11874
+ isCurrent: isEqDate(now, date),
11875
+ isSelected: isEqDate(value, date),
11876
+ onPress: function onPress() {
11877
+ return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11878
+ },
11879
+ textIntent: "subdued",
11880
+ marked: parsedMaskedDate[date.toDateString()]
11881
+ }) : /*#__PURE__*/React__default["default"].createElement(StyledDisabledCalendarRowItem, {
11882
+ testID: "calendar-disabled-cell"
11883
+ });
11884
+ })), reactNative.Platform.OS === 'android' && monthPickerVisible && /*#__PURE__*/React__default["default"].createElement(reactNativeMonthYearPicker.MonthYearPickerDialogueAndroid, {
11885
+ doneButtonLabel: monthPickerConfirmLabel,
11886
+ cancelButtonLabel: monthPickerCancelLabel,
11887
+ value: value,
11888
+ minimumDate: minDate,
11889
+ maximumDate: maxDate,
11890
+ onChange: function onChange(action, date) {
11891
+ setMonthPickerVisible(false);
11892
+ onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(false);
11893
+ if (action === 'dateSetAction' && !!date) {
11894
+ onMonthChange(date);
11895
+ }
11978
11896
  }
11979
- }, image && (isCarouselImageProps(image) ? /*#__PURE__*/React__default["default"].createElement(StyledCustomSizeCarouselImage, {
11980
- source: image,
11981
- height: image.height,
11982
- width: image.width,
11983
- resizeMode: image.resizeMode
11984
- }) : /*#__PURE__*/React__default["default"].createElement(StyledCarouselImage, {
11985
- source: typeof image === 'string' ? {
11986
- uri: image
11987
- } : image
11988
- })), /*#__PURE__*/React__default["default"].createElement(StyledCarouselContentWrapper, {
11989
- paddingHorizontal: "large",
11990
- marginTop: "large",
11991
- width: width
11992
- }, content, /*#__PURE__*/React__default["default"].createElement(StyledCarouselHeading, {
11993
- level: "h1",
11994
- typeface: "playful"
11995
- }, heading), body ? /*#__PURE__*/React__default["default"].createElement(Typography.Body, null, body) : null));
11897
+ })));
11996
11898
  };
11997
11899
 
11998
11900
  var StyledDataCard = index$a(reactNative.View)(function (_ref) {
@@ -12013,12 +11915,12 @@ var Indicator = index$a(reactNative.View)(function (_ref2) {
12013
11915
  };
12014
11916
  });
12015
11917
 
12016
- var _excluded$k = ["intent", "children"];
11918
+ var _excluded$l = ["intent", "children"];
12017
11919
  var DataCard = function DataCard(_ref) {
12018
11920
  var _ref$intent = _ref.intent,
12019
11921
  intent = _ref$intent === void 0 ? 'info' : _ref$intent,
12020
11922
  children = _ref.children,
12021
- nativeProps = _objectWithoutProperties(_ref, _excluded$k);
11923
+ nativeProps = _objectWithoutProperties(_ref, _excluded$l);
12022
11924
  return /*#__PURE__*/React__default["default"].createElement(StyledDataCard, nativeProps, /*#__PURE__*/React__default["default"].createElement(Indicator, {
12023
11925
  themeIntent: intent,
12024
11926
  testID: "data-card-indicator"
@@ -12036,11 +11938,11 @@ var StyledCard$1 = index$a(reactNative.View)(function (_ref) {
12036
11938
  });
12037
11939
  });
12038
11940
 
12039
- var _excluded$j = ["intent", "children"];
11941
+ var _excluded$k = ["intent", "children"];
12040
11942
  var Card = function Card(_ref) {
12041
11943
  var intent = _ref.intent,
12042
11944
  children = _ref.children,
12043
- nativeProps = _objectWithoutProperties(_ref, _excluded$j);
11945
+ nativeProps = _objectWithoutProperties(_ref, _excluded$k);
12044
11946
  return /*#__PURE__*/React__default["default"].createElement(StyledCard$1, _extends$1({}, nativeProps, {
12045
11947
  themeIntent: intent
12046
11948
  }), children);
@@ -12049,7 +11951,64 @@ var Card$1 = Object.assign(Card, {
12049
11951
  Data: DataCard
12050
11952
  });
12051
11953
 
12052
- var StyledPageControl = index$a(PageControl)(function (_ref) {
11954
+ var StyledPageControl$2 = index$a(reactNative.View)(function () {
11955
+ return {
11956
+ flexDirection: 'row',
11957
+ alignItems: 'center'
11958
+ };
11959
+ });
11960
+ var StyledPageControlAnimatedView = index$a(reactNative.Animated.View)(function (_ref) {
11961
+ var theme = _ref.theme;
11962
+ return {
11963
+ height: theme.__hd__.pageControl.sizes.paginatorHeight,
11964
+ width: theme.__hd__.pageControl.sizes.paginatorWidth,
11965
+ borderRadius: theme.__hd__.pageControl.radii.paginatorBorderRadius,
11966
+ backgroundColor: theme.__hd__.pageControl.colors.paginatorBackgroundColor,
11967
+ marginHorizontal: theme.__hd__.pageControl.space.paginatorMarginHorizontal
11968
+ };
11969
+ });
11970
+
11971
+ var PageControl = function PageControl(_ref) {
11972
+ var numberOfPages = _ref.numberOfPages,
11973
+ _ref$currentPage = _ref.currentPage,
11974
+ currentPage = _ref$currentPage === void 0 ? 0 : _ref$currentPage,
11975
+ testID = _ref.testID,
11976
+ style = _ref.style;
11977
+ var theme = useTheme();
11978
+ var animatedValue = React__default["default"].useRef(new reactNative.Animated.Value(currentPage)).current;
11979
+ React__default["default"].useEffect(function () {
11980
+ animatedValue.setValue(currentPage);
11981
+ }, [currentPage]);
11982
+ return /*#__PURE__*/React__default["default"].createElement(StyledPageControl$2, {
11983
+ testID: testID,
11984
+ style: style
11985
+ }, new Array(numberOfPages).fill('').map(function (_, index) {
11986
+ var inputRange = [index - 1, index, index + 1];
11987
+ var indicatorWidth = animatedValue.interpolate({
11988
+ inputRange: inputRange,
11989
+ outputRange: [theme.space.small, theme.space.large, theme.space.small],
11990
+ extrapolate: 'clamp'
11991
+ });
11992
+ var opacity = animatedValue.interpolate({
11993
+ inputRange: inputRange,
11994
+ outputRange: [0.5, 1, 0.5],
11995
+ extrapolate: 'clamp'
11996
+ });
11997
+ return /*#__PURE__*/React__default["default"].createElement(StyledPageControlAnimatedView, {
11998
+ accessibilityState: {
11999
+ selected: index === currentPage
12000
+ },
12001
+ style: [{
12002
+ width: indicatorWidth,
12003
+ opacity: opacity
12004
+ }],
12005
+ key: index.toString(),
12006
+ testID: "page-control-indicator".concat(index)
12007
+ });
12008
+ }));
12009
+ };
12010
+
12011
+ var StyledPageControl$1 = index$a(PageControl)(function (_ref) {
12053
12012
  var theme = _ref.theme;
12054
12013
  return {
12055
12014
  alignSelf: 'center',
@@ -12249,7 +12208,7 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
12249
12208
  viewabilityConfig: {
12250
12209
  itemVisiblePercentThreshold: 80
12251
12210
  }
12252
- }), !hidePageControl && /*#__PURE__*/React__default["default"].createElement(StyledPageControl, {
12211
+ }), !hidePageControl && /*#__PURE__*/React__default["default"].createElement(StyledPageControl$1, {
12253
12212
  testID: "pageControl",
12254
12213
  currentPage: currentIndex,
12255
12214
  numberOfPages: items.length
@@ -12257,6 +12216,134 @@ var CardCarousel = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
12257
12216
  });
12258
12217
  CardCarousel.displayName = 'CardCarousel';
12259
12218
 
12219
+ var _excluded$j = ["rounded", "size", "testID", "style"];
12220
+ var Image = function Image(_ref) {
12221
+ var _ref$rounded = _ref.rounded,
12222
+ rounded = _ref$rounded === void 0 ? false : _ref$rounded,
12223
+ _ref$size = _ref.size,
12224
+ size = _ref$size === void 0 ? '6xlarge' : _ref$size,
12225
+ testID = _ref.testID,
12226
+ style = _ref.style,
12227
+ imageNativeProps = _objectWithoutProperties(_ref, _excluded$j);
12228
+ var theme = useTheme();
12229
+ var imageSize = theme.__hd__.image.sizes[size];
12230
+ return /*#__PURE__*/React__default["default"].createElement(reactNative.Image, _extends$1({
12231
+ testID: testID,
12232
+ style: [{
12233
+ width: imageSize,
12234
+ height: imageSize,
12235
+ borderRadius: rounded ? imageSize / 2 : 0
12236
+ }, style]
12237
+ }, imageNativeProps));
12238
+ };
12239
+
12240
+ var StyledBackDrop = index$a(reactNative.View)(function (_ref) {
12241
+ var themeSlideBackground = _ref.themeSlideBackground;
12242
+ return {
12243
+ position: 'absolute',
12244
+ backgroundColor: themeSlideBackground,
12245
+ top: 0,
12246
+ bottom: 0,
12247
+ right: 0,
12248
+ left: 0
12249
+ };
12250
+ });
12251
+ var StyledCarouselView = index$a(reactNative.View)(function () {
12252
+ return {
12253
+ flexGrow: 2,
12254
+ justifyContent: 'space-between'
12255
+ };
12256
+ });
12257
+ var StyledCarouselHeading = index$a(Typography.Title)(function (_ref2) {
12258
+ var theme = _ref2.theme;
12259
+ return {
12260
+ marginTop: theme.__hd__.carousel.space.headingMarginTop,
12261
+ marginBottom: theme.__hd__.carousel.space.headingMarginBottom
12262
+ };
12263
+ });
12264
+ var StyledCarouselImage = index$a(Image)(function () {
12265
+ return {
12266
+ flexGrow: 2,
12267
+ flex: 1,
12268
+ width: '100%',
12269
+ resizeMode: 'contain'
12270
+ };
12271
+ });
12272
+ var StyledCustomSizeCarouselImage = index$a(Image)(function (_ref3) {
12273
+ var height = _ref3.height,
12274
+ _ref3$resizeMode = _ref3.resizeMode,
12275
+ resizeMode = _ref3$resizeMode === void 0 ? 'contain' : _ref3$resizeMode,
12276
+ width = _ref3.width;
12277
+ return {
12278
+ alignSelf: 'center',
12279
+ width: width,
12280
+ height: height,
12281
+ resizeMode: resizeMode
12282
+ };
12283
+ });
12284
+ var StyledCarouselContentWrapper = index$a(Box)(function (_ref4) {
12285
+ var width = _ref4.width;
12286
+ return {
12287
+ width: width
12288
+ };
12289
+ });
12290
+ var StyledCarouselFooterWrapper = index$a(reactNative.View)(function (_ref5) {
12291
+ var theme = _ref5.theme;
12292
+ return {
12293
+ paddingHorizontal: theme.__hd__.carousel.space.footerPaddingHorizontal,
12294
+ flexDirection: 'row',
12295
+ justifyContent: 'space-between',
12296
+ paddingVertical: theme.__hd__.carousel.space.footerPaddingVertical,
12297
+ marginBottom: theme.__hd__.carousel.space.footerMarginBottom
12298
+ };
12299
+ });
12300
+ var StyledPageControl = index$a(PageControl)(function (_ref6) {
12301
+ var theme = _ref6.theme;
12302
+ return {
12303
+ paddingVertical: theme.__hd__.carousel.space.pageControlPaddingVertical
12304
+ };
12305
+ });
12306
+ var StyledPageControlWrapper = index$a(reactNative.View)(function (_ref7) {
12307
+ var theme = _ref7.theme;
12308
+ return {
12309
+ alignItems: 'center',
12310
+ justifyContent: 'center',
12311
+ height: theme.__hd__.carousel.space.pageControlWrapperHeight
12312
+ };
12313
+ });
12314
+
12315
+ function isCarouselImageProps(image) {
12316
+ return _typeof(image) === 'object';
12317
+ }
12318
+ var CarouselItem = function CarouselItem(_ref) {
12319
+ var width = _ref.width,
12320
+ image = _ref.image,
12321
+ content = _ref.content,
12322
+ heading = _ref.heading,
12323
+ body = _ref.body;
12324
+ return /*#__PURE__*/React__default["default"].createElement(Box, {
12325
+ style: {
12326
+ width: width
12327
+ }
12328
+ }, image && (isCarouselImageProps(image) ? /*#__PURE__*/React__default["default"].createElement(StyledCustomSizeCarouselImage, {
12329
+ source: image,
12330
+ height: image.height,
12331
+ width: image.width,
12332
+ resizeMode: image.resizeMode
12333
+ }) : /*#__PURE__*/React__default["default"].createElement(StyledCarouselImage, {
12334
+ source: typeof image === 'string' ? {
12335
+ uri: image
12336
+ } : image
12337
+ })), /*#__PURE__*/React__default["default"].createElement(StyledCarouselContentWrapper, {
12338
+ paddingHorizontal: "large",
12339
+ marginTop: "large",
12340
+ width: width
12341
+ }, content, /*#__PURE__*/React__default["default"].createElement(StyledCarouselHeading, {
12342
+ level: "h1",
12343
+ typeface: "playful"
12344
+ }, heading), body ? /*#__PURE__*/React__default["default"].createElement(Typography.Body, null, body) : null));
12345
+ };
12346
+
12260
12347
  var _excluded$i = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "shouldShowPagination", "testID", "pageControlPosition"];
12261
12348
  function useStateFromProp(initialValue) {
12262
12349
  var _useState = React.useState(initialValue),
@@ -12272,6 +12359,7 @@ var noop = function noop(_) {
12272
12359
  return true;
12273
12360
  };
12274
12361
  var Carousel = function Carousel(_ref) {
12362
+ var _items$currentSlideIn;
12275
12363
  var items = _ref.items,
12276
12364
  onItemIndexChange = _ref.onItemIndexChange,
12277
12365
  renderActions = _ref.renderActions,
@@ -12286,6 +12374,7 @@ var Carousel = function Carousel(_ref) {
12286
12374
  nativeProps = _objectWithoutProperties(_ref, _excluded$i);
12287
12375
  useDeprecation("shouldShowPagination prop has been deprecated", shouldShowPagination !== noop);
12288
12376
  useDeprecation("The use of 'pageControlPosition == bottom' has been deprecated", pageControlPosition === 'bottom');
12377
+ var theme = useTheme();
12289
12378
  var carouselRef = React.useRef(null);
12290
12379
  var _useStateFromProp = useStateFromProp(selectedItemIndex),
12291
12380
  _useStateFromProp2 = _slicedToArray(_useStateFromProp, 2),
@@ -12317,20 +12406,20 @@ var Carousel = function Carousel(_ref) {
12317
12406
  var viewConfig = React.useRef({
12318
12407
  viewAreaCoveragePercentThreshold: 50
12319
12408
  }).current;
12320
- var onViewCallBack = React__default["default"].useCallback(function (info) {
12409
+ var onViewCallBack = React.useRef(function (info) {
12321
12410
  var firstVisibleItem = info.viewableItems.find(function (view) {
12322
12411
  return view.index != null && view.isViewable;
12323
12412
  });
12324
12413
  if (firstVisibleItem) {
12325
12414
  internalOnItemIndexChange(firstVisibleItem.index || 0);
12326
12415
  }
12327
- }, [internalOnItemIndexChange]);
12416
+ });
12328
12417
  return /*#__PURE__*/React__default["default"].createElement(reactNative.View, _extends$1({
12329
12418
  style: style,
12330
12419
  testID: testID
12331
12420
  }, nativeProps), /*#__PURE__*/React__default["default"].createElement(StyledBackDrop, {
12332
- themeSlideBackground: items[currentSlideIndex].background
12333
- }), /*#__PURE__*/React__default["default"].createElement(StyledPageControlWrapper, null, pageControlPosition === 'top' && shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React__default["default"].createElement(StyledPageControl$1, {
12421
+ themeSlideBackground: ((_items$currentSlideIn = items[currentSlideIndex]) === null || _items$currentSlideIn === void 0 ? void 0 : _items$currentSlideIn.background) || theme.colors.defaultGlobalSurface
12422
+ }), /*#__PURE__*/React__default["default"].createElement(StyledPageControlWrapper, null, pageControlPosition === 'top' && shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React__default["default"].createElement(StyledPageControl, {
12334
12423
  numberOfPages: items.length,
12335
12424
  currentPage: currentSlideIndex
12336
12425
  })), /*#__PURE__*/React__default["default"].createElement(StyledCarouselView, null, /*#__PURE__*/React__default["default"].createElement(reactNative.FlatList, {
@@ -12340,7 +12429,7 @@ var Carousel = function Carousel(_ref) {
12340
12429
  pagingEnabled: true,
12341
12430
  bounces: false,
12342
12431
  data: items,
12343
- onViewableItemsChanged: onViewCallBack,
12432
+ onViewableItemsChanged: onViewCallBack.current,
12344
12433
  viewabilityConfig: viewConfig,
12345
12434
  scrollEventThrottle: 32,
12346
12435
  ref: carouselRef,
@@ -12368,7 +12457,7 @@ var Carousel = function Carousel(_ref) {
12368
12457
  width: width
12369
12458
  });
12370
12459
  }
12371
- }), /*#__PURE__*/React__default["default"].createElement(StyledCarouselFooterWrapper, null, renderActions && renderActions(currentSlideIndex), pageControlPosition === 'bottom' && shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React__default["default"].createElement(StyledPageControl$1, {
12460
+ }), /*#__PURE__*/React__default["default"].createElement(StyledCarouselFooterWrapper, null, renderActions && renderActions(currentSlideIndex), pageControlPosition === 'bottom' && shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React__default["default"].createElement(StyledPageControl, {
12372
12461
  numberOfPages: items.length,
12373
12462
  currentPage: currentSlideIndex
12374
12463
  }))));