@hero-design/rn 9.5.4-test.1 → 9.6.0-testonly.1

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
@@ -1,5 +1,5 @@
1
1
  import * as reactNative from 'react-native';
2
- import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View, UIManager, LayoutAnimation, TouchableOpacity, Text as Text$1, Easing, Image as Image$1, Pressable, SafeAreaView, KeyboardAvoidingView, TouchableHighlight, ScrollView, Modal as Modal$1, FlatList, useWindowDimensions, TextInput as TextInput$1, PanResponder, BackHandler, InteractionManager, Keyboard, SectionList, TouchableWithoutFeedback, RefreshControl as RefreshControl$1 } from 'react-native';
2
+ import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View, UIManager, LayoutAnimation, TouchableOpacity, Text as Text$1, Easing, Image as Image$1, Pressable, SafeAreaView, KeyboardAvoidingView, TouchableHighlight, ScrollView, BackHandler, FlatList, useWindowDimensions, TextInput as TextInput$1, PanResponder, Modal as Modal$1, InteractionManager, Keyboard, SectionList, TouchableWithoutFeedback, RefreshControl as RefreshControl$1 } from 'react-native';
3
3
  import React, { useContext, createContext, createElement, useMemo, forwardRef, useEffect, useCallback, useRef, useState, memo, useReducer, useLayoutEffect, useImperativeHandle, isValidElement } from 'react';
4
4
  import { createIconSet } from 'react-native-vector-icons';
5
5
  import { MonthYearPickerViewIOS, MonthYearPickerDialogueAndroid } from '@hero-design/react-native-month-year-picker';
@@ -998,9 +998,16 @@ var palette$b = {
998
998
  black: '#000000',
999
999
  white: '#ffffff',
1000
1000
  blue: blue$1.base,
1001
+ blueDark15: blue$1.darken15,
1001
1002
  blueDark30: blue$1.darken30,
1003
+ blueDark45: blue$1.darken45,
1004
+ blueDark60: blue$1.darken60,
1002
1005
  blueDark75: blue$1.darken75,
1006
+ blueDark90: blue$1.darken90,
1007
+ blueLight15: blue$1.lighten15,
1003
1008
  blueLight30: blue$1.lighten30,
1009
+ blueLight45: blue$1.lighten45,
1010
+ blueLight60: blue$1.lighten60,
1004
1011
  blueLight75: blue$1.lighten75,
1005
1012
  blueLight90: blue$1.lighten90,
1006
1013
  cloudLight90: cloud.lighten90,
@@ -1071,10 +1078,13 @@ var palette$b = {
1071
1078
  red: vermilion$2.base,
1072
1079
  redDark15: vermilion$2.darken15,
1073
1080
  redDark30: vermilion$2.darken30,
1081
+ redDark45: vermilion$2.darken45,
1074
1082
  redDark60: vermilion$2.darken60,
1075
1083
  redDark75: vermilion$2.darken75,
1084
+ redDark90: vermilion$2.darken90,
1076
1085
  redLight15: vermilion$2.lighten15,
1077
1086
  redLight30: vermilion$2.lighten30,
1087
+ redLight45: vermilion$2.lighten45,
1078
1088
  redLight60: vermilion$2.lighten60,
1079
1089
  redLight75: vermilion$2.lighten75,
1080
1090
  redLight90: vermilion$2.lighten90,
@@ -1091,7 +1101,10 @@ var palette$b = {
1091
1101
  violetDark45: violet$1.darken45,
1092
1102
  violetDark60: violet$1.darken60,
1093
1103
  violetDark75: violet$1.darken75,
1104
+ violetDark90: violet$1.darken90,
1105
+ violetLight15: violet$1.lighten15,
1094
1106
  violetLight30: violet$1.lighten30,
1107
+ violetLight45: violet$1.lighten45,
1095
1108
  violetLight60: violet$1.lighten60,
1096
1109
  violetLight75: violet$1.lighten75,
1097
1110
  violetLight90: violet$1.lighten90,
@@ -7161,8 +7174,8 @@ var Alert = function Alert(_ref2) {
7161
7174
  return /*#__PURE__*/React.createElement(Container$1, {
7162
7175
  themeVariant: variant,
7163
7176
  themeIntent: intent,
7164
- style: style,
7165
- testID: testID
7177
+ testID: testID,
7178
+ style: style
7166
7179
  }, /*#__PURE__*/React.createElement(ContentContainer$1, {
7167
7180
  showDivider: !!onClose
7168
7181
  }, icon !== null ? /*#__PURE__*/React.createElement(AlertIcon, {
@@ -8209,119 +8222,99 @@ var BottomSheetScrollView = function BottomSheetScrollView(_ref) {
8209
8222
  }));
8210
8223
  };
8211
8224
 
8212
- var BottomSheet = function BottomSheet(_ref) {
8213
- var open = _ref.open,
8214
- header = _ref.header,
8215
- footer = _ref.footer,
8216
- children = _ref.children,
8217
- onAnimationEnd = _ref.onAnimationEnd,
8218
- onOpen = _ref.onOpen,
8219
- onRequestClose = _ref.onRequestClose,
8220
- onDismiss = _ref.onDismiss,
8221
- _ref$showCloseButton = _ref.showCloseButton,
8222
- showCloseButton = _ref$showCloseButton === void 0 ? true : _ref$showCloseButton,
8223
- _ref$hasBackdrop = _ref.hasBackdrop,
8224
- hasBackdrop = _ref$hasBackdrop === void 0 ? true : _ref$hasBackdrop,
8225
- _ref$showDivider = _ref.showDivider,
8226
- showDivider = _ref$showDivider === void 0 ? false : _ref$showDivider,
8227
- style = _ref.style,
8228
- testID = _ref.testID,
8229
- _ref$keyboardAvoiding = _ref.keyboardAvoidingViewProps,
8230
- keyboardAvoidingViewProps = _ref$keyboardAvoiding === void 0 ? {} : _ref$keyboardAvoiding;
8231
- var _Dimensions$get = Dimensions.get('window'),
8232
- height = _Dimensions$get.height;
8233
- // Internal state to control modal open/close timing with animation
8234
- var _useState = useState(open),
8235
- _useState2 = _slicedToArray(_useState, 2),
8236
- visible = _useState2[0],
8237
- setVisibility = _useState2[1];
8238
- var animatedValue = useRef(new Animated.Value(open ? 0 : 1));
8239
- var _useState3 = useState(showDivider),
8240
- _useState4 = _slicedToArray(_useState3, 2),
8241
- internalShowDivider = _useState4[0],
8242
- setInternalShowDivider = _useState4[1];
8243
- useEffect(function () {
8244
- // Show the modal before the open animation start
8245
- if (open && !visible) {
8246
- setVisibility(open);
8225
+ var customAlphabet = function customAlphabet(alphabet) {
8226
+ var defaultSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 21;
8227
+ return function () {
8228
+ var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSize;
8229
+ var id = '';
8230
+ var i = size;
8231
+ while (i--) {
8232
+ id += alphabet[Math.random() * alphabet.length | 0];
8247
8233
  }
8248
- // Delay closing the modal until after the closing animation end
8249
- animatedValue.current.removeAllListeners();
8250
- animatedValue.current.addListener(function (_ref2) {
8251
- var value = _ref2.value;
8252
- var endValueOfTransition = open ? 1 : 0;
8253
- if (endValueOfTransition === 0 && value === endValueOfTransition) {
8254
- setVisibility(false);
8255
- onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
8256
- }
8234
+ return id;
8235
+ };
8236
+ };
8237
+
8238
+ var ACTIONS;
8239
+ (function (ACTIONS) {
8240
+ ACTIONS[ACTIONS["REGISTER_HOST"] = 0] = "REGISTER_HOST";
8241
+ ACTIONS[ACTIONS["DEREGISTER_HOST"] = 1] = "DEREGISTER_HOST";
8242
+ ACTIONS[ACTIONS["ADD_UPDATE_PORTAL"] = 2] = "ADD_UPDATE_PORTAL";
8243
+ ACTIONS[ACTIONS["REMOVE_PORTAL"] = 3] = "REMOVE_PORTAL";
8244
+ })(ACTIONS || (ACTIONS = {}));
8245
+ var INITIAL_STATE = {};
8246
+
8247
+ var PortalStateContext = /*#__PURE__*/createContext(null);
8248
+ var PortalDispatchContext = /*#__PURE__*/createContext(null);
8249
+
8250
+ var usePortal = function usePortal() {
8251
+ var hostName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'root';
8252
+ var dispatch = useContext(PortalDispatchContext);
8253
+ if (dispatch === null) {
8254
+ throw new Error("You must add 'PortalProvider' to the root component.");
8255
+ }
8256
+ var registerHost = useCallback(function () {
8257
+ dispatch({
8258
+ type: ACTIONS.REGISTER_HOST,
8259
+ hostName: hostName
8257
8260
  });
8258
- return function () {
8259
- return animatedValue.current.removeAllListeners();
8260
- };
8261
- }, [open]);
8262
- // Animation
8263
- useEffect(function () {
8264
- var animation = Animated.timing(animatedValue.current, {
8265
- toValue: open ? 1 : 0,
8266
- easing: Easing.inOut(Easing.cubic),
8267
- useNativeDriver: true
8261
+ }, []);
8262
+ var deregisterHost = useCallback(function () {
8263
+ dispatch({
8264
+ type: ACTIONS.DEREGISTER_HOST,
8265
+ hostName: hostName
8268
8266
  });
8269
- animation.start(onAnimationEnd);
8267
+ }, []);
8268
+ var addUpdatePortal = useCallback(function (name, node) {
8269
+ dispatch({
8270
+ type: ACTIONS.ADD_UPDATE_PORTAL,
8271
+ hostName: hostName,
8272
+ portalName: name,
8273
+ node: node
8274
+ });
8275
+ }, []);
8276
+ var removePortal = useCallback(function (name) {
8277
+ dispatch({
8278
+ type: ACTIONS.REMOVE_PORTAL,
8279
+ hostName: hostName,
8280
+ portalName: name
8281
+ });
8282
+ }, []);
8283
+ return {
8284
+ registerHost: registerHost,
8285
+ deregisterHost: deregisterHost,
8286
+ addPortal: addUpdatePortal,
8287
+ updatePortal: addUpdatePortal,
8288
+ removePortal: removePortal
8289
+ };
8290
+ };
8291
+
8292
+ var usePortalState = function usePortalState(hostName) {
8293
+ var state = useContext(PortalStateContext);
8294
+ if (state === null) {
8295
+ throw new Error("You must add 'PortalProvider' to the root component.");
8296
+ }
8297
+ return state[hostName] || [];
8298
+ };
8299
+
8300
+ var PortalHostComponent = function PortalHostComponent(_ref) {
8301
+ var name = _ref.name;
8302
+ var state = usePortalState(name);
8303
+ var _usePortal = usePortal(name),
8304
+ registerHost = _usePortal.registerHost,
8305
+ deregisterHost = _usePortal.deregisterHost;
8306
+ useEffect(function () {
8307
+ registerHost();
8270
8308
  return function () {
8271
- return animation.stop();
8272
- };
8273
- }, [open]);
8274
- var interpolateY = animatedValue.current.interpolate({
8275
- inputRange: [0, 1],
8276
- outputRange: [height, 0]
8277
- });
8278
- // Backdrop opacity
8279
- var interpolateOpacity = hasBackdrop ? animatedValue.current.interpolate({
8280
- inputRange: [0, 1],
8281
- outputRange: [0, 0.48]
8282
- }) : 0;
8283
- var BottomSheetContextValue = useMemo(function () {
8284
- return {
8285
- setInternalShowDivider: setInternalShowDivider
8309
+ deregisterHost();
8286
8310
  };
8287
- }, [setInternalShowDivider]);
8288
- return /*#__PURE__*/React.createElement(Modal$1, {
8289
- visible: visible,
8290
- onRequestClose: onRequestClose,
8291
- transparent: true,
8292
- testID: testID,
8293
- onShow: onOpen
8294
- }, /*#__PURE__*/React.createElement(StyledWrapper$9, {
8295
- pointerEvents: "box-none"
8296
- }, /*#__PURE__*/React.createElement(StyledKeyboardAvoidingView, _extends$1({
8297
- behavior: Platform.OS === 'ios' ? 'padding' : 'height'
8298
- }, keyboardAvoidingViewProps), /*#__PURE__*/React.createElement(StyledBackdrop$2, {
8299
- style: {
8300
- opacity: interpolateOpacity
8301
- },
8302
- onPress: onRequestClose
8303
- }), /*#__PURE__*/React.createElement(StyledBottomSheet, {
8304
- style: [style, {
8305
- transform: [{
8306
- scaleY: height > 0 ? 1 : 0
8307
- }, {
8308
- translateY: interpolateY
8309
- }]
8310
- }]
8311
- }, header !== undefined ? /*#__PURE__*/React.createElement(Header, {
8312
- content: header,
8313
- showDivider: internalShowDivider,
8314
- onRequestClose: onRequestClose,
8315
- showCloseButton: showCloseButton
8316
- }) : null, /*#__PURE__*/React.createElement(BottomSheetContext.Provider, {
8317
- value: BottomSheetContextValue
8318
- }, children), footer ? /*#__PURE__*/React.createElement(Footer$1, {
8319
- showDivider: showDivider
8320
- }, footer) : null))));
8311
+ }, []);
8312
+ return /*#__PURE__*/React.createElement(React.Fragment, null, state.map(function (item) {
8313
+ return item.node;
8314
+ }));
8321
8315
  };
8322
- var BottomSheet$1 = Object.assign(BottomSheet, {
8323
- ScrollView: BottomSheetScrollView
8324
- });
8316
+ var PortalHost = /*#__PURE__*/memo(PortalHostComponent);
8317
+ PortalHost.displayName = 'PortalHost';
8325
8318
 
8326
8319
  Platform.OS === 'ios';
8327
8320
  var isAndroid = Platform.OS === 'android';
@@ -8340,236 +8333,582 @@ function omit(keys, obj) {
8340
8333
  return result;
8341
8334
  }
8342
8335
 
8343
- var colors = {
8344
- backgroundColor: {
8345
- property: 'backgroundColor',
8346
- scale: 'colors'
8347
- },
8348
- bgColor: {
8349
- property: 'backgroundColor',
8350
- scale: 'colors'
8351
- },
8352
- borderColor: {
8353
- property: 'borderColor',
8354
- scale: 'colors'
8355
- },
8356
- borderTopColor: {
8357
- property: 'borderTopColor',
8358
- scale: 'colors'
8359
- },
8360
- borderBottomColor: {
8361
- property: 'borderBottomColor',
8362
- scale: 'colors'
8363
- },
8364
- borderStartColor: {
8365
- property: 'borderStartColor',
8366
- scale: 'colors'
8367
- },
8368
- borderEndColor: {
8369
- property: 'borderEndColor',
8370
- scale: 'colors'
8371
- },
8372
- borderLeftColor: {
8373
- property: 'borderLeftColor',
8374
- scale: 'colors'
8375
- },
8376
- borderRightColor: {
8377
- property: 'borderRightColor',
8378
- scale: 'colors'
8336
+ var registerHostIfNotExist = function registerHostIfNotExist(state, hostName) {
8337
+ if (!(hostName in state)) {
8338
+ return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, hostName, []));
8379
8339
  }
8340
+ return _objectSpread2({}, state);
8380
8341
  };
8381
- var space = {
8382
- margin: {
8383
- property: 'margin',
8384
- scale: 'space'
8385
- },
8386
- marginBottom: {
8387
- property: 'marginBottom',
8388
- scale: 'space'
8389
- },
8390
- marginEnd: {
8391
- property: 'marginEnd',
8392
- scale: 'space'
8393
- },
8394
- marginHorizontal: {
8395
- property: 'marginHorizontal',
8396
- scale: 'space'
8397
- },
8398
- marginLeft: {
8399
- property: 'marginLeft',
8400
- scale: 'space'
8401
- },
8402
- marginRight: {
8403
- property: 'marginRight',
8404
- scale: 'space'
8405
- },
8406
- marginStart: {
8407
- property: 'marginStart',
8408
- scale: 'space'
8409
- },
8410
- marginTop: {
8411
- property: 'marginTop',
8412
- scale: 'space'
8413
- },
8414
- marginVertical: {
8415
- property: 'marginVertical',
8416
- scale: 'space'
8417
- },
8418
- padding: {
8419
- property: 'padding',
8420
- scale: 'space'
8421
- },
8422
- paddingBottom: {
8423
- property: 'paddingBottom',
8424
- scale: 'space'
8425
- },
8426
- paddingEnd: {
8427
- property: 'paddingEnd',
8428
- scale: 'space'
8429
- },
8430
- paddingHorizontal: {
8431
- property: 'paddingHorizontal',
8432
- scale: 'space'
8433
- },
8434
- paddingLeft: {
8435
- property: 'paddingLeft',
8436
- scale: 'space'
8437
- },
8438
- paddingRight: {
8439
- property: 'paddingRight',
8440
- scale: 'space'
8441
- },
8442
- paddingStart: {
8443
- property: 'paddingStart',
8444
- scale: 'space'
8445
- },
8446
- paddingTop: {
8447
- property: 'paddingTop',
8448
- scale: 'space'
8449
- },
8450
- paddingVertical: {
8451
- property: 'paddingVertical',
8452
- scale: 'space'
8342
+ var deregisterHost = function deregisterHost(state, hostName) {
8343
+ return _objectSpread2({}, omit([hostName], state));
8344
+ };
8345
+ var addUpdatePortal = function addUpdatePortal(state, hostName, portalName, node) {
8346
+ var newState = registerHostIfNotExist(state, hostName);
8347
+ var index = newState[hostName].findIndex(function (item) {
8348
+ return item.name === portalName;
8349
+ });
8350
+ if (index !== -1) {
8351
+ return _objectSpread2(_objectSpread2({}, newState), {}, _defineProperty({}, hostName, newState[hostName].map(function (item, i) {
8352
+ if (index === i) {
8353
+ return _objectSpread2(_objectSpread2({}, item), {}, {
8354
+ node: node
8355
+ });
8356
+ }
8357
+ return item;
8358
+ })));
8453
8359
  }
8360
+ return _objectSpread2(_objectSpread2({}, newState), {}, _defineProperty({}, hostName, [].concat(_toConsumableArray(newState[hostName]), [{
8361
+ name: portalName,
8362
+ node: node
8363
+ }])));
8454
8364
  };
8455
- var radii = {
8456
- borderBottomEndRadius: {
8457
- property: 'borderBottomEndRadius',
8458
- scale: 'radii'
8459
- },
8460
- borderBottomLeftRadius: {
8461
- property: 'borderBottomLeftRadius',
8462
- scale: 'radii'
8463
- },
8464
- borderBottomRightRadius: {
8465
- property: 'borderBottomRightRadius',
8466
- scale: 'radii'
8467
- },
8468
- borderBottomStartRadius: {
8469
- property: 'borderBottomStartRadius',
8470
- scale: 'radii'
8471
- },
8472
- borderTopEndRadius: {
8473
- property: 'borderTopEndRadius',
8474
- scale: 'radii'
8475
- },
8476
- borderTopLeftRadius: {
8477
- property: 'borderTopLeftRadius',
8478
- scale: 'radii'
8479
- },
8480
- borderTopRightRadius: {
8481
- property: 'borderTopRightRadius',
8482
- scale: 'radii'
8483
- },
8484
- borderTopStartRadius: {
8485
- property: 'borderTopStartRadius',
8486
- scale: 'radii'
8487
- },
8488
- borderRadius: {
8489
- property: 'borderRadius',
8490
- scale: 'radii'
8365
+ var removePortal = function removePortal(state, hostName, portalName) {
8366
+ if (!(hostName in state)) {
8367
+ return _objectSpread2({}, state);
8491
8368
  }
8369
+ return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, hostName, state[hostName].filter(function (item) {
8370
+ return item.name !== portalName;
8371
+ })));
8492
8372
  };
8493
- var borderWidths = {
8494
- borderWidth: {
8495
- property: 'borderWidth',
8496
- scale: 'borderWidths'
8497
- },
8498
- borderBottomWidth: {
8499
- property: 'borderBottomWidth',
8500
- scale: 'borderWidths'
8501
- },
8502
- borderTopWidth: {
8503
- property: 'borderTopWidth',
8504
- scale: 'borderWidths'
8505
- },
8506
- borderLeftWidth: {
8507
- property: 'borderLeftWidth',
8508
- scale: 'borderWidths'
8509
- },
8510
- borderRightWidth: {
8511
- property: 'borderRightWidth',
8512
- scale: 'borderWidths'
8373
+ var reducer = function reducer(state, action) {
8374
+ var type = action.type;
8375
+ switch (type) {
8376
+ case ACTIONS.REGISTER_HOST:
8377
+ return registerHostIfNotExist(state, action.hostName);
8378
+ case ACTIONS.DEREGISTER_HOST:
8379
+ return deregisterHost(state, action.hostName);
8380
+ case ACTIONS.ADD_UPDATE_PORTAL:
8381
+ return addUpdatePortal(state, action.hostName, action.portalName, action.node);
8382
+ case ACTIONS.REMOVE_PORTAL:
8383
+ return removePortal(state, action.hostName, action.portalName);
8384
+ default:
8385
+ return _objectSpread2({}, state);
8513
8386
  }
8514
8387
  };
8515
- var config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, colors), space), radii), borderWidths);
8516
- var flexPropsKey = ['alignContent', 'alignItems', 'alignSelf', 'display', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent'];
8517
8388
 
8518
- var _excluded$m = ["theme"];
8519
- var getThemeValue = function getThemeValue(theme, key, props) {
8520
- var propConfig = config[key];
8521
- var propValue = props[key];
8522
- if (!propValue) return undefined;
8523
- var scale = propConfig.scale,
8524
- property = propConfig.property;
8525
- switch (scale) {
8526
- case 'colors':
8527
- return _defineProperty({}, property, theme.colors[propValue]);
8528
- case 'space':
8529
- return _defineProperty({}, property, theme.space[propValue]);
8530
- case 'radii':
8531
- return _defineProperty({}, property, theme.radii[propValue]);
8532
- case 'borderWidths':
8533
- return _defineProperty({}, property, theme.borderWidths[propValue]);
8534
- }
8389
+ var PortalProviderComponent = function PortalProviderComponent(_ref) {
8390
+ var _ref$rootHostName = _ref.rootHostName,
8391
+ rootHostName = _ref$rootHostName === void 0 ? 'root' : _ref$rootHostName,
8392
+ children = _ref.children;
8393
+ var _useReducer = useReducer(reducer, INITIAL_STATE),
8394
+ _useReducer2 = _slicedToArray(_useReducer, 2),
8395
+ state = _useReducer2[0],
8396
+ dispatch = _useReducer2[1];
8397
+ return /*#__PURE__*/React.createElement(PortalDispatchContext.Provider, {
8398
+ value: dispatch
8399
+ }, /*#__PURE__*/React.createElement(PortalStateContext.Provider, {
8400
+ value: state
8401
+ }, children, /*#__PURE__*/React.createElement(PortalHost, {
8402
+ name: rootHostName
8403
+ })));
8535
8404
  };
8536
- var mapStylePropToThemeValue = function mapStylePropToThemeValue(theme, props) {
8537
- var entries = Object.keys(props);
8538
- return entries.reduce(function (result, key) {
8539
- return _objectSpread2(_objectSpread2({}, result), getThemeValue(theme, key, props));
8540
- }, {});
8405
+ var PortalProvider = /*#__PURE__*/memo(PortalProviderComponent);
8406
+ PortalProvider.displayName = 'PortalProvider';
8407
+
8408
+ var nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz0123456789', 10);
8409
+ var PortalComponent = function PortalComponent(_ref) {
8410
+ var name = _ref.name,
8411
+ hostName = _ref.hostName,
8412
+ children = _ref.children,
8413
+ theme = _ref.theme;
8414
+ var defaultTheme = useTheme();
8415
+ var _usePortal = usePortal(hostName),
8416
+ addUpdatePortal = _usePortal.addPortal,
8417
+ removePortal = _usePortal.removePortal;
8418
+ var nameOrRandom = useMemo(function () {
8419
+ return name || nanoid();
8420
+ }, [name]);
8421
+ var ChildrenComponent = useMemo(function () {
8422
+ return /*#__PURE__*/React.createElement(ThemeProvider, {
8423
+ theme: theme || defaultTheme
8424
+ }, children);
8425
+ }, [theme, children, defaultTheme]);
8426
+ useLayoutEffect(function () {
8427
+ addUpdatePortal(nameOrRandom, ChildrenComponent);
8428
+ return function () {
8429
+ removePortal(nameOrRandom);
8430
+ };
8431
+ }, [addUpdatePortal]);
8432
+ useLayoutEffect(function () {
8433
+ addUpdatePortal(nameOrRandom, ChildrenComponent);
8434
+ }, [ChildrenComponent]);
8435
+ return null;
8541
8436
  };
8542
- var configKeys = Object.keys(config);
8543
- var StyledBox = index$a(View)(function (_ref5) {
8544
- var theme = _ref5.theme,
8545
- otherProps = _objectWithoutProperties(_ref5, _excluded$m);
8546
- var styleProps = pick(configKeys, otherProps);
8547
- var flexProps = pick(_toConsumableArray(flexPropsKey), otherProps);
8548
- return _objectSpread2(_objectSpread2({}, mapStylePropToThemeValue(theme, styleProps)), flexProps);
8437
+ var Portal = /*#__PURE__*/memo(PortalComponent);
8438
+ Portal.displayName = 'Portal';
8439
+ var Portal$1 = Object.assign(Portal, {
8440
+ Provider: PortalProvider,
8441
+ Host: PortalHost
8549
8442
  });
8550
8443
 
8551
- var _excluded$l = ["children", "style", "testID"];
8552
- var Box = function Box(_ref) {
8444
+ var _excluded$m = ["visible"];
8445
+ var DEFAULT_BACKDROP_OPACITY = 0.4;
8446
+ var DEFAULT_ANIMATION_CONFIG = {
8447
+ easing: Easing.inOut(Easing.cubic),
8448
+ useNativeDriver: Platform.OS !== 'web',
8449
+ duration: 400
8450
+ };
8451
+ var Modal = /*#__PURE__*/forwardRef(function (_ref, ref) {
8553
8452
  var children = _ref.children,
8554
- style = _ref.style,
8453
+ onShow = _ref.onShow,
8454
+ onRequestClose = _ref.onRequestClose,
8555
8455
  testID = _ref.testID,
8556
- otherProps = _objectWithoutProperties(_ref, _excluded$l);
8557
- return /*#__PURE__*/React.createElement(StyledBox, _extends$1({}, otherProps, {
8558
- style: style,
8559
- testID: testID
8560
- }), children);
8561
- };
8562
-
8563
- function _typeof(obj) {
8564
- "@babel/helpers - typeof";
8565
-
8566
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
8567
- return typeof obj;
8568
- } : function (obj) {
8569
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8570
- }, _typeof(obj);
8571
- }
8572
-
8456
+ _ref$animationType = _ref.animationType,
8457
+ animationType = _ref$animationType === void 0 ? 'none' : _ref$animationType,
8458
+ _ref$transparent = _ref.transparent,
8459
+ transparent = _ref$transparent === void 0 ? false : _ref$transparent,
8460
+ onDismiss = _ref.onDismiss;
8461
+ var theme = useTheme();
8462
+ var animatedBackdropValue = useRef(new Animated.Value(0)).current;
8463
+ var animatedModalValue = useRef(new Animated.Value(0)).current;
8464
+ // Show or hide the backdrop and modal content
8465
+ var animateBackdropAndContent = useCallback(function (_ref2) {
8466
+ var toValue = _ref2.toValue,
8467
+ callback = _ref2.callback;
8468
+ if (animationType !== 'none') {
8469
+ // Backdrop animation
8470
+ if (!transparent) {
8471
+ Animated.timing(animatedBackdropValue, _objectSpread2({
8472
+ toValue: toValue
8473
+ }, DEFAULT_ANIMATION_CONFIG)).start();
8474
+ }
8475
+ // Modal content animation
8476
+ Animated.timing(animatedModalValue, _objectSpread2({
8477
+ toValue: toValue
8478
+ }, DEFAULT_ANIMATION_CONFIG)).start(callback);
8479
+ } else {
8480
+ callback === null || callback === void 0 ? void 0 : callback();
8481
+ }
8482
+ }, [animationType, onShow, transparent]);
8483
+ var backdropOpacityAnimation = animatedBackdropValue.interpolate({
8484
+ inputRange: [0, 1],
8485
+ outputRange: [0, DEFAULT_BACKDROP_OPACITY]
8486
+ });
8487
+ var modalAnimation = animatedModalValue.interpolate({
8488
+ inputRange: [0, 1],
8489
+ outputRange: animationType === 'slide' ? [Dimensions.get('window').height, 0] : [0, 1]
8490
+ });
8491
+ useImperativeHandle(ref, function () {
8492
+ return {
8493
+ show: function show() {
8494
+ animateBackdropAndContent({
8495
+ toValue: 1,
8496
+ callback: onShow
8497
+ });
8498
+ },
8499
+ hide: function hide(wrapperCallback) {
8500
+ animateBackdropAndContent({
8501
+ toValue: 0,
8502
+ callback: function callback() {
8503
+ if (Platform.OS === 'ios') {
8504
+ onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
8505
+ }
8506
+ wrapperCallback();
8507
+ }
8508
+ });
8509
+ }
8510
+ };
8511
+ }, [onDismiss, onShow, animateBackdropAndContent]);
8512
+ // Back button handler
8513
+ useEffect(function () {
8514
+ var backHandler = BackHandler.addEventListener('hardwareBackPress', function () {
8515
+ onRequestClose === null || onRequestClose === void 0 ? void 0 : onRequestClose();
8516
+ return true;
8517
+ });
8518
+ return function () {
8519
+ return backHandler.remove();
8520
+ };
8521
+ }, [onRequestClose]);
8522
+ return /*#__PURE__*/React.createElement(Portal$1, null, /*#__PURE__*/React.createElement(Animated.View, {
8523
+ style: _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
8524
+ backgroundColor: transparent ? 'transparent' : theme.colors.overlayGlobalSurface,
8525
+ opacity: animationType !== 'none' ? backdropOpacityAnimation : DEFAULT_BACKDROP_OPACITY
8526
+ })
8527
+ }), /*#__PURE__*/React.createElement(Animated.View, {
8528
+ testID: testID,
8529
+ style: _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
8530
+ opacity: animationType === 'fade' ? modalAnimation : 1,
8531
+ transform: [{
8532
+ translateY: animationType === 'slide' ? modalAnimation : 0
8533
+ }]
8534
+ })
8535
+ }, children));
8536
+ });
8537
+ var ModalWrapper = function ModalWrapper(_ref3) {
8538
+ var _ref3$visible = _ref3.visible,
8539
+ visible = _ref3$visible === void 0 ? true : _ref3$visible,
8540
+ props = _objectWithoutProperties(_ref3, _excluded$m);
8541
+ var modalRef = useRef(null);
8542
+ var _useState = useState(visible),
8543
+ _useState2 = _slicedToArray(_useState, 2),
8544
+ internalVisible = _useState2[0],
8545
+ setInternalVisible = _useState2[1];
8546
+ useEffect(function () {
8547
+ if (visible) {
8548
+ setInternalVisible(true);
8549
+ } else {
8550
+ var _modalRef$current;
8551
+ // Wait for animation to finish before hiding the modal
8552
+ (_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : _modalRef$current.hide(function () {
8553
+ return setInternalVisible(false);
8554
+ });
8555
+ }
8556
+ }, [visible]);
8557
+ useEffect(function () {
8558
+ if (internalVisible) {
8559
+ var _modalRef$current2;
8560
+ (_modalRef$current2 = modalRef.current) === null || _modalRef$current2 === void 0 ? void 0 : _modalRef$current2.show();
8561
+ }
8562
+ }, [internalVisible]);
8563
+ return internalVisible ? /*#__PURE__*/React.createElement(Modal, _extends$1({
8564
+ ref: modalRef
8565
+ }, props)) : null;
8566
+ };
8567
+
8568
+ var BottomSheet = function BottomSheet(_ref) {
8569
+ var open = _ref.open,
8570
+ header = _ref.header,
8571
+ footer = _ref.footer,
8572
+ children = _ref.children,
8573
+ onAnimationEnd = _ref.onAnimationEnd,
8574
+ onOpen = _ref.onOpen,
8575
+ onRequestClose = _ref.onRequestClose,
8576
+ onDismiss = _ref.onDismiss,
8577
+ _ref$showCloseButton = _ref.showCloseButton,
8578
+ showCloseButton = _ref$showCloseButton === void 0 ? true : _ref$showCloseButton,
8579
+ _ref$hasBackdrop = _ref.hasBackdrop,
8580
+ hasBackdrop = _ref$hasBackdrop === void 0 ? true : _ref$hasBackdrop,
8581
+ _ref$showDivider = _ref.showDivider,
8582
+ showDivider = _ref$showDivider === void 0 ? false : _ref$showDivider,
8583
+ style = _ref.style,
8584
+ testID = _ref.testID,
8585
+ _ref$keyboardAvoiding = _ref.keyboardAvoidingViewProps,
8586
+ keyboardAvoidingViewProps = _ref$keyboardAvoiding === void 0 ? {} : _ref$keyboardAvoiding;
8587
+ var _Dimensions$get = Dimensions.get('window'),
8588
+ height = _Dimensions$get.height;
8589
+ // Internal state to control modal open/close timing with animation
8590
+ var _useState = useState(open),
8591
+ _useState2 = _slicedToArray(_useState, 2),
8592
+ visible = _useState2[0],
8593
+ setVisibility = _useState2[1];
8594
+ var animatedValue = useRef(new Animated.Value(open ? 0 : 1));
8595
+ var _useState3 = useState(showDivider),
8596
+ _useState4 = _slicedToArray(_useState3, 2),
8597
+ internalShowDivider = _useState4[0],
8598
+ setInternalShowDivider = _useState4[1];
8599
+ useEffect(function () {
8600
+ // Show the modal before the open animation start
8601
+ if (open && !visible) {
8602
+ setVisibility(open);
8603
+ }
8604
+ // Delay closing the modal until after the closing animation end
8605
+ animatedValue.current.removeAllListeners();
8606
+ animatedValue.current.addListener(function (_ref2) {
8607
+ var value = _ref2.value;
8608
+ var endValueOfTransition = open ? 1 : 0;
8609
+ if (endValueOfTransition === 0 && value === endValueOfTransition) {
8610
+ setVisibility(false);
8611
+ onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
8612
+ }
8613
+ });
8614
+ return function () {
8615
+ return animatedValue.current.removeAllListeners();
8616
+ };
8617
+ }, [open]);
8618
+ // Animation
8619
+ useEffect(function () {
8620
+ var animation = Animated.timing(animatedValue.current, {
8621
+ toValue: open ? 1 : 0,
8622
+ easing: Easing.inOut(Easing.cubic),
8623
+ useNativeDriver: true
8624
+ });
8625
+ animation.start(onAnimationEnd);
8626
+ return function () {
8627
+ return animation.stop();
8628
+ };
8629
+ }, [open]);
8630
+ var interpolateY = animatedValue.current.interpolate({
8631
+ inputRange: [0, 1],
8632
+ outputRange: [height, 0]
8633
+ });
8634
+ // Backdrop opacity
8635
+ var interpolateOpacity = hasBackdrop ? animatedValue.current.interpolate({
8636
+ inputRange: [0, 1],
8637
+ outputRange: [0, 0.48]
8638
+ }) : 0;
8639
+ var BottomSheetContextValue = useMemo(function () {
8640
+ return {
8641
+ setInternalShowDivider: setInternalShowDivider
8642
+ };
8643
+ }, [setInternalShowDivider]);
8644
+ return /*#__PURE__*/React.createElement(ModalWrapper, {
8645
+ visible: visible,
8646
+ onRequestClose: onRequestClose,
8647
+ transparent: true,
8648
+ testID: testID,
8649
+ onShow: onOpen
8650
+ }, /*#__PURE__*/React.createElement(StyledWrapper$9, {
8651
+ pointerEvents: "box-none"
8652
+ }, /*#__PURE__*/React.createElement(StyledKeyboardAvoidingView, _extends$1({
8653
+ behavior: Platform.OS === 'ios' ? 'padding' : 'height'
8654
+ }, keyboardAvoidingViewProps), /*#__PURE__*/React.createElement(StyledBackdrop$2, {
8655
+ style: {
8656
+ opacity: interpolateOpacity
8657
+ },
8658
+ onPress: onRequestClose
8659
+ }), /*#__PURE__*/React.createElement(StyledBottomSheet, {
8660
+ style: [style, {
8661
+ transform: [{
8662
+ scaleY: height > 0 ? 1 : 0
8663
+ }, {
8664
+ translateY: interpolateY
8665
+ }]
8666
+ }]
8667
+ }, header !== undefined ? /*#__PURE__*/React.createElement(Header, {
8668
+ content: header,
8669
+ showDivider: internalShowDivider,
8670
+ onRequestClose: onRequestClose,
8671
+ showCloseButton: showCloseButton
8672
+ }) : null, /*#__PURE__*/React.createElement(BottomSheetContext.Provider, {
8673
+ value: BottomSheetContextValue
8674
+ }, children), footer ? /*#__PURE__*/React.createElement(Footer$1, {
8675
+ showDivider: showDivider
8676
+ }, footer) : null))));
8677
+ };
8678
+ var BottomSheet$1 = Object.assign(BottomSheet, {
8679
+ ScrollView: BottomSheetScrollView
8680
+ });
8681
+
8682
+ var colors = {
8683
+ backgroundColor: {
8684
+ property: 'backgroundColor',
8685
+ scale: 'colors'
8686
+ },
8687
+ bgColor: {
8688
+ property: 'backgroundColor',
8689
+ scale: 'colors'
8690
+ },
8691
+ borderColor: {
8692
+ property: 'borderColor',
8693
+ scale: 'colors'
8694
+ },
8695
+ borderTopColor: {
8696
+ property: 'borderTopColor',
8697
+ scale: 'colors'
8698
+ },
8699
+ borderBottomColor: {
8700
+ property: 'borderBottomColor',
8701
+ scale: 'colors'
8702
+ },
8703
+ borderStartColor: {
8704
+ property: 'borderStartColor',
8705
+ scale: 'colors'
8706
+ },
8707
+ borderEndColor: {
8708
+ property: 'borderEndColor',
8709
+ scale: 'colors'
8710
+ },
8711
+ borderLeftColor: {
8712
+ property: 'borderLeftColor',
8713
+ scale: 'colors'
8714
+ },
8715
+ borderRightColor: {
8716
+ property: 'borderRightColor',
8717
+ scale: 'colors'
8718
+ }
8719
+ };
8720
+ var space = {
8721
+ margin: {
8722
+ property: 'margin',
8723
+ scale: 'space'
8724
+ },
8725
+ marginBottom: {
8726
+ property: 'marginBottom',
8727
+ scale: 'space'
8728
+ },
8729
+ marginEnd: {
8730
+ property: 'marginEnd',
8731
+ scale: 'space'
8732
+ },
8733
+ marginHorizontal: {
8734
+ property: 'marginHorizontal',
8735
+ scale: 'space'
8736
+ },
8737
+ marginLeft: {
8738
+ property: 'marginLeft',
8739
+ scale: 'space'
8740
+ },
8741
+ marginRight: {
8742
+ property: 'marginRight',
8743
+ scale: 'space'
8744
+ },
8745
+ marginStart: {
8746
+ property: 'marginStart',
8747
+ scale: 'space'
8748
+ },
8749
+ marginTop: {
8750
+ property: 'marginTop',
8751
+ scale: 'space'
8752
+ },
8753
+ marginVertical: {
8754
+ property: 'marginVertical',
8755
+ scale: 'space'
8756
+ },
8757
+ padding: {
8758
+ property: 'padding',
8759
+ scale: 'space'
8760
+ },
8761
+ paddingBottom: {
8762
+ property: 'paddingBottom',
8763
+ scale: 'space'
8764
+ },
8765
+ paddingEnd: {
8766
+ property: 'paddingEnd',
8767
+ scale: 'space'
8768
+ },
8769
+ paddingHorizontal: {
8770
+ property: 'paddingHorizontal',
8771
+ scale: 'space'
8772
+ },
8773
+ paddingLeft: {
8774
+ property: 'paddingLeft',
8775
+ scale: 'space'
8776
+ },
8777
+ paddingRight: {
8778
+ property: 'paddingRight',
8779
+ scale: 'space'
8780
+ },
8781
+ paddingStart: {
8782
+ property: 'paddingStart',
8783
+ scale: 'space'
8784
+ },
8785
+ paddingTop: {
8786
+ property: 'paddingTop',
8787
+ scale: 'space'
8788
+ },
8789
+ paddingVertical: {
8790
+ property: 'paddingVertical',
8791
+ scale: 'space'
8792
+ }
8793
+ };
8794
+ var radii = {
8795
+ borderBottomEndRadius: {
8796
+ property: 'borderBottomEndRadius',
8797
+ scale: 'radii'
8798
+ },
8799
+ borderBottomLeftRadius: {
8800
+ property: 'borderBottomLeftRadius',
8801
+ scale: 'radii'
8802
+ },
8803
+ borderBottomRightRadius: {
8804
+ property: 'borderBottomRightRadius',
8805
+ scale: 'radii'
8806
+ },
8807
+ borderBottomStartRadius: {
8808
+ property: 'borderBottomStartRadius',
8809
+ scale: 'radii'
8810
+ },
8811
+ borderTopEndRadius: {
8812
+ property: 'borderTopEndRadius',
8813
+ scale: 'radii'
8814
+ },
8815
+ borderTopLeftRadius: {
8816
+ property: 'borderTopLeftRadius',
8817
+ scale: 'radii'
8818
+ },
8819
+ borderTopRightRadius: {
8820
+ property: 'borderTopRightRadius',
8821
+ scale: 'radii'
8822
+ },
8823
+ borderTopStartRadius: {
8824
+ property: 'borderTopStartRadius',
8825
+ scale: 'radii'
8826
+ },
8827
+ borderRadius: {
8828
+ property: 'borderRadius',
8829
+ scale: 'radii'
8830
+ }
8831
+ };
8832
+ var borderWidths = {
8833
+ borderWidth: {
8834
+ property: 'borderWidth',
8835
+ scale: 'borderWidths'
8836
+ },
8837
+ borderBottomWidth: {
8838
+ property: 'borderBottomWidth',
8839
+ scale: 'borderWidths'
8840
+ },
8841
+ borderTopWidth: {
8842
+ property: 'borderTopWidth',
8843
+ scale: 'borderWidths'
8844
+ },
8845
+ borderLeftWidth: {
8846
+ property: 'borderLeftWidth',
8847
+ scale: 'borderWidths'
8848
+ },
8849
+ borderRightWidth: {
8850
+ property: 'borderRightWidth',
8851
+ scale: 'borderWidths'
8852
+ }
8853
+ };
8854
+ var config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, colors), space), radii), borderWidths);
8855
+ var flexPropsKey = ['alignContent', 'alignItems', 'alignSelf', 'display', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent'];
8856
+
8857
+ var _excluded$l = ["theme"];
8858
+ var getThemeValue = function getThemeValue(theme, key, props) {
8859
+ var propConfig = config[key];
8860
+ var propValue = props[key];
8861
+ if (!propValue) return undefined;
8862
+ var scale = propConfig.scale,
8863
+ property = propConfig.property;
8864
+ switch (scale) {
8865
+ case 'colors':
8866
+ return _defineProperty({}, property, theme.colors[propValue]);
8867
+ case 'space':
8868
+ return _defineProperty({}, property, theme.space[propValue]);
8869
+ case 'radii':
8870
+ return _defineProperty({}, property, theme.radii[propValue]);
8871
+ case 'borderWidths':
8872
+ return _defineProperty({}, property, theme.borderWidths[propValue]);
8873
+ }
8874
+ };
8875
+ var mapStylePropToThemeValue = function mapStylePropToThemeValue(theme, props) {
8876
+ var entries = Object.keys(props);
8877
+ return entries.reduce(function (result, key) {
8878
+ return _objectSpread2(_objectSpread2({}, result), getThemeValue(theme, key, props));
8879
+ }, {});
8880
+ };
8881
+ var configKeys = Object.keys(config);
8882
+ var StyledBox = index$a(View)(function (_ref5) {
8883
+ var theme = _ref5.theme,
8884
+ otherProps = _objectWithoutProperties(_ref5, _excluded$l);
8885
+ var styleProps = pick(configKeys, otherProps);
8886
+ var flexProps = pick(_toConsumableArray(flexPropsKey), otherProps);
8887
+ return _objectSpread2(_objectSpread2({}, mapStylePropToThemeValue(theme, styleProps)), flexProps);
8888
+ });
8889
+
8890
+ var _excluded$k = ["children", "style", "testID"];
8891
+ var Box = function Box(_ref) {
8892
+ var children = _ref.children,
8893
+ style = _ref.style,
8894
+ testID = _ref.testID,
8895
+ otherProps = _objectWithoutProperties(_ref, _excluded$k);
8896
+ return /*#__PURE__*/React.createElement(StyledBox, _extends$1({}, otherProps, {
8897
+ style: style,
8898
+ testID: testID
8899
+ }), children);
8900
+ };
8901
+
8902
+ function _typeof(obj) {
8903
+ "@babel/helpers - typeof";
8904
+
8905
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
8906
+ return typeof obj;
8907
+ } : function (obj) {
8908
+ return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
8909
+ }, _typeof(obj);
8910
+ }
8911
+
8573
8912
  function requiredArgs(required, args) {
8574
8913
  if (args.length < required) {
8575
8914
  throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
@@ -11134,7 +11473,7 @@ var Calendar = function Calendar(_ref) {
11134
11473
  })));
11135
11474
  };
11136
11475
 
11137
- var _excluded$k = ["rounded", "size", "testID", "style"];
11476
+ var _excluded$j = ["rounded", "size", "testID", "style"];
11138
11477
  var Image = function Image(_ref) {
11139
11478
  var _ref$rounded = _ref.rounded,
11140
11479
  rounded = _ref$rounded === void 0 ? false : _ref$rounded,
@@ -11142,7 +11481,7 @@ var Image = function Image(_ref) {
11142
11481
  size = _ref$size === void 0 ? '6xlarge' : _ref$size,
11143
11482
  testID = _ref.testID,
11144
11483
  style = _ref.style,
11145
- imageNativeProps = _objectWithoutProperties(_ref, _excluded$k);
11484
+ imageNativeProps = _objectWithoutProperties(_ref, _excluded$j);
11146
11485
  var theme = useTheme();
11147
11486
  var imageSize = theme.__hd__.image.sizes[size];
11148
11487
  return /*#__PURE__*/React.createElement(Image$1, _extends$1({
@@ -11347,12 +11686,12 @@ var Indicator = index$a(View)(function (_ref2) {
11347
11686
  };
11348
11687
  });
11349
11688
 
11350
- var _excluded$j = ["intent", "children"];
11689
+ var _excluded$i = ["intent", "children"];
11351
11690
  var DataCard = function DataCard(_ref) {
11352
11691
  var _ref$intent = _ref.intent,
11353
11692
  intent = _ref$intent === void 0 ? 'info' : _ref$intent,
11354
11693
  children = _ref.children,
11355
- nativeProps = _objectWithoutProperties(_ref, _excluded$j);
11694
+ nativeProps = _objectWithoutProperties(_ref, _excluded$i);
11356
11695
  return /*#__PURE__*/React.createElement(StyledDataCard, nativeProps, /*#__PURE__*/React.createElement(Indicator, {
11357
11696
  themeIntent: intent,
11358
11697
  testID: "data-card-indicator"
@@ -11370,11 +11709,11 @@ var StyledCard$1 = index$a(View)(function (_ref) {
11370
11709
  });
11371
11710
  });
11372
11711
 
11373
- var _excluded$i = ["intent", "children"];
11712
+ var _excluded$h = ["intent", "children"];
11374
11713
  var Card = function Card(_ref) {
11375
11714
  var intent = _ref.intent,
11376
11715
  children = _ref.children,
11377
- nativeProps = _objectWithoutProperties(_ref, _excluded$i);
11716
+ nativeProps = _objectWithoutProperties(_ref, _excluded$h);
11378
11717
  return /*#__PURE__*/React.createElement(StyledCard$1, _extends$1({}, nativeProps, {
11379
11718
  themeIntent: intent
11380
11719
  }), children);
@@ -11581,7 +11920,7 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
11581
11920
  });
11582
11921
  CardCarousel.displayName = 'CardCarousel';
11583
11922
 
11584
- var _excluded$h = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "testID"];
11923
+ var _excluded$g = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "testID"];
11585
11924
  function useStateFromProp(initialValue) {
11586
11925
  var _useState = useState(initialValue),
11587
11926
  _useState2 = _slicedToArray(_useState, 2),
@@ -11600,7 +11939,7 @@ var Carousel = function Carousel(_ref) {
11600
11939
  selectedItemIndex = _ref$selectedItemInde === void 0 ? 0 : _ref$selectedItemInde,
11601
11940
  style = _ref.style,
11602
11941
  testID = _ref.testID,
11603
- nativeProps = _objectWithoutProperties(_ref, _excluded$h);
11942
+ nativeProps = _objectWithoutProperties(_ref, _excluded$g);
11604
11943
  var carouselRef = useRef(null);
11605
11944
  var _useStateFromProp = useStateFromProp(selectedItemIndex),
11606
11945
  _useStateFromProp2 = _slicedToArray(_useStateFromProp, 2),
@@ -11929,7 +12268,7 @@ var StyledErrorAndMaxLengthContainer = index$a(View)(function () {
11929
12268
  };
11930
12269
  });
11931
12270
 
11932
- var _excluded$g = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "hideCharacterCount", "helpText", "value", "defaultValue", "renderInputValue", "allowFontScaling", "variant"];
12271
+ var _excluded$f = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "hideCharacterCount", "helpText", "value", "defaultValue", "renderInputValue", "allowFontScaling", "variant"];
11933
12272
  var getState$1 = function getState(_ref) {
11934
12273
  var disabled = _ref.disabled,
11935
12274
  error = _ref.error,
@@ -11981,7 +12320,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
11981
12320
  allowFontScaling = _ref2$allowFontScalin === void 0 ? false : _ref2$allowFontScalin,
11982
12321
  _ref2$variant = _ref2.variant,
11983
12322
  variant = _ref2$variant === void 0 ? 'text' : _ref2$variant,
11984
- nativeProps = _objectWithoutProperties(_ref2, _excluded$g);
12323
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$f);
11985
12324
  var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
11986
12325
  var isEmptyValue = displayText.length === 0;
11987
12326
  var actualSuffix = loading ? 'loading' : suffix;
@@ -12402,719 +12741,393 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
12402
12741
  style: style
12403
12742
  })), /*#__PURE__*/React.createElement(BottomSheet$1, {
12404
12743
  open: open,
12405
- onRequestClose: function onRequestClose() {
12406
- return setOpen(false);
12407
- },
12408
- header: label,
12409
- footer: /*#__PURE__*/React.createElement(CompoundButton, {
12410
- variant: "text",
12411
- text: confirmLabel,
12412
- onPress: function onPress() {
12413
- if (selectingDate) {
12414
- onChange(selectingDate);
12415
- }
12416
- setOpen(false);
12417
- }
12418
- })
12419
- }, /*#__PURE__*/React.createElement(StyledPickerWrapper$1, null, /*#__PURE__*/React.createElement(DateTimePicker, {
12420
- testID: "datePickerIOS",
12421
- value: selectingDate,
12422
- minimumDate: minDate,
12423
- maximumDate: maxDate,
12424
- mode: "date",
12425
- onChange: function onChange(_, date) {
12426
- if (date) {
12427
- setSelectingDate(date);
12428
- }
12429
- },
12430
- display: "spinner",
12431
- style: {
12432
- flex: 1
12433
- },
12434
- textColor: theme.colors.onDefaultGlobalSurface
12435
- }))));
12436
- };
12437
-
12438
- var _excluded$f = ["variant"];
12439
- var DatePicker = function DatePicker(_ref) {
12440
- var _ref$variant = _ref.variant,
12441
- variant = _ref$variant === void 0 ? 'default' : _ref$variant,
12442
- props = _objectWithoutProperties(_ref, _excluded$f);
12443
- if (variant === 'calendar') {
12444
- return /*#__PURE__*/React.createElement(DatePickerCalendar, props);
12445
- }
12446
- if (Platform.OS === 'ios') {
12447
- return /*#__PURE__*/React.createElement(DatePickerIOS, props);
12448
- }
12449
- return /*#__PURE__*/React.createElement(DatePickerAndroid, props);
12450
- };
12451
-
12452
- var AnimatedPressable$1 = Animated.createAnimatedComponent(Pressable);
12453
- var StyledContainer$3 = index$a(View)(function (_ref) {
12454
- var theme = _ref.theme,
12455
- enableShadow = _ref.enableShadow;
12456
- return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
12457
- shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
12458
- shadowOffset: theme.__hd__.drawer.shadows.offset,
12459
- shadowOpacity: theme.__hd__.drawer.shadows.opacity,
12460
- shadowRadius: theme.__hd__.drawer.shadows.radius,
12461
- overflow: 'hidden',
12462
- zIndex: 9999,
12463
- elevation: 9999
12464
- });
12465
- });
12466
- var StyledDragableContainer = index$a(View)(function (_ref2) {
12467
- var theme = _ref2.theme,
12468
- enableShadow = _ref2.enableShadow;
12469
- return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
12470
- shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
12471
- shadowOffset: theme.__hd__.drawer.shadows.offset,
12472
- shadowOpacity: theme.__hd__.drawer.shadows.opacity,
12473
- shadowRadius: theme.__hd__.drawer.shadows.radius,
12474
- overflow: 'hidden',
12475
- zIndex: 9999,
12476
- elevation: 9999,
12477
- flexDirection: 'column-reverse'
12478
- });
12479
- });
12480
- var StyledBackdrop$1 = index$a(AnimatedPressable$1)(function (_ref3) {
12481
- var theme = _ref3.theme;
12482
- return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
12483
- backgroundColor: theme.__hd__.drawer.colors.backdrop
12484
- });
12485
- });
12486
- var StyledDrawerContainer = index$a(Animated.View)(function (_ref4) {
12487
- var theme = _ref4.theme,
12488
- enableShadow = _ref4.enableShadow;
12489
- return {
12490
- borderBottomLeftRadius: theme.__hd__.drawer.radii["default"],
12491
- borderBottomRightRadius: theme.__hd__.drawer.radii["default"],
12492
- backgroundColor: theme.__hd__.drawer.colors.background,
12493
- elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
12494
- overflow: 'hidden'
12495
- };
12496
- });
12497
- var StyledDragableDrawerContainer = index$a(Animated.View)(function (_ref5) {
12498
- var theme = _ref5.theme,
12499
- enableShadow = _ref5.enableShadow;
12500
- return {
12501
- borderTopLeftRadius: theme.__hd__.drawer.radii["default"],
12502
- borderTopRightRadius: theme.__hd__.drawer.radii["default"],
12503
- backgroundColor: theme.__hd__.drawer.colors.background,
12504
- elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
12505
- overflow: 'hidden',
12506
- maxHeight: '100%'
12507
- };
12508
- });
12509
- var StyledHandlerContainer = index$a(View)(function (_ref6) {
12510
- var theme = _ref6.theme;
12511
- return {
12512
- backgroundColor: theme.__hd__.drawer.colors.background,
12513
- paddingVertical: theme.__hd__.drawer.space.handlerPaddingVertical,
12514
- alignItems: 'center'
12515
- };
12516
- });
12517
- var StyledHandler = index$a(View)(function (_ref7) {
12518
- var theme = _ref7.theme;
12519
- return {
12520
- width: theme.__hd__.drawer.sizes.handlerWidth,
12521
- height: theme.__hd__.drawer.sizes.handlerHeight,
12522
- backgroundColor: theme.__hd__.drawer.colors.handler,
12523
- borderRadius: theme.__hd__.drawer.radii.handler
12524
- };
12525
- });
12526
-
12527
- var getOffset = function getOffset(height, percentage) {
12528
- if (percentage < 0) return height;
12529
- if (percentage > 100) return 0;
12530
- return height * ((100 - percentage) / 100);
12531
- };
12532
- var calculateSnapPointsData = function calculateSnapPointsData(minimumHeight, height, snapPoints) {
12533
- var filteredSnapPoints = snapPoints.filter(function (value) {
12534
- return value >= minimumHeight;
12535
- });
12536
- var snapPointsOffsetValues = [minimumHeight].concat(_toConsumableArray(filteredSnapPoints)).map(function (value) {
12537
- return getOffset(height, value);
12538
- });
12539
- var uniqSnapPointOffsetValues = Array.from(new Set([].concat(_toConsumableArray(snapPointsOffsetValues), [0])));
12540
- return {
12541
- list: uniqSnapPointOffsetValues,
12542
- minHeightOffset: Math.max.apply(Math, uniqSnapPointOffsetValues),
12543
- maxHeightOffset: 0 // Max height
12544
- };
12545
- };
12546
-
12547
- var calculateAnimatedToValue = function calculateAnimatedToValue(position, heightSnapPoints) {
12548
- var distances = heightSnapPoints.map(function (height) {
12549
- return Math.abs(position - height);
12550
- });
12551
- var minIndex = distances.indexOf(Math.min.apply(Math, _toConsumableArray(distances)));
12552
- return heightSnapPoints[minIndex];
12553
- };
12554
-
12555
- var DragableDrawer = function DragableDrawer(_ref) {
12556
- var children = _ref.children,
12557
- initialHeightPercentage = _ref.initialHeightPercentage,
12558
- _ref$minimumHeightPer = _ref.minimumHeightPercentage,
12559
- minimumHeightPercentage = _ref$minimumHeightPer === void 0 ? 10 : _ref$minimumHeightPer,
12560
- _ref$snapPoints = _ref.snapPoints,
12561
- snapPoints = _ref$snapPoints === void 0 ? [] : _ref$snapPoints,
12562
- onExpanded = _ref.onExpanded,
12563
- onCollapsed = _ref.onCollapsed,
12564
- testID = _ref.testID;
12565
- var _useState = useState(0),
12566
- _useState2 = _slicedToArray(_useState, 2),
12567
- height = _useState2[0],
12568
- setHeight = _useState2[1];
12569
- var baseHeightForMeasure = useRef(0);
12570
- var snapPointsData = useRef({
12571
- list: [],
12572
- minHeightOffset: 0,
12573
- maxHeightOffset: 0
12574
- });
12575
- // Track drag
12576
- var pan = useRef(new Animated.Value(0)).current;
12577
- var offset = useRef(0);
12578
- var offsetBeforePan = useRef(0);
12579
- var _useState3 = useState(-1),
12580
- _useState4 = _slicedToArray(_useState3, 2),
12581
- animatedToValue = _useState4[0],
12582
- setAnimatedToValue = _useState4[1];
12583
- useEffect(function () {
12584
- var id = pan.addListener(function (_ref2) {
12585
- var value = _ref2.value;
12586
- offset.current = value;
12587
- });
12588
- return function () {
12589
- return pan.removeListener(id);
12590
- };
12591
- }, []);
12592
- useEffect(function () {
12593
- if (height > 0) {
12594
- var initialOffset = getOffset(height, initialHeightPercentage || minimumHeightPercentage);
12595
- setAnimatedToValue(initialOffset);
12596
- }
12597
- }, [height]);
12598
- useEffect(function () {
12599
- if (height > 0) {
12600
- pan.setValue(height);
12601
- offset.current = height;
12602
- baseHeightForMeasure.current = height;
12603
- // Calculate snap points information
12604
- snapPointsData.current = calculateSnapPointsData(minimumHeightPercentage, height, snapPoints);
12605
- }
12606
- }, [height, minimumHeightPercentage]);
12607
- useEffect(function () {
12608
- if (animatedToValue >= 0) {
12609
- var animation = Animated.timing(pan, {
12610
- toValue: animatedToValue,
12611
- useNativeDriver: true,
12612
- easing: Easing.inOut(Easing.cubic)
12613
- });
12614
- animation.start(function () {
12615
- if (animatedToValue === 0) {
12616
- onExpanded === null || onExpanded === void 0 ? void 0 : onExpanded();
12617
- } else if (animatedToValue === getOffset(height, minimumHeightPercentage)) {
12618
- onCollapsed === null || onCollapsed === void 0 ? void 0 : onCollapsed();
12619
- }
12620
- setAnimatedToValue(-1);
12621
- });
12622
- return function () {
12623
- return animation.stop();
12624
- };
12625
- }
12626
- }, [animatedToValue]);
12627
- var panResponder = useRef(PanResponder.create({
12628
- onMoveShouldSetPanResponder: function onMoveShouldSetPanResponder() {
12629
- return true;
12630
- },
12631
- onPanResponderGrant: function onPanResponderGrant() {
12632
- offsetBeforePan.current = offset.current;
12633
- pan.setOffset(offset.current);
12634
- pan.setValue(0);
12635
- },
12636
- onPanResponderMove: function onPanResponderMove(_, gesture) {
12637
- var _snapPointsData$curre;
12638
- var panDistance = gesture.dy;
12639
- // Moving toward top, stop at highest snap point
12640
- if (offsetBeforePan.current + panDistance < 0) {
12641
- pan.setValue(-offsetBeforePan.current);
12642
- return;
12744
+ onRequestClose: function onRequestClose() {
12745
+ return setOpen(false);
12746
+ },
12747
+ header: label,
12748
+ footer: /*#__PURE__*/React.createElement(CompoundButton, {
12749
+ variant: "text",
12750
+ text: confirmLabel,
12751
+ onPress: function onPress() {
12752
+ if (selectingDate) {
12753
+ onChange(selectingDate);
12754
+ }
12755
+ setOpen(false);
12643
12756
  }
12644
- // Moving toward bottom, stop at lowest snap point
12645
- if (offsetBeforePan.current + panDistance > ((_snapPointsData$curre = snapPointsData.current) === null || _snapPointsData$curre === void 0 ? void 0 : _snapPointsData$curre.minHeightOffset)) {
12646
- pan.setValue(baseHeightForMeasure.current - baseHeightForMeasure.current * (minimumHeightPercentage / 100) - offsetBeforePan.current);
12647
- return;
12757
+ })
12758
+ }, /*#__PURE__*/React.createElement(StyledPickerWrapper$1, null, /*#__PURE__*/React.createElement(DateTimePicker, {
12759
+ testID: "datePickerIOS",
12760
+ value: selectingDate,
12761
+ minimumDate: minDate,
12762
+ maximumDate: maxDate,
12763
+ mode: "date",
12764
+ onChange: function onChange(_, date) {
12765
+ if (date) {
12766
+ setSelectingDate(date);
12648
12767
  }
12649
- pan.setValue(panDistance);
12650
12768
  },
12651
- onPanResponderRelease: function onPanResponderRelease(_, gesture) {
12652
- pan.flattenOffset();
12653
- // Attach to nearest snappoint
12654
- var panDistance = gesture.dy;
12655
- var offsetAfterPan = offsetBeforePan.current + panDistance;
12656
- var animatedValue = calculateAnimatedToValue(offsetAfterPan, snapPointsData.current.list);
12657
- setAnimatedToValue(animatedValue);
12658
- }
12659
- })).current;
12660
- return /*#__PURE__*/React.createElement(StyledDragableContainer, {
12661
- testID: testID,
12662
- enableShadow: true,
12663
- pointerEvents: "box-none"
12664
- }, /*#__PURE__*/React.createElement(StyledDragableDrawerContainer, {
12665
- enableShadow: true,
12769
+ display: "spinner",
12666
12770
  style: {
12667
- transform: [{
12668
- scaleY: baseHeightForMeasure.current > 0 ? 1 : 0
12669
- }, {
12670
- translateY: pan
12671
- }]
12771
+ flex: 1
12672
12772
  },
12673
- onLayout: function onLayout(_ref3) {
12674
- var nativeEvent = _ref3.nativeEvent;
12675
- setHeight(nativeEvent.layout.height);
12676
- }
12677
- }, /*#__PURE__*/React.createElement(StyledHandlerContainer, panResponder.panHandlers, /*#__PURE__*/React.createElement(StyledHandler, null)), children));
12773
+ textColor: theme.colors.onDefaultGlobalSurface
12774
+ }))));
12678
12775
  };
12679
12776
 
12680
- var Drawer = function Drawer(_ref) {
12681
- var visible = _ref.visible,
12682
- children = _ref.children,
12683
- _ref$hasBackdrop = _ref.hasBackdrop,
12684
- hasBackdrop = _ref$hasBackdrop === void 0 ? true : _ref$hasBackdrop,
12685
- onDismiss = _ref.onDismiss,
12686
- testID = _ref.testID;
12687
- var animatedValue = useRef(new Animated.Value(visible ? 1 : 0)).current;
12688
- var _useState = useState(Dimensions.get('window').height),
12689
- _useState2 = _slicedToArray(_useState, 2),
12690
- height = _useState2[0],
12691
- setHeight = _useState2[1];
12692
- var enableShadow = visible && !hasBackdrop;
12693
- var interpolateTranslateY = animatedValue.interpolate({
12694
- inputRange: [0, 1],
12695
- outputRange: [-height, 0]
12696
- });
12697
- var interpolateBackdropOpacity = hasBackdrop ? animatedValue.interpolate({
12698
- inputRange: [0, 1],
12699
- outputRange: [0, 0.35]
12700
- }) : 0;
12701
- useEffect(function () {
12702
- var animation = Animated.timing(animatedValue, {
12703
- toValue: visible ? 1 : 0,
12704
- easing: Easing.inOut(Easing.cubic),
12705
- useNativeDriver: true
12706
- });
12707
- animation.start();
12708
- return function () {
12709
- return animation.stop();
12710
- };
12711
- }, [visible]);
12712
- return /*#__PURE__*/React.createElement(StyledContainer$3, {
12713
- testID: testID,
12714
- enableShadow: enableShadow,
12715
- pointerEvents: "box-none"
12716
- }, /*#__PURE__*/React.createElement(StyledBackdrop$1, {
12717
- pointerEvents: visible ? 'auto' : 'box-none',
12718
- onPress: onDismiss,
12719
- style: {
12720
- opacity: interpolateBackdropOpacity
12721
- }
12722
- }), /*#__PURE__*/React.createElement(StyledDrawerContainer, {
12723
- enableShadow: enableShadow,
12724
- onLayout: function onLayout(_ref2) {
12725
- var nativeEvent = _ref2.nativeEvent;
12726
- return setHeight(nativeEvent.layout.height);
12727
- },
12728
- style: {
12729
- transform: [{
12730
- translateY: interpolateTranslateY
12731
- }]
12732
- }
12733
- }, children));
12777
+ var _excluded$e = ["variant"];
12778
+ var DatePicker = function DatePicker(_ref) {
12779
+ var _ref$variant = _ref.variant,
12780
+ variant = _ref$variant === void 0 ? 'default' : _ref$variant,
12781
+ props = _objectWithoutProperties(_ref, _excluded$e);
12782
+ if (variant === 'calendar') {
12783
+ return /*#__PURE__*/React.createElement(DatePickerCalendar, props);
12784
+ }
12785
+ if (Platform.OS === 'ios') {
12786
+ return /*#__PURE__*/React.createElement(DatePickerIOS, props);
12787
+ }
12788
+ return /*#__PURE__*/React.createElement(DatePickerAndroid, props);
12734
12789
  };
12735
- var index$7 = Object.assign(Drawer, {
12736
- Dragable: DragableDrawer
12737
- });
12738
12790
 
12739
- var StyledWrapper$6 = index$a(View)(function (_ref) {
12740
- var theme = _ref.theme;
12741
- return {
12742
- display: 'flex',
12743
- flex: 1,
12744
- flexDirection: 'column',
12745
- alignItems: 'center',
12746
- justifyContent: 'center',
12747
- padding: theme.__hd__.empty.space.wrapperPadding
12748
- };
12791
+ var AnimatedPressable$1 = Animated.createAnimatedComponent(Pressable);
12792
+ var StyledContainer$3 = index$a(View)(function (_ref) {
12793
+ var theme = _ref.theme,
12794
+ enableShadow = _ref.enableShadow;
12795
+ return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
12796
+ shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
12797
+ shadowOffset: theme.__hd__.drawer.shadows.offset,
12798
+ shadowOpacity: theme.__hd__.drawer.shadows.opacity,
12799
+ shadowRadius: theme.__hd__.drawer.shadows.radius,
12800
+ overflow: 'hidden',
12801
+ zIndex: 9999,
12802
+ elevation: 9999
12803
+ });
12749
12804
  });
12750
- var StyledTitle = index$a(Typography.Title)(function (_ref2) {
12805
+ var StyledDragableContainer = index$a(View)(function (_ref2) {
12751
12806
  var theme = _ref2.theme,
12752
- themeVariant = _ref2.themeVariant;
12807
+ enableShadow = _ref2.enableShadow;
12808
+ return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
12809
+ shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
12810
+ shadowOffset: theme.__hd__.drawer.shadows.offset,
12811
+ shadowOpacity: theme.__hd__.drawer.shadows.opacity,
12812
+ shadowRadius: theme.__hd__.drawer.shadows.radius,
12813
+ overflow: 'hidden',
12814
+ zIndex: 9999,
12815
+ elevation: 9999,
12816
+ flexDirection: 'column-reverse'
12817
+ });
12818
+ });
12819
+ var StyledBackdrop$1 = index$a(AnimatedPressable$1)(function (_ref3) {
12820
+ var theme = _ref3.theme;
12821
+ return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
12822
+ backgroundColor: theme.__hd__.drawer.colors.backdrop
12823
+ });
12824
+ });
12825
+ var StyledDrawerContainer = index$a(Animated.View)(function (_ref4) {
12826
+ var theme = _ref4.theme,
12827
+ enableShadow = _ref4.enableShadow;
12753
12828
  return {
12754
- textAlign: 'center',
12755
- marginBottom: theme.__hd__.empty.space.titleMargin,
12756
- color: themeVariant === 'dark' ? theme.__hd__.empty.colors.invertedText : theme.__hd__.empty.colors.text
12829
+ borderBottomLeftRadius: theme.__hd__.drawer.radii["default"],
12830
+ borderBottomRightRadius: theme.__hd__.drawer.radii["default"],
12831
+ backgroundColor: theme.__hd__.drawer.colors.background,
12832
+ elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
12833
+ overflow: 'hidden'
12757
12834
  };
12758
12835
  });
12759
- var StyledDescription = index$a(Typography.Body)(function (_ref3) {
12760
- var theme = _ref3.theme,
12761
- themeVariant = _ref3.themeVariant;
12836
+ var StyledDragableDrawerContainer = index$a(Animated.View)(function (_ref5) {
12837
+ var theme = _ref5.theme,
12838
+ enableShadow = _ref5.enableShadow;
12762
12839
  return {
12763
- textAlign: 'center',
12764
- color: themeVariant === 'dark' ? theme.__hd__.empty.colors.invertedSubduedText : theme.__hd__.empty.colors.subduedText
12840
+ borderTopLeftRadius: theme.__hd__.drawer.radii["default"],
12841
+ borderTopRightRadius: theme.__hd__.drawer.radii["default"],
12842
+ backgroundColor: theme.__hd__.drawer.colors.background,
12843
+ elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
12844
+ overflow: 'hidden',
12845
+ maxHeight: '100%'
12765
12846
  };
12766
12847
  });
12767
-
12768
- var Empty = function Empty(_ref) {
12769
- var image = _ref.image,
12770
- title = _ref.title,
12771
- description = _ref.description,
12772
- style = _ref.style,
12773
- testID = _ref.testID,
12774
- _ref$variant = _ref.variant,
12775
- variant = _ref$variant === void 0 ? 'light' : _ref$variant;
12776
- var theme = useTheme();
12777
- return /*#__PURE__*/React.createElement(StyledWrapper$6, {
12778
- style: style,
12779
- testID: testID
12780
- }, image !== undefined && /*#__PURE__*/React.cloneElement(image, _objectSpread2(_objectSpread2({}, image.props), {}, {
12781
- style: [{
12782
- marginBottom: theme.__hd__.empty.space.imageMargin
12783
- }, image.props.style]
12784
- })), /*#__PURE__*/React.createElement(StyledTitle, {
12785
- themeVariant: variant,
12786
- level: "h4",
12787
- typeface: "playful"
12788
- }, title), !!description && /*#__PURE__*/React.createElement(StyledDescription, {
12789
- themeVariant: variant,
12790
- typeface: "playful"
12791
- }, description));
12792
- };
12793
-
12794
- var customAlphabet = function customAlphabet(alphabet) {
12795
- var defaultSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 21;
12796
- return function () {
12797
- var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSize;
12798
- var id = '';
12799
- var i = size;
12800
- while (i--) {
12801
- id += alphabet[Math.random() * alphabet.length | 0];
12802
- }
12803
- return id;
12848
+ var StyledHandlerContainer = index$a(View)(function (_ref6) {
12849
+ var theme = _ref6.theme;
12850
+ return {
12851
+ backgroundColor: theme.__hd__.drawer.colors.background,
12852
+ paddingVertical: theme.__hd__.drawer.space.handlerPaddingVertical,
12853
+ alignItems: 'center'
12804
12854
  };
12805
- };
12806
-
12807
- var ACTIONS;
12808
- (function (ACTIONS) {
12809
- ACTIONS[ACTIONS["REGISTER_HOST"] = 0] = "REGISTER_HOST";
12810
- ACTIONS[ACTIONS["DEREGISTER_HOST"] = 1] = "DEREGISTER_HOST";
12811
- ACTIONS[ACTIONS["ADD_UPDATE_PORTAL"] = 2] = "ADD_UPDATE_PORTAL";
12812
- ACTIONS[ACTIONS["REMOVE_PORTAL"] = 3] = "REMOVE_PORTAL";
12813
- })(ACTIONS || (ACTIONS = {}));
12814
- var INITIAL_STATE = {};
12815
-
12816
- var PortalStateContext = /*#__PURE__*/createContext(null);
12817
- var PortalDispatchContext = /*#__PURE__*/createContext(null);
12855
+ });
12856
+ var StyledHandler = index$a(View)(function (_ref7) {
12857
+ var theme = _ref7.theme;
12858
+ return {
12859
+ width: theme.__hd__.drawer.sizes.handlerWidth,
12860
+ height: theme.__hd__.drawer.sizes.handlerHeight,
12861
+ backgroundColor: theme.__hd__.drawer.colors.handler,
12862
+ borderRadius: theme.__hd__.drawer.radii.handler
12863
+ };
12864
+ });
12818
12865
 
12819
- var usePortal = function usePortal() {
12820
- var hostName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'root';
12821
- var dispatch = useContext(PortalDispatchContext);
12822
- if (dispatch === null) {
12823
- throw new Error("You must add 'PortalProvider' to the root component.");
12824
- }
12825
- var registerHost = useCallback(function () {
12826
- dispatch({
12827
- type: ACTIONS.REGISTER_HOST,
12828
- hostName: hostName
12829
- });
12830
- }, []);
12831
- var deregisterHost = useCallback(function () {
12832
- dispatch({
12833
- type: ACTIONS.DEREGISTER_HOST,
12834
- hostName: hostName
12835
- });
12836
- }, []);
12837
- var addUpdatePortal = useCallback(function (name, node) {
12838
- dispatch({
12839
- type: ACTIONS.ADD_UPDATE_PORTAL,
12840
- hostName: hostName,
12841
- portalName: name,
12842
- node: node
12843
- });
12844
- }, []);
12845
- var removePortal = useCallback(function (name) {
12846
- dispatch({
12847
- type: ACTIONS.REMOVE_PORTAL,
12848
- hostName: hostName,
12849
- portalName: name
12850
- });
12851
- }, []);
12866
+ var getOffset = function getOffset(height, percentage) {
12867
+ if (percentage < 0) return height;
12868
+ if (percentage > 100) return 0;
12869
+ return height * ((100 - percentage) / 100);
12870
+ };
12871
+ var calculateSnapPointsData = function calculateSnapPointsData(minimumHeight, height, snapPoints) {
12872
+ var filteredSnapPoints = snapPoints.filter(function (value) {
12873
+ return value >= minimumHeight;
12874
+ });
12875
+ var snapPointsOffsetValues = [minimumHeight].concat(_toConsumableArray(filteredSnapPoints)).map(function (value) {
12876
+ return getOffset(height, value);
12877
+ });
12878
+ var uniqSnapPointOffsetValues = Array.from(new Set([].concat(_toConsumableArray(snapPointsOffsetValues), [0])));
12852
12879
  return {
12853
- registerHost: registerHost,
12854
- deregisterHost: deregisterHost,
12855
- addPortal: addUpdatePortal,
12856
- updatePortal: addUpdatePortal,
12857
- removePortal: removePortal
12880
+ list: uniqSnapPointOffsetValues,
12881
+ minHeightOffset: Math.max.apply(Math, uniqSnapPointOffsetValues),
12882
+ maxHeightOffset: 0 // Max height
12858
12883
  };
12859
12884
  };
12860
12885
 
12861
- var usePortalState = function usePortalState(hostName) {
12862
- var state = useContext(PortalStateContext);
12863
- if (state === null) {
12864
- throw new Error("You must add 'PortalProvider' to the root component.");
12865
- }
12866
- return state[hostName] || [];
12886
+ var calculateAnimatedToValue = function calculateAnimatedToValue(position, heightSnapPoints) {
12887
+ var distances = heightSnapPoints.map(function (height) {
12888
+ return Math.abs(position - height);
12889
+ });
12890
+ var minIndex = distances.indexOf(Math.min.apply(Math, _toConsumableArray(distances)));
12891
+ return heightSnapPoints[minIndex];
12867
12892
  };
12868
12893
 
12869
- var PortalHostComponent = function PortalHostComponent(_ref) {
12870
- var name = _ref.name;
12871
- var state = usePortalState(name);
12872
- var _usePortal = usePortal(name),
12873
- registerHost = _usePortal.registerHost,
12874
- deregisterHost = _usePortal.deregisterHost;
12894
+ var DragableDrawer = function DragableDrawer(_ref) {
12895
+ var children = _ref.children,
12896
+ initialHeightPercentage = _ref.initialHeightPercentage,
12897
+ _ref$minimumHeightPer = _ref.minimumHeightPercentage,
12898
+ minimumHeightPercentage = _ref$minimumHeightPer === void 0 ? 10 : _ref$minimumHeightPer,
12899
+ _ref$snapPoints = _ref.snapPoints,
12900
+ snapPoints = _ref$snapPoints === void 0 ? [] : _ref$snapPoints,
12901
+ onExpanded = _ref.onExpanded,
12902
+ onCollapsed = _ref.onCollapsed,
12903
+ testID = _ref.testID;
12904
+ var _useState = useState(0),
12905
+ _useState2 = _slicedToArray(_useState, 2),
12906
+ height = _useState2[0],
12907
+ setHeight = _useState2[1];
12908
+ var baseHeightForMeasure = useRef(0);
12909
+ var snapPointsData = useRef({
12910
+ list: [],
12911
+ minHeightOffset: 0,
12912
+ maxHeightOffset: 0
12913
+ });
12914
+ // Track drag
12915
+ var pan = useRef(new Animated.Value(0)).current;
12916
+ var offset = useRef(0);
12917
+ var offsetBeforePan = useRef(0);
12918
+ var _useState3 = useState(-1),
12919
+ _useState4 = _slicedToArray(_useState3, 2),
12920
+ animatedToValue = _useState4[0],
12921
+ setAnimatedToValue = _useState4[1];
12875
12922
  useEffect(function () {
12876
- registerHost();
12923
+ var id = pan.addListener(function (_ref2) {
12924
+ var value = _ref2.value;
12925
+ offset.current = value;
12926
+ });
12877
12927
  return function () {
12878
- deregisterHost();
12928
+ return pan.removeListener(id);
12879
12929
  };
12880
12930
  }, []);
12881
- return /*#__PURE__*/React.createElement(React.Fragment, null, state.map(function (item) {
12882
- return item.node;
12883
- }));
12884
- };
12885
- var PortalHost = /*#__PURE__*/memo(PortalHostComponent);
12886
- PortalHost.displayName = 'PortalHost';
12887
-
12888
- var registerHostIfNotExist = function registerHostIfNotExist(state, hostName) {
12889
- if (!(hostName in state)) {
12890
- return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, hostName, []));
12891
- }
12892
- return _objectSpread2({}, state);
12893
- };
12894
- var deregisterHost = function deregisterHost(state, hostName) {
12895
- return _objectSpread2({}, omit([hostName], state));
12896
- };
12897
- var addUpdatePortal = function addUpdatePortal(state, hostName, portalName, node) {
12898
- var newState = registerHostIfNotExist(state, hostName);
12899
- var index = newState[hostName].findIndex(function (item) {
12900
- return item.name === portalName;
12901
- });
12902
- if (index !== -1) {
12903
- return _objectSpread2(_objectSpread2({}, newState), {}, _defineProperty({}, hostName, newState[hostName].map(function (item, i) {
12904
- if (index === i) {
12905
- return _objectSpread2(_objectSpread2({}, item), {}, {
12906
- node: node
12907
- });
12931
+ useEffect(function () {
12932
+ if (height > 0) {
12933
+ var initialOffset = getOffset(height, initialHeightPercentage || minimumHeightPercentage);
12934
+ setAnimatedToValue(initialOffset);
12935
+ }
12936
+ }, [height]);
12937
+ useEffect(function () {
12938
+ if (height > 0) {
12939
+ pan.setValue(height);
12940
+ offset.current = height;
12941
+ baseHeightForMeasure.current = height;
12942
+ // Calculate snap points information
12943
+ snapPointsData.current = calculateSnapPointsData(minimumHeightPercentage, height, snapPoints);
12944
+ }
12945
+ }, [height, minimumHeightPercentage]);
12946
+ useEffect(function () {
12947
+ if (animatedToValue >= 0) {
12948
+ var animation = Animated.timing(pan, {
12949
+ toValue: animatedToValue,
12950
+ useNativeDriver: true,
12951
+ easing: Easing.inOut(Easing.cubic)
12952
+ });
12953
+ animation.start(function () {
12954
+ if (animatedToValue === 0) {
12955
+ onExpanded === null || onExpanded === void 0 ? void 0 : onExpanded();
12956
+ } else if (animatedToValue === getOffset(height, minimumHeightPercentage)) {
12957
+ onCollapsed === null || onCollapsed === void 0 ? void 0 : onCollapsed();
12958
+ }
12959
+ setAnimatedToValue(-1);
12960
+ });
12961
+ return function () {
12962
+ return animation.stop();
12963
+ };
12964
+ }
12965
+ }, [animatedToValue]);
12966
+ var panResponder = useRef(PanResponder.create({
12967
+ onMoveShouldSetPanResponder: function onMoveShouldSetPanResponder() {
12968
+ return true;
12969
+ },
12970
+ onPanResponderGrant: function onPanResponderGrant() {
12971
+ offsetBeforePan.current = offset.current;
12972
+ pan.setOffset(offset.current);
12973
+ pan.setValue(0);
12974
+ },
12975
+ onPanResponderMove: function onPanResponderMove(_, gesture) {
12976
+ var _snapPointsData$curre;
12977
+ var panDistance = gesture.dy;
12978
+ // Moving toward top, stop at highest snap point
12979
+ if (offsetBeforePan.current + panDistance < 0) {
12980
+ pan.setValue(-offsetBeforePan.current);
12981
+ return;
12908
12982
  }
12909
- return item;
12910
- })));
12911
- }
12912
- return _objectSpread2(_objectSpread2({}, newState), {}, _defineProperty({}, hostName, [].concat(_toConsumableArray(newState[hostName]), [{
12913
- name: portalName,
12914
- node: node
12915
- }])));
12916
- };
12917
- var removePortal = function removePortal(state, hostName, portalName) {
12918
- if (!(hostName in state)) {
12919
- return _objectSpread2({}, state);
12920
- }
12921
- return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, hostName, state[hostName].filter(function (item) {
12922
- return item.name !== portalName;
12923
- })));
12924
- };
12925
- var reducer = function reducer(state, action) {
12926
- var type = action.type;
12927
- switch (type) {
12928
- case ACTIONS.REGISTER_HOST:
12929
- return registerHostIfNotExist(state, action.hostName);
12930
- case ACTIONS.DEREGISTER_HOST:
12931
- return deregisterHost(state, action.hostName);
12932
- case ACTIONS.ADD_UPDATE_PORTAL:
12933
- return addUpdatePortal(state, action.hostName, action.portalName, action.node);
12934
- case ACTIONS.REMOVE_PORTAL:
12935
- return removePortal(state, action.hostName, action.portalName);
12936
- default:
12937
- return _objectSpread2({}, state);
12938
- }
12939
- };
12940
-
12941
- var PortalProviderComponent = function PortalProviderComponent(_ref) {
12942
- var _ref$rootHostName = _ref.rootHostName,
12943
- rootHostName = _ref$rootHostName === void 0 ? 'root' : _ref$rootHostName,
12944
- children = _ref.children;
12945
- var _useReducer = useReducer(reducer, INITIAL_STATE),
12946
- _useReducer2 = _slicedToArray(_useReducer, 2),
12947
- state = _useReducer2[0],
12948
- dispatch = _useReducer2[1];
12949
- return /*#__PURE__*/React.createElement(PortalDispatchContext.Provider, {
12950
- value: dispatch
12951
- }, /*#__PURE__*/React.createElement(PortalStateContext.Provider, {
12952
- value: state
12953
- }, children, /*#__PURE__*/React.createElement(PortalHost, {
12954
- name: rootHostName
12955
- })));
12983
+ // Moving toward bottom, stop at lowest snap point
12984
+ if (offsetBeforePan.current + panDistance > ((_snapPointsData$curre = snapPointsData.current) === null || _snapPointsData$curre === void 0 ? void 0 : _snapPointsData$curre.minHeightOffset)) {
12985
+ pan.setValue(baseHeightForMeasure.current - baseHeightForMeasure.current * (minimumHeightPercentage / 100) - offsetBeforePan.current);
12986
+ return;
12987
+ }
12988
+ pan.setValue(panDistance);
12989
+ },
12990
+ onPanResponderRelease: function onPanResponderRelease(_, gesture) {
12991
+ pan.flattenOffset();
12992
+ // Attach to nearest snappoint
12993
+ var panDistance = gesture.dy;
12994
+ var offsetAfterPan = offsetBeforePan.current + panDistance;
12995
+ var animatedValue = calculateAnimatedToValue(offsetAfterPan, snapPointsData.current.list);
12996
+ setAnimatedToValue(animatedValue);
12997
+ }
12998
+ })).current;
12999
+ return /*#__PURE__*/React.createElement(StyledDragableContainer, {
13000
+ testID: testID,
13001
+ enableShadow: true,
13002
+ pointerEvents: "box-none"
13003
+ }, /*#__PURE__*/React.createElement(StyledDragableDrawerContainer, {
13004
+ enableShadow: true,
13005
+ style: {
13006
+ transform: [{
13007
+ scaleY: baseHeightForMeasure.current > 0 ? 1 : 0
13008
+ }, {
13009
+ translateY: pan
13010
+ }]
13011
+ },
13012
+ onLayout: function onLayout(_ref3) {
13013
+ var nativeEvent = _ref3.nativeEvent;
13014
+ setHeight(nativeEvent.layout.height);
13015
+ }
13016
+ }, /*#__PURE__*/React.createElement(StyledHandlerContainer, panResponder.panHandlers, /*#__PURE__*/React.createElement(StyledHandler, null)), children));
12956
13017
  };
12957
- var PortalProvider = /*#__PURE__*/memo(PortalProviderComponent);
12958
- PortalProvider.displayName = 'PortalProvider';
12959
13018
 
12960
- var nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz0123456789', 10);
12961
- var PortalComponent = function PortalComponent(_ref) {
12962
- var name = _ref.name,
12963
- hostName = _ref.hostName,
13019
+ var Drawer = function Drawer(_ref) {
13020
+ var visible = _ref.visible,
12964
13021
  children = _ref.children,
12965
- theme = _ref.theme;
12966
- var defaultTheme = useTheme();
12967
- var _usePortal = usePortal(hostName),
12968
- addUpdatePortal = _usePortal.addPortal,
12969
- removePortal = _usePortal.removePortal;
12970
- var nameOrRandom = useMemo(function () {
12971
- return name || nanoid();
12972
- }, [name]);
12973
- var ChildrenComponent = useMemo(function () {
12974
- return /*#__PURE__*/React.createElement(ThemeProvider, {
12975
- theme: theme || defaultTheme
12976
- }, children);
12977
- }, [theme, children, defaultTheme]);
12978
- useLayoutEffect(function () {
12979
- addUpdatePortal(nameOrRandom, ChildrenComponent);
12980
- return function () {
12981
- removePortal(nameOrRandom);
12982
- };
12983
- }, [addUpdatePortal]);
12984
- useLayoutEffect(function () {
12985
- addUpdatePortal(nameOrRandom, ChildrenComponent);
12986
- }, [ChildrenComponent]);
12987
- return null;
12988
- };
12989
- var Portal = /*#__PURE__*/memo(PortalComponent);
12990
- Portal.displayName = 'Portal';
12991
- var Portal$1 = Object.assign(Portal, {
12992
- Provider: PortalProvider,
12993
- Host: PortalHost
12994
- });
12995
-
12996
- var _excluded$e = ["visible"];
12997
- var DEFAULT_BACKDROP_OPACITY = 0.4;
12998
- var DEFAULT_ANIMATION_CONFIG = {
12999
- easing: Easing.inOut(Easing.cubic),
13000
- useNativeDriver: Platform.OS !== 'web',
13001
- duration: 400
13002
- };
13003
- var Modal = /*#__PURE__*/forwardRef(function (_ref, ref) {
13004
- var children = _ref.children,
13005
- onShow = _ref.onShow,
13006
- onRequestClose = _ref.onRequestClose,
13007
- testID = _ref.testID,
13008
- _ref$animationType = _ref.animationType,
13009
- animationType = _ref$animationType === void 0 ? 'none' : _ref$animationType,
13010
- _ref$transparent = _ref.transparent,
13011
- transparent = _ref$transparent === void 0 ? false : _ref$transparent,
13012
- onDismiss = _ref.onDismiss;
13013
- var theme = useTheme();
13014
- var animatedBackdropValue = useRef(new Animated.Value(0)).current;
13015
- var animatedModalValue = useRef(new Animated.Value(0)).current;
13016
- // Show or hide the backdrop and modal content
13017
- var animateBackdropAndContent = useCallback(function (_ref2) {
13018
- var toValue = _ref2.toValue,
13019
- callback = _ref2.callback;
13020
- if (animationType !== 'none') {
13021
- // Backdrop animation
13022
- if (!transparent) {
13023
- Animated.timing(animatedBackdropValue, _objectSpread2({
13024
- toValue: toValue
13025
- }, DEFAULT_ANIMATION_CONFIG)).start();
13026
- }
13027
- // Modal content animation
13028
- Animated.timing(animatedModalValue, _objectSpread2({
13029
- toValue: toValue
13030
- }, DEFAULT_ANIMATION_CONFIG)).start(callback);
13031
- } else {
13032
- callback === null || callback === void 0 ? void 0 : callback();
13033
- }
13034
- }, [animationType, onShow, transparent]);
13035
- var backdropOpacityAnimation = animatedBackdropValue.interpolate({
13022
+ _ref$hasBackdrop = _ref.hasBackdrop,
13023
+ hasBackdrop = _ref$hasBackdrop === void 0 ? true : _ref$hasBackdrop,
13024
+ onDismiss = _ref.onDismiss,
13025
+ testID = _ref.testID;
13026
+ var animatedValue = useRef(new Animated.Value(visible ? 1 : 0)).current;
13027
+ var _useState = useState(Dimensions.get('window').height),
13028
+ _useState2 = _slicedToArray(_useState, 2),
13029
+ height = _useState2[0],
13030
+ setHeight = _useState2[1];
13031
+ var enableShadow = visible && !hasBackdrop;
13032
+ var interpolateTranslateY = animatedValue.interpolate({
13036
13033
  inputRange: [0, 1],
13037
- outputRange: [0, DEFAULT_BACKDROP_OPACITY]
13034
+ outputRange: [-height, 0]
13038
13035
  });
13039
- var modalAnimation = animatedModalValue.interpolate({
13036
+ var interpolateBackdropOpacity = hasBackdrop ? animatedValue.interpolate({
13040
13037
  inputRange: [0, 1],
13041
- outputRange: animationType === 'slide' ? [Dimensions.get('window').height, 0] : [0, 1]
13042
- });
13043
- useImperativeHandle(ref, function () {
13044
- return {
13045
- show: function show() {
13046
- animateBackdropAndContent({
13047
- toValue: 1,
13048
- callback: onShow
13049
- });
13050
- },
13051
- hide: function hide(wrapperCallback) {
13052
- animateBackdropAndContent({
13053
- toValue: 0,
13054
- callback: function callback() {
13055
- if (Platform.OS === 'ios') {
13056
- onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
13057
- }
13058
- wrapperCallback();
13059
- }
13060
- });
13061
- }
13062
- };
13063
- }, [onDismiss, onShow, animateBackdropAndContent]);
13064
- // Back button handler
13038
+ outputRange: [0, 0.35]
13039
+ }) : 0;
13065
13040
  useEffect(function () {
13066
- var backHandler = BackHandler.addEventListener('hardwareBackPress', function () {
13067
- onRequestClose === null || onRequestClose === void 0 ? void 0 : onRequestClose();
13068
- return true;
13041
+ var animation = Animated.timing(animatedValue, {
13042
+ toValue: visible ? 1 : 0,
13043
+ easing: Easing.inOut(Easing.cubic),
13044
+ useNativeDriver: true
13069
13045
  });
13046
+ animation.start();
13070
13047
  return function () {
13071
- return backHandler.remove();
13048
+ return animation.stop();
13072
13049
  };
13073
- }, [onRequestClose]);
13074
- return /*#__PURE__*/React.createElement(Portal$1, null, /*#__PURE__*/React.createElement(Animated.View, {
13075
- style: _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
13076
- backgroundColor: transparent ? 'transparent' : theme.colors.overlayGlobalSurface,
13077
- opacity: animationType !== 'none' ? backdropOpacityAnimation : DEFAULT_BACKDROP_OPACITY
13078
- })
13079
- }), /*#__PURE__*/React.createElement(Animated.View, {
13050
+ }, [visible]);
13051
+ return /*#__PURE__*/React.createElement(StyledContainer$3, {
13080
13052
  testID: testID,
13081
- style: _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
13082
- opacity: animationType === 'fade' ? modalAnimation : 1,
13053
+ enableShadow: enableShadow,
13054
+ pointerEvents: "box-none"
13055
+ }, /*#__PURE__*/React.createElement(StyledBackdrop$1, {
13056
+ pointerEvents: visible ? 'auto' : 'box-none',
13057
+ onPress: onDismiss,
13058
+ style: {
13059
+ opacity: interpolateBackdropOpacity
13060
+ }
13061
+ }), /*#__PURE__*/React.createElement(StyledDrawerContainer, {
13062
+ enableShadow: enableShadow,
13063
+ onLayout: function onLayout(_ref2) {
13064
+ var nativeEvent = _ref2.nativeEvent;
13065
+ return setHeight(nativeEvent.layout.height);
13066
+ },
13067
+ style: {
13083
13068
  transform: [{
13084
- translateY: animationType === 'slide' ? modalAnimation : 0
13069
+ translateY: interpolateTranslateY
13085
13070
  }]
13086
- })
13071
+ }
13087
13072
  }, children));
13073
+ };
13074
+ var index$7 = Object.assign(Drawer, {
13075
+ Dragable: DragableDrawer
13088
13076
  });
13089
- var ModalWrapper = function ModalWrapper(_ref3) {
13090
- var _ref3$visible = _ref3.visible,
13091
- visible = _ref3$visible === void 0 ? true : _ref3$visible,
13092
- props = _objectWithoutProperties(_ref3, _excluded$e);
13093
- var modalRef = useRef(null);
13094
- var _useState = useState(visible),
13095
- _useState2 = _slicedToArray(_useState, 2),
13096
- internalVisible = _useState2[0],
13097
- setInternalVisible = _useState2[1];
13098
- useEffect(function () {
13099
- if (visible) {
13100
- setInternalVisible(true);
13101
- } else {
13102
- var _modalRef$current;
13103
- // Wait for animation to finish before hiding the modal
13104
- (_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : _modalRef$current.hide(function () {
13105
- return setInternalVisible(false);
13106
- });
13107
- }
13108
- }, [visible]);
13109
- useEffect(function () {
13110
- if (internalVisible) {
13111
- var _modalRef$current2;
13112
- (_modalRef$current2 = modalRef.current) === null || _modalRef$current2 === void 0 ? void 0 : _modalRef$current2.show();
13113
- }
13114
- }, [internalVisible]);
13115
- return internalVisible ? /*#__PURE__*/React.createElement(Modal, _extends$1({
13116
- ref: modalRef
13117
- }, props)) : null;
13077
+
13078
+ var StyledWrapper$6 = index$a(View)(function (_ref) {
13079
+ var theme = _ref.theme;
13080
+ return {
13081
+ display: 'flex',
13082
+ flex: 1,
13083
+ flexDirection: 'column',
13084
+ alignItems: 'center',
13085
+ justifyContent: 'center',
13086
+ padding: theme.__hd__.empty.space.wrapperPadding
13087
+ };
13088
+ });
13089
+ var StyledTitle = index$a(Typography.Title)(function (_ref2) {
13090
+ var theme = _ref2.theme,
13091
+ themeVariant = _ref2.themeVariant;
13092
+ return {
13093
+ textAlign: 'center',
13094
+ marginBottom: theme.__hd__.empty.space.titleMargin,
13095
+ color: themeVariant === 'dark' ? theme.__hd__.empty.colors.invertedText : theme.__hd__.empty.colors.text
13096
+ };
13097
+ });
13098
+ var StyledDescription = index$a(Typography.Body)(function (_ref3) {
13099
+ var theme = _ref3.theme,
13100
+ themeVariant = _ref3.themeVariant;
13101
+ return {
13102
+ textAlign: 'center',
13103
+ color: themeVariant === 'dark' ? theme.__hd__.empty.colors.invertedSubduedText : theme.__hd__.empty.colors.subduedText
13104
+ };
13105
+ });
13106
+
13107
+ var Empty = function Empty(_ref) {
13108
+ var image = _ref.image,
13109
+ title = _ref.title,
13110
+ description = _ref.description,
13111
+ style = _ref.style,
13112
+ testID = _ref.testID,
13113
+ _ref$variant = _ref.variant,
13114
+ variant = _ref$variant === void 0 ? 'light' : _ref$variant;
13115
+ var theme = useTheme();
13116
+ return /*#__PURE__*/React.createElement(StyledWrapper$6, {
13117
+ style: style,
13118
+ testID: testID
13119
+ }, image !== undefined && /*#__PURE__*/React.cloneElement(image, _objectSpread2(_objectSpread2({}, image.props), {}, {
13120
+ style: [{
13121
+ marginBottom: theme.__hd__.empty.space.imageMargin
13122
+ }, image.props.style]
13123
+ })), /*#__PURE__*/React.createElement(StyledTitle, {
13124
+ themeVariant: variant,
13125
+ level: "h4",
13126
+ typeface: "playful"
13127
+ }, title), !!description && /*#__PURE__*/React.createElement(StyledDescription, {
13128
+ themeVariant: variant,
13129
+ typeface: "playful"
13130
+ }, description));
13118
13131
  };
13119
13132
 
13120
13133
  var StyledErrorModal = index$a(ModalWrapper)({