@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/es/index.js CHANGED
@@ -7800,27 +7800,300 @@ var Avatar = function Avatar(_ref) {
7800
7800
  }));
7801
7801
  };
7802
7802
 
7803
+ var isIOS = Platform.OS === 'ios';
7804
+ var isAndroid = Platform.OS === 'android';
7805
+ function pick(keys, obj) {
7806
+ return keys.filter(function (key) {
7807
+ return key in obj;
7808
+ }).reduce(function (result, cur) {
7809
+ return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, cur, obj[cur]));
7810
+ }, {});
7811
+ }
7812
+ function omit(keys, obj) {
7813
+ var result = obj;
7814
+ keys.forEach(function (key) {
7815
+ delete result[key];
7816
+ });
7817
+ return result;
7818
+ }
7819
+
7820
+ var colors = {
7821
+ backgroundColor: {
7822
+ property: 'backgroundColor',
7823
+ scale: 'colors'
7824
+ },
7825
+ bgColor: {
7826
+ property: 'backgroundColor',
7827
+ scale: 'colors'
7828
+ },
7829
+ borderColor: {
7830
+ property: 'borderColor',
7831
+ scale: 'colors'
7832
+ },
7833
+ borderTopColor: {
7834
+ property: 'borderTopColor',
7835
+ scale: 'colors'
7836
+ },
7837
+ borderBottomColor: {
7838
+ property: 'borderBottomColor',
7839
+ scale: 'colors'
7840
+ },
7841
+ borderStartColor: {
7842
+ property: 'borderStartColor',
7843
+ scale: 'colors'
7844
+ },
7845
+ borderEndColor: {
7846
+ property: 'borderEndColor',
7847
+ scale: 'colors'
7848
+ },
7849
+ borderLeftColor: {
7850
+ property: 'borderLeftColor',
7851
+ scale: 'colors'
7852
+ },
7853
+ borderRightColor: {
7854
+ property: 'borderRightColor',
7855
+ scale: 'colors'
7856
+ }
7857
+ };
7858
+ var space = {
7859
+ margin: {
7860
+ property: 'margin',
7861
+ scale: 'space'
7862
+ },
7863
+ marginBottom: {
7864
+ property: 'marginBottom',
7865
+ scale: 'space'
7866
+ },
7867
+ marginEnd: {
7868
+ property: 'marginEnd',
7869
+ scale: 'space'
7870
+ },
7871
+ marginHorizontal: {
7872
+ property: 'marginHorizontal',
7873
+ scale: 'space'
7874
+ },
7875
+ marginLeft: {
7876
+ property: 'marginLeft',
7877
+ scale: 'space'
7878
+ },
7879
+ marginRight: {
7880
+ property: 'marginRight',
7881
+ scale: 'space'
7882
+ },
7883
+ marginStart: {
7884
+ property: 'marginStart',
7885
+ scale: 'space'
7886
+ },
7887
+ marginTop: {
7888
+ property: 'marginTop',
7889
+ scale: 'space'
7890
+ },
7891
+ marginVertical: {
7892
+ property: 'marginVertical',
7893
+ scale: 'space'
7894
+ },
7895
+ padding: {
7896
+ property: 'padding',
7897
+ scale: 'space'
7898
+ },
7899
+ paddingBottom: {
7900
+ property: 'paddingBottom',
7901
+ scale: 'space'
7902
+ },
7903
+ paddingEnd: {
7904
+ property: 'paddingEnd',
7905
+ scale: 'space'
7906
+ },
7907
+ paddingHorizontal: {
7908
+ property: 'paddingHorizontal',
7909
+ scale: 'space'
7910
+ },
7911
+ paddingLeft: {
7912
+ property: 'paddingLeft',
7913
+ scale: 'space'
7914
+ },
7915
+ paddingRight: {
7916
+ property: 'paddingRight',
7917
+ scale: 'space'
7918
+ },
7919
+ paddingStart: {
7920
+ property: 'paddingStart',
7921
+ scale: 'space'
7922
+ },
7923
+ paddingTop: {
7924
+ property: 'paddingTop',
7925
+ scale: 'space'
7926
+ },
7927
+ paddingVertical: {
7928
+ property: 'paddingVertical',
7929
+ scale: 'space'
7930
+ }
7931
+ };
7932
+ var radii = {
7933
+ borderBottomEndRadius: {
7934
+ property: 'borderBottomEndRadius',
7935
+ scale: 'radii'
7936
+ },
7937
+ borderBottomLeftRadius: {
7938
+ property: 'borderBottomLeftRadius',
7939
+ scale: 'radii'
7940
+ },
7941
+ borderBottomRightRadius: {
7942
+ property: 'borderBottomRightRadius',
7943
+ scale: 'radii'
7944
+ },
7945
+ borderBottomStartRadius: {
7946
+ property: 'borderBottomStartRadius',
7947
+ scale: 'radii'
7948
+ },
7949
+ borderTopEndRadius: {
7950
+ property: 'borderTopEndRadius',
7951
+ scale: 'radii'
7952
+ },
7953
+ borderTopLeftRadius: {
7954
+ property: 'borderTopLeftRadius',
7955
+ scale: 'radii'
7956
+ },
7957
+ borderTopRightRadius: {
7958
+ property: 'borderTopRightRadius',
7959
+ scale: 'radii'
7960
+ },
7961
+ borderTopStartRadius: {
7962
+ property: 'borderTopStartRadius',
7963
+ scale: 'radii'
7964
+ },
7965
+ borderRadius: {
7966
+ property: 'borderRadius',
7967
+ scale: 'radii'
7968
+ }
7969
+ };
7970
+ var borderWidths = {
7971
+ borderWidth: {
7972
+ property: 'borderWidth',
7973
+ scale: 'borderWidths'
7974
+ },
7975
+ borderBottomWidth: {
7976
+ property: 'borderBottomWidth',
7977
+ scale: 'borderWidths'
7978
+ },
7979
+ borderTopWidth: {
7980
+ property: 'borderTopWidth',
7981
+ scale: 'borderWidths'
7982
+ },
7983
+ borderLeftWidth: {
7984
+ property: 'borderLeftWidth',
7985
+ scale: 'borderWidths'
7986
+ },
7987
+ borderRightWidth: {
7988
+ property: 'borderRightWidth',
7989
+ scale: 'borderWidths'
7990
+ }
7991
+ };
7992
+ var config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, colors), space), radii), borderWidths);
7993
+ var flexPropsKey = ['alignContent', 'alignItems', 'alignSelf', 'display', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent'];
7994
+
7995
+ var _excluded$t = ["theme"];
7996
+ var getThemeValue = function getThemeValue(theme, key, props) {
7997
+ var propConfig = config[key];
7998
+ var propValue = props[key];
7999
+ if (!propValue) return undefined;
8000
+ var scale = propConfig.scale,
8001
+ property = propConfig.property;
8002
+ switch (scale) {
8003
+ case 'colors':
8004
+ return _defineProperty({}, property, theme.colors[propValue]);
8005
+ case 'space':
8006
+ return _defineProperty({}, property, theme.space[propValue]);
8007
+ case 'radii':
8008
+ return _defineProperty({}, property, theme.radii[propValue]);
8009
+ case 'borderWidths':
8010
+ return _defineProperty({}, property, theme.borderWidths[propValue]);
8011
+ }
8012
+ };
8013
+ var mapStylePropToThemeValue = function mapStylePropToThemeValue(theme, props) {
8014
+ var entries = Object.keys(props);
8015
+ return entries.reduce(function (result, key) {
8016
+ return _objectSpread2(_objectSpread2({}, result), getThemeValue(theme, key, props));
8017
+ }, {});
8018
+ };
8019
+ var configKeys = Object.keys(config);
8020
+ var StyledBox = index$a(View)(function (_ref5) {
8021
+ var theme = _ref5.theme,
8022
+ otherProps = _objectWithoutProperties(_ref5, _excluded$t);
8023
+ var styleProps = pick(configKeys, otherProps);
8024
+ var flexProps = pick(_toConsumableArray(flexPropsKey), otherProps);
8025
+ return _objectSpread2(_objectSpread2({}, mapStylePropToThemeValue(theme, styleProps)), flexProps);
8026
+ });
8027
+
8028
+ var _excluded$s = ["children", "style", "testID"];
8029
+ var Box = function Box(_ref) {
8030
+ var children = _ref.children,
8031
+ style = _ref.style,
8032
+ testID = _ref.testID,
8033
+ otherProps = _objectWithoutProperties(_ref, _excluded$s);
8034
+ return /*#__PURE__*/React.createElement(StyledBox, _extends$1({}, otherProps, {
8035
+ style: style,
8036
+ testID: testID
8037
+ }), children);
8038
+ };
8039
+
7803
8040
  var VISIBLE_RATIO = 0.7;
7804
8041
  var StyledWrapper$a = index$a(View)(function (_ref) {
7805
8042
  var theme = _ref.theme,
7806
8043
  themeSize = _ref.themeSize,
7807
- themeAvatarCount = _ref.themeAvatarCount;
8044
+ themeAvatarCount = _ref.themeAvatarCount,
8045
+ _ref$themeVariant = _ref.themeVariant,
8046
+ themeVariant = _ref$themeVariant === void 0 ? 'horizontal' : _ref$themeVariant,
8047
+ _ref$themeHasSurplus = _ref.themeHasSurplus,
8048
+ themeHasSurplus = _ref$themeHasSurplus === void 0 ? false : _ref$themeHasSurplus;
7808
8049
  var avatarSize = theme.__hd__.avatar.sizes[themeSize];
8050
+ var widthAndHeightByVariant = {
8051
+ horizontal: {
8052
+ width: avatarSize * (1 + VISIBLE_RATIO * (themeHasSurplus ? themeAvatarCount : themeAvatarCount - 1)),
8053
+ height: avatarSize
8054
+ },
8055
+ vertical: {
8056
+ width: avatarSize,
8057
+ height: avatarSize * (1 + VISIBLE_RATIO * (themeHasSurplus ? themeAvatarCount : themeAvatarCount - 1))
8058
+ }
8059
+ };
7809
8060
  return {
7810
- flexDirection: 'row',
7811
- height: avatarSize,
7812
- width: avatarSize * (1 + VISIBLE_RATIO * (themeAvatarCount - 1))
8061
+ flexDirection: themeVariant === 'horizontal' ? 'row' : 'column',
8062
+ height: widthAndHeightByVariant[themeVariant].height,
8063
+ width: widthAndHeightByVariant[themeVariant].width
7813
8064
  };
7814
8065
  });
7815
8066
  var StyledAvatar = index$a(Avatar)(function (_ref2) {
7816
8067
  var theme = _ref2.theme,
7817
8068
  themeIndex = _ref2.themeIndex,
7818
8069
  _ref2$size = _ref2.size,
7819
- size = _ref2$size === void 0 ? 'small' : _ref2$size;
8070
+ size = _ref2$size === void 0 ? 'small' : _ref2$size,
8071
+ _ref2$themeVariant = _ref2.themeVariant,
8072
+ themeVariant = _ref2$themeVariant === void 0 ? 'horizontal' : _ref2$themeVariant;
7820
8073
  var avatarSize = theme.__hd__.avatar.sizes[size];
8074
+ var offset = avatarSize * VISIBLE_RATIO * themeIndex;
7821
8075
  return {
7822
8076
  position: 'absolute',
7823
- left: avatarSize * VISIBLE_RATIO * themeIndex
8077
+ left: themeVariant === 'horizontal' ? offset : undefined,
8078
+ top: themeVariant === 'vertical' ? offset : undefined
8079
+ };
8080
+ });
8081
+ var StyledSurplusContainer = index$a(Box)(function (_ref3) {
8082
+ var theme = _ref3.theme,
8083
+ themeIndex = _ref3.themeIndex,
8084
+ themeVariant = _ref3.themeVariant,
8085
+ _ref3$themeSize = _ref3.themeSize,
8086
+ themeSize = _ref3$themeSize === void 0 ? 'small' : _ref3$themeSize;
8087
+ var avatarSize = theme.__hd__.avatar.sizes[themeSize];
8088
+ var offset = avatarSize * VISIBLE_RATIO * themeIndex;
8089
+ return {
8090
+ position: 'absolute',
8091
+ left: themeVariant === 'horizontal' ? offset : undefined,
8092
+ top: themeVariant === 'vertical' ? offset : undefined,
8093
+ borderRadius: theme.__hd__.avatar.radii.rounded,
8094
+ width: theme.__hd__.avatar.sizes[themeSize],
8095
+ height: theme.__hd__.avatar.sizes[themeSize],
8096
+ overflow: 'hidden'
7824
8097
  };
7825
8098
  });
7826
8099
 
@@ -7847,35 +8120,86 @@ var useAvatarColors = function useAvatarColors() {
7847
8120
  return shuffledColors;
7848
8121
  };
7849
8122
 
7850
- var AvatarStack = function AvatarStack(_ref) {
7851
- var children = _ref.children,
7852
- max = _ref.max,
7853
- _ref$size = _ref.size,
7854
- size = _ref$size === void 0 ? 'small' : _ref$size,
7855
- style = _ref.style,
7856
- testID = _ref.testID;
8123
+ var Surplus = function Surplus(_ref) {
8124
+ var value = _ref.value,
8125
+ renderSurplus = _ref.renderSurplus,
8126
+ size = _ref.size,
8127
+ _ref$variant = _ref.variant,
8128
+ variant = _ref$variant === void 0 ? 'horizontal' : _ref$variant,
8129
+ index = _ref.index,
8130
+ backgroundColor = _ref.backgroundColor;
8131
+ if (value > 0) {
8132
+ if (renderSurplus) {
8133
+ return /*#__PURE__*/React.createElement(StyledSurplusContainer, {
8134
+ testID: "surplus-container",
8135
+ themeSize: size,
8136
+ themeVariant: variant,
8137
+ themeIndex: index,
8138
+ style: {
8139
+ backgroundColor: backgroundColor
8140
+ }
8141
+ }, renderSurplus(value));
8142
+ }
8143
+ return /*#__PURE__*/React.createElement(StyledAvatar, {
8144
+ testID: "surplus-container",
8145
+ themeVariant: variant,
8146
+ title: "+".concat(value),
8147
+ size: size,
8148
+ themeIndex: index,
8149
+ style: {
8150
+ backgroundColor: backgroundColor
8151
+ }
8152
+ });
8153
+ }
8154
+ return null;
8155
+ };
8156
+ var AvatarStack = function AvatarStack(_ref2) {
8157
+ var children = _ref2.children,
8158
+ max = _ref2.max,
8159
+ _ref2$size = _ref2.size,
8160
+ size = _ref2$size === void 0 ? 'small' : _ref2$size,
8161
+ style = _ref2.style,
8162
+ testID = _ref2.testID,
8163
+ _ref2$variant = _ref2.variant,
8164
+ variant = _ref2$variant === void 0 ? 'horizontal' : _ref2$variant,
8165
+ total = _ref2.total,
8166
+ renderSurplus = _ref2.renderSurplus;
7857
8167
  var colors = useAvatarColors();
7858
8168
  var avatars = children.slice(0, max);
7859
- if (max !== undefined && children.length - max > 0) {
7860
- var remainingAvatar = /*#__PURE__*/React.createElement(Avatar, {
7861
- title: "+".concat(children.length - max),
7862
- size: size
7863
- });
7864
- avatars.push(remainingAvatar);
7865
- }
8169
+ var remainingAvatar = function () {
8170
+ var remain = 0;
8171
+ // Remaining value will prioritize total prop if it exists
8172
+ if (total && total > children.length) {
8173
+ remain = total - avatars.length;
8174
+ } else if (max && children.length > max) {
8175
+ remain = children.length - max;
8176
+ }
8177
+ return remain;
8178
+ }();
7866
8179
  return /*#__PURE__*/React.createElement(StyledWrapper$a, {
7867
8180
  themeSize: size,
7868
8181
  themeAvatarCount: avatars.length,
8182
+ themeHasSurplus: remainingAvatar > 0,
7869
8183
  style: style,
7870
- testID: testID
8184
+ testID: testID,
8185
+ themeVariant: variant
7871
8186
  }, avatars.map(function (avt, index) {
7872
- return /*#__PURE__*/React.createElement(StyledAvatar, _extends$1({}, avt.props, {
8187
+ return /*#__PURE__*/React.createElement(StyledAvatar, _extends$1({
8188
+ themeVariant: variant
8189
+ }, avt.props, {
7873
8190
  size: size,
7874
8191
  themeIndex: index,
7875
8192
  style: {
7876
8193
  backgroundColor: colors[index % colors.length]
7877
8194
  }
7878
8195
  }));
8196
+ }), /*#__PURE__*/React.createElement(Surplus, {
8197
+ value: remainingAvatar,
8198
+ index: avatars.length,
8199
+ size: size,
8200
+ variant: variant,
8201
+ renderSurplus: renderSurplus,
8202
+ backgroundColor: colors[avatars.length % colors.length]
7879
8203
  }));
7880
8204
  };
7881
8205
 
@@ -7920,7 +8244,7 @@ var StyledStatus = index$a(Animated.View)(function (_ref3) {
7920
8244
  };
7921
8245
  });
7922
8246
 
7923
- var _excluded$t = ["children", "visible", "intent", "style", "testID"];
8247
+ var _excluded$r = ["children", "visible", "intent", "style", "testID"];
7924
8248
  var Status = function Status(_ref) {
7925
8249
  var children = _ref.children,
7926
8250
  _ref$visible = _ref.visible,
@@ -7929,7 +8253,7 @@ var Status = function Status(_ref) {
7929
8253
  intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
7930
8254
  style = _ref.style,
7931
8255
  testID = _ref.testID,
7932
- nativeProps = _objectWithoutProperties(_ref, _excluded$t);
8256
+ nativeProps = _objectWithoutProperties(_ref, _excluded$r);
7933
8257
  var _React$useRef = React.useRef(new Animated.Value(visible ? 1 : 0)),
7934
8258
  opacity = _React$useRef.current;
7935
8259
  var isFirstRendering = React.useRef(true);
@@ -7962,7 +8286,7 @@ var Status = function Status(_ref) {
7962
8286
  }));
7963
8287
  };
7964
8288
 
7965
- var _excluded$s = ["content", "visible", "max", "intent", "style", "testID"];
8289
+ var _excluded$q = ["content", "visible", "max", "intent", "style", "testID"];
7966
8290
  var DEFAULT_MAX_NUMBER = 99;
7967
8291
  var getPaddingState = function getPaddingState(content) {
7968
8292
  return content.length > 1 ? 'wideContent' : 'narrowContent';
@@ -7977,7 +8301,7 @@ var Badge = function Badge(_ref) {
7977
8301
  intent = _ref$intent === void 0 ? 'danger' : _ref$intent,
7978
8302
  style = _ref.style,
7979
8303
  testID = _ref.testID,
7980
- nativeProps = _objectWithoutProperties(_ref, _excluded$s);
8304
+ nativeProps = _objectWithoutProperties(_ref, _excluded$q);
7981
8305
  var _React$useRef = React.useRef(new Animated.Value(visible ? 1 : 0)),
7982
8306
  opacity = _React$useRef.current;
7983
8307
  var isFirstRendering = React.useRef(true);
@@ -8064,24 +8388,7 @@ var StyledBottomBarText = index$a(Typography.Caption)(function (_ref3) {
8064
8388
  };
8065
8389
  });
8066
8390
 
8067
- var isIOS = Platform.OS === 'ios';
8068
- var isAndroid = Platform.OS === 'android';
8069
- function pick(keys, obj) {
8070
- return keys.filter(function (key) {
8071
- return key in obj;
8072
- }).reduce(function (result, cur) {
8073
- return _objectSpread2(_objectSpread2({}, result), {}, _defineProperty({}, cur, obj[cur]));
8074
- }, {});
8075
- }
8076
- function omit(keys, obj) {
8077
- var result = obj;
8078
- keys.forEach(function (key) {
8079
- delete result[key];
8080
- });
8081
- return result;
8082
- }
8083
-
8084
- var _excluded$r = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
8391
+ var _excluded$p = ["onTabPress", "renderActiveTabOnly", "selectedTabKey", "tabs"];
8085
8392
  var getInactiveIcon = function getInactiveIcon(icon) {
8086
8393
  var inactiveIcon = "".concat(icon, "-outlined");
8087
8394
  return isHeroIcon(inactiveIcon) ? inactiveIcon : icon;
@@ -8092,7 +8399,7 @@ var BottomNavigation = function BottomNavigation(_ref) {
8092
8399
  renderActiveTabOnly = _ref$renderActiveTabO === void 0 ? false : _ref$renderActiveTabO,
8093
8400
  selectedTabKey = _ref.selectedTabKey,
8094
8401
  tabs = _ref.tabs,
8095
- nativeProps = _objectWithoutProperties(_ref, _excluded$r);
8402
+ nativeProps = _objectWithoutProperties(_ref, _excluded$p);
8096
8403
  useDeprecation('BottomNavigation is deprecated and will be removed in the next major release. Please remove it.');
8097
8404
  var insets = useSafeAreaInsets();
8098
8405
  /**
@@ -8179,13 +8486,13 @@ var StyledDivider = index$a(View)(function (_ref) {
8179
8486
  }, horizontalMargin), verticalMargin);
8180
8487
  });
8181
8488
 
8182
- var _excluded$q = ["marginHorizontal", "marginVertical", "style", "testID"];
8489
+ var _excluded$o = ["marginHorizontal", "marginVertical", "style", "testID"];
8183
8490
  var Divider = function Divider(_ref) {
8184
8491
  var marginHorizontal = _ref.marginHorizontal,
8185
8492
  marginVertical = _ref.marginVertical,
8186
8493
  style = _ref.style,
8187
8494
  testID = _ref.testID,
8188
- nativeProps = _objectWithoutProperties(_ref, _excluded$q);
8495
+ nativeProps = _objectWithoutProperties(_ref, _excluded$o);
8189
8496
  return /*#__PURE__*/React.createElement(StyledDivider, _extends$1({}, nativeProps, {
8190
8497
  themeMarginHorizontal: marginHorizontal,
8191
8498
  themeMarginVertical: marginVertical,
@@ -8309,7 +8616,7 @@ var StyledLoadingDot = index$a(View)(function (_ref) {
8309
8616
  }, themeStyling());
8310
8617
  });
8311
8618
 
8312
- var _excluded$p = ["count", "size", "testID", "themeVariant"];
8619
+ var _excluded$n = ["count", "size", "testID", "themeVariant"];
8313
8620
  var AnimatedLoadingIndicatorWrapper = Animated.createAnimatedComponent(StyledLoadingIndicatorWrapper);
8314
8621
  var AnimatedLoadingDot = Animated.createAnimatedComponent(StyledLoadingDot);
8315
8622
  var renderDotComponent = function renderDotComponent(_ref) {
@@ -8341,7 +8648,7 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
8341
8648
  size = _ref2$size === void 0 ? 12 : _ref2$size,
8342
8649
  testID = _ref2.testID,
8343
8650
  themeVariant = _ref2.themeVariant,
8344
- nativeProps = _objectWithoutProperties(_ref2, _excluded$p);
8651
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$n);
8345
8652
  var progressAnimation = useRef(new Animated.Value(0));
8346
8653
  useEffect(function () {
8347
8654
  var animation = Animated.loop(Animated.timing(progressAnimation.current, {
@@ -8783,11 +9090,11 @@ var Header = function Header(_ref) {
8783
9090
  })) : null), showDivider ? /*#__PURE__*/React.createElement(Divider, null) : null);
8784
9091
  };
8785
9092
 
8786
- var _excluded$o = ["scrollEventThrottle"];
9093
+ var _excluded$m = ["scrollEventThrottle"];
8787
9094
  var BottomSheetScrollView = function BottomSheetScrollView(_ref) {
8788
9095
  var _ref$scrollEventThrot = _ref.scrollEventThrottle,
8789
9096
  scrollEventThrottle = _ref$scrollEventThrot === void 0 ? 100 : _ref$scrollEventThrot,
8790
- props = _objectWithoutProperties(_ref, _excluded$o);
9097
+ props = _objectWithoutProperties(_ref, _excluded$m);
8791
9098
  var _useContext = useContext(BottomSheetContext),
8792
9099
  setInternalShowDivider = _useContext.setInternalShowDivider;
8793
9100
  var onScrollBeginDrag = useCallback(function (e) {
@@ -8900,253 +9207,33 @@ var BottomSheet = function BottomSheet(_ref) {
8900
9207
  }, /*#__PURE__*/React.createElement(StyledKeyboardAvoidingView, _extends$1({
8901
9208
  behavior: Platform.OS === 'ios' ? 'padding' : 'height'
8902
9209
  }, keyboardAvoidingViewProps), /*#__PURE__*/React.createElement(StyledBackdrop$2, {
8903
- style: {
8904
- opacity: interpolateOpacity
8905
- },
8906
- onPress: onRequestClose
8907
- }), /*#__PURE__*/React.createElement(StyledBottomSheet, {
8908
- style: [style, {
8909
- transform: [{
8910
- scaleY: height > 0 ? 1 : 0
8911
- }, {
8912
- translateY: interpolateY
8913
- }]
8914
- }]
8915
- }, header !== undefined ? /*#__PURE__*/React.createElement(Header, {
8916
- content: header,
8917
- showDivider: internalShowDivider,
8918
- onRequestClose: onRequestClose,
8919
- showCloseButton: showCloseButton
8920
- }) : null, /*#__PURE__*/React.createElement(BottomSheetContext.Provider, {
8921
- value: BottomSheetContextValue
8922
- }, children), footer ? /*#__PURE__*/React.createElement(Footer$1, {
8923
- showDivider: showDivider
8924
- }, footer) : null))));
8925
- };
8926
- var BottomSheet$1 = Object.assign(BottomSheet, {
8927
- ScrollView: BottomSheetScrollView
8928
- });
8929
-
8930
- var colors = {
8931
- backgroundColor: {
8932
- property: 'backgroundColor',
8933
- scale: 'colors'
8934
- },
8935
- bgColor: {
8936
- property: 'backgroundColor',
8937
- scale: 'colors'
8938
- },
8939
- borderColor: {
8940
- property: 'borderColor',
8941
- scale: 'colors'
8942
- },
8943
- borderTopColor: {
8944
- property: 'borderTopColor',
8945
- scale: 'colors'
8946
- },
8947
- borderBottomColor: {
8948
- property: 'borderBottomColor',
8949
- scale: 'colors'
8950
- },
8951
- borderStartColor: {
8952
- property: 'borderStartColor',
8953
- scale: 'colors'
8954
- },
8955
- borderEndColor: {
8956
- property: 'borderEndColor',
8957
- scale: 'colors'
8958
- },
8959
- borderLeftColor: {
8960
- property: 'borderLeftColor',
8961
- scale: 'colors'
8962
- },
8963
- borderRightColor: {
8964
- property: 'borderRightColor',
8965
- scale: 'colors'
8966
- }
8967
- };
8968
- var space = {
8969
- margin: {
8970
- property: 'margin',
8971
- scale: 'space'
8972
- },
8973
- marginBottom: {
8974
- property: 'marginBottom',
8975
- scale: 'space'
8976
- },
8977
- marginEnd: {
8978
- property: 'marginEnd',
8979
- scale: 'space'
8980
- },
8981
- marginHorizontal: {
8982
- property: 'marginHorizontal',
8983
- scale: 'space'
8984
- },
8985
- marginLeft: {
8986
- property: 'marginLeft',
8987
- scale: 'space'
8988
- },
8989
- marginRight: {
8990
- property: 'marginRight',
8991
- scale: 'space'
8992
- },
8993
- marginStart: {
8994
- property: 'marginStart',
8995
- scale: 'space'
8996
- },
8997
- marginTop: {
8998
- property: 'marginTop',
8999
- scale: 'space'
9000
- },
9001
- marginVertical: {
9002
- property: 'marginVertical',
9003
- scale: 'space'
9004
- },
9005
- padding: {
9006
- property: 'padding',
9007
- scale: 'space'
9008
- },
9009
- paddingBottom: {
9010
- property: 'paddingBottom',
9011
- scale: 'space'
9012
- },
9013
- paddingEnd: {
9014
- property: 'paddingEnd',
9015
- scale: 'space'
9016
- },
9017
- paddingHorizontal: {
9018
- property: 'paddingHorizontal',
9019
- scale: 'space'
9020
- },
9021
- paddingLeft: {
9022
- property: 'paddingLeft',
9023
- scale: 'space'
9024
- },
9025
- paddingRight: {
9026
- property: 'paddingRight',
9027
- scale: 'space'
9028
- },
9029
- paddingStart: {
9030
- property: 'paddingStart',
9031
- scale: 'space'
9032
- },
9033
- paddingTop: {
9034
- property: 'paddingTop',
9035
- scale: 'space'
9036
- },
9037
- paddingVertical: {
9038
- property: 'paddingVertical',
9039
- scale: 'space'
9040
- }
9041
- };
9042
- var radii = {
9043
- borderBottomEndRadius: {
9044
- property: 'borderBottomEndRadius',
9045
- scale: 'radii'
9046
- },
9047
- borderBottomLeftRadius: {
9048
- property: 'borderBottomLeftRadius',
9049
- scale: 'radii'
9050
- },
9051
- borderBottomRightRadius: {
9052
- property: 'borderBottomRightRadius',
9053
- scale: 'radii'
9054
- },
9055
- borderBottomStartRadius: {
9056
- property: 'borderBottomStartRadius',
9057
- scale: 'radii'
9058
- },
9059
- borderTopEndRadius: {
9060
- property: 'borderTopEndRadius',
9061
- scale: 'radii'
9062
- },
9063
- borderTopLeftRadius: {
9064
- property: 'borderTopLeftRadius',
9065
- scale: 'radii'
9066
- },
9067
- borderTopRightRadius: {
9068
- property: 'borderTopRightRadius',
9069
- scale: 'radii'
9070
- },
9071
- borderTopStartRadius: {
9072
- property: 'borderTopStartRadius',
9073
- scale: 'radii'
9074
- },
9075
- borderRadius: {
9076
- property: 'borderRadius',
9077
- scale: 'radii'
9078
- }
9079
- };
9080
- var borderWidths = {
9081
- borderWidth: {
9082
- property: 'borderWidth',
9083
- scale: 'borderWidths'
9084
- },
9085
- borderBottomWidth: {
9086
- property: 'borderBottomWidth',
9087
- scale: 'borderWidths'
9088
- },
9089
- borderTopWidth: {
9090
- property: 'borderTopWidth',
9091
- scale: 'borderWidths'
9092
- },
9093
- borderLeftWidth: {
9094
- property: 'borderLeftWidth',
9095
- scale: 'borderWidths'
9096
- },
9097
- borderRightWidth: {
9098
- property: 'borderRightWidth',
9099
- scale: 'borderWidths'
9100
- }
9101
- };
9102
- var config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, colors), space), radii), borderWidths);
9103
- var flexPropsKey = ['alignContent', 'alignItems', 'alignSelf', 'display', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent'];
9104
-
9105
- var _excluded$n = ["theme"];
9106
- var getThemeValue = function getThemeValue(theme, key, props) {
9107
- var propConfig = config[key];
9108
- var propValue = props[key];
9109
- if (!propValue) return undefined;
9110
- var scale = propConfig.scale,
9111
- property = propConfig.property;
9112
- switch (scale) {
9113
- case 'colors':
9114
- return _defineProperty({}, property, theme.colors[propValue]);
9115
- case 'space':
9116
- return _defineProperty({}, property, theme.space[propValue]);
9117
- case 'radii':
9118
- return _defineProperty({}, property, theme.radii[propValue]);
9119
- case 'borderWidths':
9120
- return _defineProperty({}, property, theme.borderWidths[propValue]);
9121
- }
9122
- };
9123
- var mapStylePropToThemeValue = function mapStylePropToThemeValue(theme, props) {
9124
- var entries = Object.keys(props);
9125
- return entries.reduce(function (result, key) {
9126
- return _objectSpread2(_objectSpread2({}, result), getThemeValue(theme, key, props));
9127
- }, {});
9210
+ style: {
9211
+ opacity: interpolateOpacity
9212
+ },
9213
+ onPress: onRequestClose
9214
+ }), /*#__PURE__*/React.createElement(StyledBottomSheet, {
9215
+ style: [style, {
9216
+ transform: [{
9217
+ scaleY: height > 0 ? 1 : 0
9218
+ }, {
9219
+ translateY: interpolateY
9220
+ }]
9221
+ }]
9222
+ }, header !== undefined ? /*#__PURE__*/React.createElement(Header, {
9223
+ content: header,
9224
+ showDivider: internalShowDivider,
9225
+ onRequestClose: onRequestClose,
9226
+ showCloseButton: showCloseButton
9227
+ }) : null, /*#__PURE__*/React.createElement(BottomSheetContext.Provider, {
9228
+ value: BottomSheetContextValue
9229
+ }, children), footer ? /*#__PURE__*/React.createElement(Footer$1, {
9230
+ showDivider: showDivider
9231
+ }, footer) : null))));
9128
9232
  };
9129
- var configKeys = Object.keys(config);
9130
- var StyledBox = index$a(View)(function (_ref5) {
9131
- var theme = _ref5.theme,
9132
- otherProps = _objectWithoutProperties(_ref5, _excluded$n);
9133
- var styleProps = pick(configKeys, otherProps);
9134
- var flexProps = pick(_toConsumableArray(flexPropsKey), otherProps);
9135
- return _objectSpread2(_objectSpread2({}, mapStylePropToThemeValue(theme, styleProps)), flexProps);
9233
+ var BottomSheet$1 = Object.assign(BottomSheet, {
9234
+ ScrollView: BottomSheetScrollView
9136
9235
  });
9137
9236
 
9138
- var _excluded$m = ["children", "style", "testID"];
9139
- var Box = function Box(_ref) {
9140
- var children = _ref.children,
9141
- style = _ref.style,
9142
- testID = _ref.testID,
9143
- otherProps = _objectWithoutProperties(_ref, _excluded$m);
9144
- return /*#__PURE__*/React.createElement(StyledBox, _extends$1({}, otherProps, {
9145
- style: style,
9146
- testID: testID
9147
- }), children);
9148
- };
9149
-
9150
9237
  function requiredArgs(required, args) {
9151
9238
  if (args.length < required) {
9152
9239
  throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
@@ -11726,243 +11813,58 @@ var Calendar = function Calendar(_ref) {
11726
11813
  })), /*#__PURE__*/React.createElement(StyledCalendarRow, null, daysOfPreviousMonth.map(function (date) {
11727
11814
  return date ? /*#__PURE__*/React.createElement(CalendarRowItem, {
11728
11815
  key: date.toDateString(),
11729
- date: date,
11730
- isCurrent: isEqDate(now, date),
11731
- isSelected: isEqDate(value, date),
11732
- onPress: function onPress() {
11733
- return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11734
- },
11735
- textIntent: "subdued",
11736
- marked: parsedMaskedDate[date.toDateString()]
11737
- }) : /*#__PURE__*/React.createElement(StyledDisabledCalendarRowItem, {
11738
- testID: "calendar-disabled-cell"
11739
- });
11740
- }), daysOfCurrentMonth.map(function (date) {
11741
- return date ? /*#__PURE__*/React.createElement(CalendarRowItem, {
11742
- key: date.toDateString(),
11743
- date: date,
11744
- isCurrent: isEqDate(now, date),
11745
- isSelected: isEqDate(value, date),
11746
- onPress: function onPress() {
11747
- return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11748
- },
11749
- marked: parsedMaskedDate[date.toDateString()]
11750
- }) : /*#__PURE__*/React.createElement(StyledDisabledCalendarRowItem, {
11751
- testID: "calendar-disabled-cell"
11752
- });
11753
- }), daysOfNextMonth.map(function (date) {
11754
- return date ? /*#__PURE__*/React.createElement(CalendarRowItem, {
11755
- key: date.toDateString(),
11756
- date: date,
11757
- isCurrent: isEqDate(now, date),
11758
- isSelected: isEqDate(value, date),
11759
- onPress: function onPress() {
11760
- return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11761
- },
11762
- textIntent: "subdued",
11763
- marked: parsedMaskedDate[date.toDateString()]
11764
- }) : /*#__PURE__*/React.createElement(StyledDisabledCalendarRowItem, {
11765
- testID: "calendar-disabled-cell"
11766
- });
11767
- })), Platform.OS === 'android' && monthPickerVisible && /*#__PURE__*/React.createElement(MonthYearPickerDialogueAndroid, {
11768
- doneButtonLabel: monthPickerConfirmLabel,
11769
- cancelButtonLabel: monthPickerCancelLabel,
11770
- value: value,
11771
- minimumDate: minDate,
11772
- maximumDate: maxDate,
11773
- onChange: function onChange(action, date) {
11774
- setMonthPickerVisible(false);
11775
- onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(false);
11776
- if (action === 'dateSetAction' && !!date) {
11777
- onMonthChange(date);
11778
- }
11779
- }
11780
- })));
11781
- };
11782
-
11783
- var _excluded$l = ["rounded", "size", "testID", "style"];
11784
- var Image = function Image(_ref) {
11785
- var _ref$rounded = _ref.rounded,
11786
- rounded = _ref$rounded === void 0 ? false : _ref$rounded,
11787
- _ref$size = _ref.size,
11788
- size = _ref$size === void 0 ? '6xlarge' : _ref$size,
11789
- testID = _ref.testID,
11790
- style = _ref.style,
11791
- imageNativeProps = _objectWithoutProperties(_ref, _excluded$l);
11792
- var theme = useTheme();
11793
- var imageSize = theme.__hd__.image.sizes[size];
11794
- return /*#__PURE__*/React.createElement(Image$1, _extends$1({
11795
- testID: testID,
11796
- style: [{
11797
- width: imageSize,
11798
- height: imageSize,
11799
- borderRadius: rounded ? imageSize / 2 : 0
11800
- }, style]
11801
- }, imageNativeProps));
11802
- };
11803
-
11804
- var StyledPageControl$2 = index$a(View)(function () {
11805
- return {
11806
- flexDirection: 'row',
11807
- alignItems: 'center'
11808
- };
11809
- });
11810
- var StyledPageControlAnimatedView = index$a(Animated.View)(function (_ref) {
11811
- var theme = _ref.theme;
11812
- return {
11813
- height: theme.__hd__.pageControl.sizes.paginatorHeight,
11814
- width: theme.__hd__.pageControl.sizes.paginatorWidth,
11815
- borderRadius: theme.__hd__.pageControl.radii.paginatorBorderRadius,
11816
- backgroundColor: theme.__hd__.pageControl.colors.paginatorBackgroundColor,
11817
- marginHorizontal: theme.__hd__.pageControl.space.paginatorMarginHorizontal
11818
- };
11819
- });
11820
-
11821
- var PageControl = function PageControl(_ref) {
11822
- var numberOfPages = _ref.numberOfPages,
11823
- _ref$currentPage = _ref.currentPage,
11824
- currentPage = _ref$currentPage === void 0 ? 0 : _ref$currentPage,
11825
- testID = _ref.testID,
11826
- style = _ref.style;
11827
- var theme = useTheme();
11828
- var animatedValue = React.useRef(new Animated.Value(currentPage)).current;
11829
- React.useEffect(function () {
11830
- animatedValue.setValue(currentPage);
11831
- }, [currentPage]);
11832
- return /*#__PURE__*/React.createElement(StyledPageControl$2, {
11833
- testID: testID,
11834
- style: style
11835
- }, new Array(numberOfPages).fill('').map(function (_, index) {
11836
- var inputRange = [index - 1, index, index + 1];
11837
- var indicatorWidth = animatedValue.interpolate({
11838
- inputRange: inputRange,
11839
- outputRange: [theme.space.small, theme.space.large, theme.space.small],
11840
- extrapolate: 'clamp'
11841
- });
11842
- var opacity = animatedValue.interpolate({
11843
- inputRange: inputRange,
11844
- outputRange: [0.5, 1, 0.5],
11845
- extrapolate: 'clamp'
11846
- });
11847
- return /*#__PURE__*/React.createElement(StyledPageControlAnimatedView, {
11848
- accessibilityState: {
11849
- selected: index === currentPage
11850
- },
11851
- style: [{
11852
- width: indicatorWidth,
11853
- opacity: opacity
11854
- }],
11855
- key: index.toString(),
11856
- testID: "page-control-indicator".concat(index)
11857
- });
11858
- }));
11859
- };
11860
-
11861
- var StyledBackDrop = index$a(View)(function (_ref) {
11862
- var themeSlideBackground = _ref.themeSlideBackground;
11863
- return {
11864
- position: 'absolute',
11865
- backgroundColor: themeSlideBackground,
11866
- top: 0,
11867
- bottom: 0,
11868
- right: 0,
11869
- left: 0
11870
- };
11871
- });
11872
- var StyledCarouselView = index$a(View)(function () {
11873
- return {
11874
- flexGrow: 2,
11875
- justifyContent: 'space-between'
11876
- };
11877
- });
11878
- var StyledCarouselHeading = index$a(Typography.Title)(function (_ref2) {
11879
- var theme = _ref2.theme;
11880
- return {
11881
- marginTop: theme.__hd__.carousel.space.headingMarginTop,
11882
- marginBottom: theme.__hd__.carousel.space.headingMarginBottom
11883
- };
11884
- });
11885
- var StyledCarouselImage = index$a(Image)(function () {
11886
- return {
11887
- flexGrow: 2,
11888
- flex: 1,
11889
- width: '100%',
11890
- resizeMode: 'contain'
11891
- };
11892
- });
11893
- var StyledCustomSizeCarouselImage = index$a(Image)(function (_ref3) {
11894
- var height = _ref3.height,
11895
- _ref3$resizeMode = _ref3.resizeMode,
11896
- resizeMode = _ref3$resizeMode === void 0 ? 'contain' : _ref3$resizeMode,
11897
- width = _ref3.width;
11898
- return {
11899
- alignSelf: 'center',
11900
- width: width,
11901
- height: height,
11902
- resizeMode: resizeMode
11903
- };
11904
- });
11905
- var StyledCarouselContentWrapper = index$a(Box)(function (_ref4) {
11906
- var width = _ref4.width;
11907
- return {
11908
- width: width
11909
- };
11910
- });
11911
- var StyledCarouselFooterWrapper = index$a(View)(function (_ref5) {
11912
- var theme = _ref5.theme;
11913
- return {
11914
- paddingHorizontal: theme.__hd__.carousel.space.footerPaddingHorizontal,
11915
- flexDirection: 'row',
11916
- justifyContent: 'space-between',
11917
- paddingVertical: theme.__hd__.carousel.space.footerPaddingVertical,
11918
- marginBottom: theme.__hd__.carousel.space.footerMarginBottom
11919
- };
11920
- });
11921
- var StyledPageControl$1 = index$a(PageControl)(function (_ref6) {
11922
- var theme = _ref6.theme;
11923
- return {
11924
- paddingVertical: theme.__hd__.carousel.space.pageControlPaddingVertical
11925
- };
11926
- });
11927
- var StyledPageControlWrapper = index$a(View)(function (_ref7) {
11928
- var theme = _ref7.theme;
11929
- return {
11930
- alignItems: 'center',
11931
- justifyContent: 'center',
11932
- height: theme.__hd__.carousel.space.pageControlWrapperHeight
11933
- };
11934
- });
11935
-
11936
- function isCarouselImageProps(image) {
11937
- return _typeof(image) === 'object';
11938
- }
11939
- var CarouselItem = function CarouselItem(_ref) {
11940
- var width = _ref.width,
11941
- image = _ref.image,
11942
- content = _ref.content,
11943
- heading = _ref.heading,
11944
- body = _ref.body;
11945
- return /*#__PURE__*/React.createElement(Box, {
11946
- style: {
11947
- width: width
11816
+ date: date,
11817
+ isCurrent: isEqDate(now, date),
11818
+ isSelected: isEqDate(value, date),
11819
+ onPress: function onPress() {
11820
+ return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11821
+ },
11822
+ textIntent: "subdued",
11823
+ marked: parsedMaskedDate[date.toDateString()]
11824
+ }) : /*#__PURE__*/React.createElement(StyledDisabledCalendarRowItem, {
11825
+ testID: "calendar-disabled-cell"
11826
+ });
11827
+ }), daysOfCurrentMonth.map(function (date) {
11828
+ return date ? /*#__PURE__*/React.createElement(CalendarRowItem, {
11829
+ key: date.toDateString(),
11830
+ date: date,
11831
+ isCurrent: isEqDate(now, date),
11832
+ isSelected: isEqDate(value, date),
11833
+ onPress: function onPress() {
11834
+ return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11835
+ },
11836
+ marked: parsedMaskedDate[date.toDateString()]
11837
+ }) : /*#__PURE__*/React.createElement(StyledDisabledCalendarRowItem, {
11838
+ testID: "calendar-disabled-cell"
11839
+ });
11840
+ }), daysOfNextMonth.map(function (date) {
11841
+ return date ? /*#__PURE__*/React.createElement(CalendarRowItem, {
11842
+ key: date.toDateString(),
11843
+ date: date,
11844
+ isCurrent: isEqDate(now, date),
11845
+ isSelected: isEqDate(value, date),
11846
+ onPress: function onPress() {
11847
+ return onChange === null || onChange === void 0 ? void 0 : onChange(date);
11848
+ },
11849
+ textIntent: "subdued",
11850
+ marked: parsedMaskedDate[date.toDateString()]
11851
+ }) : /*#__PURE__*/React.createElement(StyledDisabledCalendarRowItem, {
11852
+ testID: "calendar-disabled-cell"
11853
+ });
11854
+ })), Platform.OS === 'android' && monthPickerVisible && /*#__PURE__*/React.createElement(MonthYearPickerDialogueAndroid, {
11855
+ doneButtonLabel: monthPickerConfirmLabel,
11856
+ cancelButtonLabel: monthPickerCancelLabel,
11857
+ value: value,
11858
+ minimumDate: minDate,
11859
+ maximumDate: maxDate,
11860
+ onChange: function onChange(action, date) {
11861
+ setMonthPickerVisible(false);
11862
+ onToggleMonthPicker === null || onToggleMonthPicker === void 0 || onToggleMonthPicker(false);
11863
+ if (action === 'dateSetAction' && !!date) {
11864
+ onMonthChange(date);
11865
+ }
11948
11866
  }
11949
- }, image && (isCarouselImageProps(image) ? /*#__PURE__*/React.createElement(StyledCustomSizeCarouselImage, {
11950
- source: image,
11951
- height: image.height,
11952
- width: image.width,
11953
- resizeMode: image.resizeMode
11954
- }) : /*#__PURE__*/React.createElement(StyledCarouselImage, {
11955
- source: typeof image === 'string' ? {
11956
- uri: image
11957
- } : image
11958
- })), /*#__PURE__*/React.createElement(StyledCarouselContentWrapper, {
11959
- paddingHorizontal: "large",
11960
- marginTop: "large",
11961
- width: width
11962
- }, content, /*#__PURE__*/React.createElement(StyledCarouselHeading, {
11963
- level: "h1",
11964
- typeface: "playful"
11965
- }, heading), body ? /*#__PURE__*/React.createElement(Typography.Body, null, body) : null));
11867
+ })));
11966
11868
  };
11967
11869
 
11968
11870
  var StyledDataCard = index$a(View)(function (_ref) {
@@ -11983,12 +11885,12 @@ var Indicator = index$a(View)(function (_ref2) {
11983
11885
  };
11984
11886
  });
11985
11887
 
11986
- var _excluded$k = ["intent", "children"];
11888
+ var _excluded$l = ["intent", "children"];
11987
11889
  var DataCard = function DataCard(_ref) {
11988
11890
  var _ref$intent = _ref.intent,
11989
11891
  intent = _ref$intent === void 0 ? 'info' : _ref$intent,
11990
11892
  children = _ref.children,
11991
- nativeProps = _objectWithoutProperties(_ref, _excluded$k);
11893
+ nativeProps = _objectWithoutProperties(_ref, _excluded$l);
11992
11894
  return /*#__PURE__*/React.createElement(StyledDataCard, nativeProps, /*#__PURE__*/React.createElement(Indicator, {
11993
11895
  themeIntent: intent,
11994
11896
  testID: "data-card-indicator"
@@ -12006,11 +11908,11 @@ var StyledCard$1 = index$a(View)(function (_ref) {
12006
11908
  });
12007
11909
  });
12008
11910
 
12009
- var _excluded$j = ["intent", "children"];
11911
+ var _excluded$k = ["intent", "children"];
12010
11912
  var Card = function Card(_ref) {
12011
11913
  var intent = _ref.intent,
12012
11914
  children = _ref.children,
12013
- nativeProps = _objectWithoutProperties(_ref, _excluded$j);
11915
+ nativeProps = _objectWithoutProperties(_ref, _excluded$k);
12014
11916
  return /*#__PURE__*/React.createElement(StyledCard$1, _extends$1({}, nativeProps, {
12015
11917
  themeIntent: intent
12016
11918
  }), children);
@@ -12019,7 +11921,64 @@ var Card$1 = Object.assign(Card, {
12019
11921
  Data: DataCard
12020
11922
  });
12021
11923
 
12022
- var StyledPageControl = index$a(PageControl)(function (_ref) {
11924
+ var StyledPageControl$2 = index$a(View)(function () {
11925
+ return {
11926
+ flexDirection: 'row',
11927
+ alignItems: 'center'
11928
+ };
11929
+ });
11930
+ var StyledPageControlAnimatedView = index$a(Animated.View)(function (_ref) {
11931
+ var theme = _ref.theme;
11932
+ return {
11933
+ height: theme.__hd__.pageControl.sizes.paginatorHeight,
11934
+ width: theme.__hd__.pageControl.sizes.paginatorWidth,
11935
+ borderRadius: theme.__hd__.pageControl.radii.paginatorBorderRadius,
11936
+ backgroundColor: theme.__hd__.pageControl.colors.paginatorBackgroundColor,
11937
+ marginHorizontal: theme.__hd__.pageControl.space.paginatorMarginHorizontal
11938
+ };
11939
+ });
11940
+
11941
+ var PageControl = function PageControl(_ref) {
11942
+ var numberOfPages = _ref.numberOfPages,
11943
+ _ref$currentPage = _ref.currentPage,
11944
+ currentPage = _ref$currentPage === void 0 ? 0 : _ref$currentPage,
11945
+ testID = _ref.testID,
11946
+ style = _ref.style;
11947
+ var theme = useTheme();
11948
+ var animatedValue = React.useRef(new Animated.Value(currentPage)).current;
11949
+ React.useEffect(function () {
11950
+ animatedValue.setValue(currentPage);
11951
+ }, [currentPage]);
11952
+ return /*#__PURE__*/React.createElement(StyledPageControl$2, {
11953
+ testID: testID,
11954
+ style: style
11955
+ }, new Array(numberOfPages).fill('').map(function (_, index) {
11956
+ var inputRange = [index - 1, index, index + 1];
11957
+ var indicatorWidth = animatedValue.interpolate({
11958
+ inputRange: inputRange,
11959
+ outputRange: [theme.space.small, theme.space.large, theme.space.small],
11960
+ extrapolate: 'clamp'
11961
+ });
11962
+ var opacity = animatedValue.interpolate({
11963
+ inputRange: inputRange,
11964
+ outputRange: [0.5, 1, 0.5],
11965
+ extrapolate: 'clamp'
11966
+ });
11967
+ return /*#__PURE__*/React.createElement(StyledPageControlAnimatedView, {
11968
+ accessibilityState: {
11969
+ selected: index === currentPage
11970
+ },
11971
+ style: [{
11972
+ width: indicatorWidth,
11973
+ opacity: opacity
11974
+ }],
11975
+ key: index.toString(),
11976
+ testID: "page-control-indicator".concat(index)
11977
+ });
11978
+ }));
11979
+ };
11980
+
11981
+ var StyledPageControl$1 = index$a(PageControl)(function (_ref) {
12023
11982
  var theme = _ref.theme;
12024
11983
  return {
12025
11984
  alignSelf: 'center',
@@ -12219,7 +12178,7 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
12219
12178
  viewabilityConfig: {
12220
12179
  itemVisiblePercentThreshold: 80
12221
12180
  }
12222
- }), !hidePageControl && /*#__PURE__*/React.createElement(StyledPageControl, {
12181
+ }), !hidePageControl && /*#__PURE__*/React.createElement(StyledPageControl$1, {
12223
12182
  testID: "pageControl",
12224
12183
  currentPage: currentIndex,
12225
12184
  numberOfPages: items.length
@@ -12227,6 +12186,134 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
12227
12186
  });
12228
12187
  CardCarousel.displayName = 'CardCarousel';
12229
12188
 
12189
+ var _excluded$j = ["rounded", "size", "testID", "style"];
12190
+ var Image = function Image(_ref) {
12191
+ var _ref$rounded = _ref.rounded,
12192
+ rounded = _ref$rounded === void 0 ? false : _ref$rounded,
12193
+ _ref$size = _ref.size,
12194
+ size = _ref$size === void 0 ? '6xlarge' : _ref$size,
12195
+ testID = _ref.testID,
12196
+ style = _ref.style,
12197
+ imageNativeProps = _objectWithoutProperties(_ref, _excluded$j);
12198
+ var theme = useTheme();
12199
+ var imageSize = theme.__hd__.image.sizes[size];
12200
+ return /*#__PURE__*/React.createElement(Image$1, _extends$1({
12201
+ testID: testID,
12202
+ style: [{
12203
+ width: imageSize,
12204
+ height: imageSize,
12205
+ borderRadius: rounded ? imageSize / 2 : 0
12206
+ }, style]
12207
+ }, imageNativeProps));
12208
+ };
12209
+
12210
+ var StyledBackDrop = index$a(View)(function (_ref) {
12211
+ var themeSlideBackground = _ref.themeSlideBackground;
12212
+ return {
12213
+ position: 'absolute',
12214
+ backgroundColor: themeSlideBackground,
12215
+ top: 0,
12216
+ bottom: 0,
12217
+ right: 0,
12218
+ left: 0
12219
+ };
12220
+ });
12221
+ var StyledCarouselView = index$a(View)(function () {
12222
+ return {
12223
+ flexGrow: 2,
12224
+ justifyContent: 'space-between'
12225
+ };
12226
+ });
12227
+ var StyledCarouselHeading = index$a(Typography.Title)(function (_ref2) {
12228
+ var theme = _ref2.theme;
12229
+ return {
12230
+ marginTop: theme.__hd__.carousel.space.headingMarginTop,
12231
+ marginBottom: theme.__hd__.carousel.space.headingMarginBottom
12232
+ };
12233
+ });
12234
+ var StyledCarouselImage = index$a(Image)(function () {
12235
+ return {
12236
+ flexGrow: 2,
12237
+ flex: 1,
12238
+ width: '100%',
12239
+ resizeMode: 'contain'
12240
+ };
12241
+ });
12242
+ var StyledCustomSizeCarouselImage = index$a(Image)(function (_ref3) {
12243
+ var height = _ref3.height,
12244
+ _ref3$resizeMode = _ref3.resizeMode,
12245
+ resizeMode = _ref3$resizeMode === void 0 ? 'contain' : _ref3$resizeMode,
12246
+ width = _ref3.width;
12247
+ return {
12248
+ alignSelf: 'center',
12249
+ width: width,
12250
+ height: height,
12251
+ resizeMode: resizeMode
12252
+ };
12253
+ });
12254
+ var StyledCarouselContentWrapper = index$a(Box)(function (_ref4) {
12255
+ var width = _ref4.width;
12256
+ return {
12257
+ width: width
12258
+ };
12259
+ });
12260
+ var StyledCarouselFooterWrapper = index$a(View)(function (_ref5) {
12261
+ var theme = _ref5.theme;
12262
+ return {
12263
+ paddingHorizontal: theme.__hd__.carousel.space.footerPaddingHorizontal,
12264
+ flexDirection: 'row',
12265
+ justifyContent: 'space-between',
12266
+ paddingVertical: theme.__hd__.carousel.space.footerPaddingVertical,
12267
+ marginBottom: theme.__hd__.carousel.space.footerMarginBottom
12268
+ };
12269
+ });
12270
+ var StyledPageControl = index$a(PageControl)(function (_ref6) {
12271
+ var theme = _ref6.theme;
12272
+ return {
12273
+ paddingVertical: theme.__hd__.carousel.space.pageControlPaddingVertical
12274
+ };
12275
+ });
12276
+ var StyledPageControlWrapper = index$a(View)(function (_ref7) {
12277
+ var theme = _ref7.theme;
12278
+ return {
12279
+ alignItems: 'center',
12280
+ justifyContent: 'center',
12281
+ height: theme.__hd__.carousel.space.pageControlWrapperHeight
12282
+ };
12283
+ });
12284
+
12285
+ function isCarouselImageProps(image) {
12286
+ return _typeof(image) === 'object';
12287
+ }
12288
+ var CarouselItem = function CarouselItem(_ref) {
12289
+ var width = _ref.width,
12290
+ image = _ref.image,
12291
+ content = _ref.content,
12292
+ heading = _ref.heading,
12293
+ body = _ref.body;
12294
+ return /*#__PURE__*/React.createElement(Box, {
12295
+ style: {
12296
+ width: width
12297
+ }
12298
+ }, image && (isCarouselImageProps(image) ? /*#__PURE__*/React.createElement(StyledCustomSizeCarouselImage, {
12299
+ source: image,
12300
+ height: image.height,
12301
+ width: image.width,
12302
+ resizeMode: image.resizeMode
12303
+ }) : /*#__PURE__*/React.createElement(StyledCarouselImage, {
12304
+ source: typeof image === 'string' ? {
12305
+ uri: image
12306
+ } : image
12307
+ })), /*#__PURE__*/React.createElement(StyledCarouselContentWrapper, {
12308
+ paddingHorizontal: "large",
12309
+ marginTop: "large",
12310
+ width: width
12311
+ }, content, /*#__PURE__*/React.createElement(StyledCarouselHeading, {
12312
+ level: "h1",
12313
+ typeface: "playful"
12314
+ }, heading), body ? /*#__PURE__*/React.createElement(Typography.Body, null, body) : null));
12315
+ };
12316
+
12230
12317
  var _excluded$i = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "shouldShowPagination", "testID", "pageControlPosition"];
12231
12318
  function useStateFromProp(initialValue) {
12232
12319
  var _useState = useState(initialValue),
@@ -12242,6 +12329,7 @@ var noop = function noop(_) {
12242
12329
  return true;
12243
12330
  };
12244
12331
  var Carousel = function Carousel(_ref) {
12332
+ var _items$currentSlideIn;
12245
12333
  var items = _ref.items,
12246
12334
  onItemIndexChange = _ref.onItemIndexChange,
12247
12335
  renderActions = _ref.renderActions,
@@ -12256,6 +12344,7 @@ var Carousel = function Carousel(_ref) {
12256
12344
  nativeProps = _objectWithoutProperties(_ref, _excluded$i);
12257
12345
  useDeprecation("shouldShowPagination prop has been deprecated", shouldShowPagination !== noop);
12258
12346
  useDeprecation("The use of 'pageControlPosition == bottom' has been deprecated", pageControlPosition === 'bottom');
12347
+ var theme = useTheme();
12259
12348
  var carouselRef = useRef(null);
12260
12349
  var _useStateFromProp = useStateFromProp(selectedItemIndex),
12261
12350
  _useStateFromProp2 = _slicedToArray(_useStateFromProp, 2),
@@ -12287,20 +12376,20 @@ var Carousel = function Carousel(_ref) {
12287
12376
  var viewConfig = useRef({
12288
12377
  viewAreaCoveragePercentThreshold: 50
12289
12378
  }).current;
12290
- var onViewCallBack = React.useCallback(function (info) {
12379
+ var onViewCallBack = useRef(function (info) {
12291
12380
  var firstVisibleItem = info.viewableItems.find(function (view) {
12292
12381
  return view.index != null && view.isViewable;
12293
12382
  });
12294
12383
  if (firstVisibleItem) {
12295
12384
  internalOnItemIndexChange(firstVisibleItem.index || 0);
12296
12385
  }
12297
- }, [internalOnItemIndexChange]);
12386
+ });
12298
12387
  return /*#__PURE__*/React.createElement(View, _extends$1({
12299
12388
  style: style,
12300
12389
  testID: testID
12301
12390
  }, nativeProps), /*#__PURE__*/React.createElement(StyledBackDrop, {
12302
- themeSlideBackground: items[currentSlideIndex].background
12303
- }), /*#__PURE__*/React.createElement(StyledPageControlWrapper, null, pageControlPosition === 'top' && shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React.createElement(StyledPageControl$1, {
12391
+ themeSlideBackground: ((_items$currentSlideIn = items[currentSlideIndex]) === null || _items$currentSlideIn === void 0 ? void 0 : _items$currentSlideIn.background) || theme.colors.defaultGlobalSurface
12392
+ }), /*#__PURE__*/React.createElement(StyledPageControlWrapper, null, pageControlPosition === 'top' && shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React.createElement(StyledPageControl, {
12304
12393
  numberOfPages: items.length,
12305
12394
  currentPage: currentSlideIndex
12306
12395
  })), /*#__PURE__*/React.createElement(StyledCarouselView, null, /*#__PURE__*/React.createElement(FlatList, {
@@ -12310,7 +12399,7 @@ var Carousel = function Carousel(_ref) {
12310
12399
  pagingEnabled: true,
12311
12400
  bounces: false,
12312
12401
  data: items,
12313
- onViewableItemsChanged: onViewCallBack,
12402
+ onViewableItemsChanged: onViewCallBack.current,
12314
12403
  viewabilityConfig: viewConfig,
12315
12404
  scrollEventThrottle: 32,
12316
12405
  ref: carouselRef,
@@ -12338,7 +12427,7 @@ var Carousel = function Carousel(_ref) {
12338
12427
  width: width
12339
12428
  });
12340
12429
  }
12341
- }), /*#__PURE__*/React.createElement(StyledCarouselFooterWrapper, null, renderActions && renderActions(currentSlideIndex), pageControlPosition === 'bottom' && shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React.createElement(StyledPageControl$1, {
12430
+ }), /*#__PURE__*/React.createElement(StyledCarouselFooterWrapper, null, renderActions && renderActions(currentSlideIndex), pageControlPosition === 'bottom' && shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React.createElement(StyledPageControl, {
12342
12431
  numberOfPages: items.length,
12343
12432
  currentPage: currentSlideIndex
12344
12433
  }))));