@hero-design/rn 8.42.0-rc.0 → 8.42.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/.turbo/turbo-build.log +1 -1
- package/es/index.js +698 -684
- package/lib/index.js +697 -683
- package/package.json +7 -7
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +211 -197
- package/src/components/BottomSheet/index.tsx +1 -1
- package/src/components/Carousel/__tests__/index.spec.tsx +10 -8
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +0 -12
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +399 -416
- package/src/components/Error/__tests__/index.spec.tsx +6 -9
- package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +10 -8
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +451 -363
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +10 -7
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +419 -357
- package/src/components/Success/__tests__/index.spec.tsx +6 -9
- package/src/components/Tabs/__tests__/SceneView.spec.tsx +23 -19
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +399 -416
- package/src/testHelpers/renderWithTheme.tsx +7 -1
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, TouchableWithoutFeedback, Pressable, SafeAreaView, KeyboardAvoidingView, TouchableHighlight, ScrollView,
|
|
2
|
+
import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View, UIManager, LayoutAnimation, TouchableOpacity, Text as Text$1, Easing, Image as Image$1, TouchableWithoutFeedback, Pressable, SafeAreaView, KeyboardAvoidingView, TouchableHighlight, ScrollView, BackHandler, FlatList, useWindowDimensions, TextInput as TextInput$1, PanResponder, Modal as Modal$1, InteractionManager, Keyboard, SectionList, 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 { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -994,9 +994,16 @@ var palette$b = {
|
|
|
994
994
|
black: '#000000',
|
|
995
995
|
white: '#ffffff',
|
|
996
996
|
blue: blue$1.base,
|
|
997
|
+
blueDark15: blue$1.darken15,
|
|
997
998
|
blueDark30: blue$1.darken30,
|
|
999
|
+
blueDark45: blue$1.darken45,
|
|
1000
|
+
blueDark60: blue$1.darken60,
|
|
998
1001
|
blueDark75: blue$1.darken75,
|
|
1002
|
+
blueDark90: blue$1.darken90,
|
|
1003
|
+
blueLight15: blue$1.lighten15,
|
|
999
1004
|
blueLight30: blue$1.lighten30,
|
|
1005
|
+
blueLight45: blue$1.lighten45,
|
|
1006
|
+
blueLight60: blue$1.lighten60,
|
|
1000
1007
|
blueLight75: blue$1.lighten75,
|
|
1001
1008
|
blueLight90: blue$1.lighten90,
|
|
1002
1009
|
dodgerBlue: ultramarineBlue$2.base,
|
|
@@ -1056,9 +1063,13 @@ var palette$b = {
|
|
|
1056
1063
|
red: vermilion$2.base,
|
|
1057
1064
|
redDark15: vermilion$2.darken15,
|
|
1058
1065
|
redDark30: vermilion$2.darken30,
|
|
1066
|
+
redDark45: vermilion$2.darken45,
|
|
1067
|
+
redDark60: vermilion$2.darken60,
|
|
1059
1068
|
redDark75: vermilion$2.darken75,
|
|
1069
|
+
redDark90: vermilion$2.darken90,
|
|
1060
1070
|
redLight15: vermilion$2.lighten15,
|
|
1061
1071
|
redLight30: vermilion$2.lighten30,
|
|
1072
|
+
redLight45: vermilion$2.lighten45,
|
|
1062
1073
|
redLight60: vermilion$2.lighten60,
|
|
1063
1074
|
redLight75: vermilion$2.lighten75,
|
|
1064
1075
|
redLight90: vermilion$2.lighten90,
|
|
@@ -1075,7 +1086,10 @@ var palette$b = {
|
|
|
1075
1086
|
violetDark45: violet$1.darken45,
|
|
1076
1087
|
violetDark60: violet$1.darken60,
|
|
1077
1088
|
violetDark75: violet$1.darken75,
|
|
1089
|
+
violetDark90: violet$1.darken90,
|
|
1090
|
+
violetLight15: violet$1.lighten15,
|
|
1078
1091
|
violetLight30: violet$1.lighten30,
|
|
1092
|
+
violetLight45: violet$1.lighten45,
|
|
1079
1093
|
violetLight60: violet$1.lighten60,
|
|
1080
1094
|
violetLight75: violet$1.lighten75,
|
|
1081
1095
|
violetLight90: violet$1.lighten90,
|
|
@@ -8470,6 +8484,332 @@ var BottomSheetScrollView = function BottomSheetScrollView(_ref) {
|
|
|
8470
8484
|
}));
|
|
8471
8485
|
};
|
|
8472
8486
|
|
|
8487
|
+
var customAlphabet = function customAlphabet(alphabet) {
|
|
8488
|
+
var defaultSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 21;
|
|
8489
|
+
return function () {
|
|
8490
|
+
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSize;
|
|
8491
|
+
var id = '';
|
|
8492
|
+
var i = size;
|
|
8493
|
+
while (i--) {
|
|
8494
|
+
id += alphabet[Math.random() * alphabet.length | 0];
|
|
8495
|
+
}
|
|
8496
|
+
return id;
|
|
8497
|
+
};
|
|
8498
|
+
};
|
|
8499
|
+
|
|
8500
|
+
var ACTIONS;
|
|
8501
|
+
(function (ACTIONS) {
|
|
8502
|
+
ACTIONS[ACTIONS["REGISTER_HOST"] = 0] = "REGISTER_HOST";
|
|
8503
|
+
ACTIONS[ACTIONS["DEREGISTER_HOST"] = 1] = "DEREGISTER_HOST";
|
|
8504
|
+
ACTIONS[ACTIONS["ADD_UPDATE_PORTAL"] = 2] = "ADD_UPDATE_PORTAL";
|
|
8505
|
+
ACTIONS[ACTIONS["REMOVE_PORTAL"] = 3] = "REMOVE_PORTAL";
|
|
8506
|
+
})(ACTIONS || (ACTIONS = {}));
|
|
8507
|
+
var INITIAL_STATE = {};
|
|
8508
|
+
|
|
8509
|
+
var PortalStateContext = /*#__PURE__*/createContext(null);
|
|
8510
|
+
var PortalDispatchContext = /*#__PURE__*/createContext(null);
|
|
8511
|
+
|
|
8512
|
+
var usePortal = function usePortal() {
|
|
8513
|
+
var hostName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'root';
|
|
8514
|
+
var dispatch = useContext(PortalDispatchContext);
|
|
8515
|
+
if (dispatch === null) {
|
|
8516
|
+
throw new Error("You must add 'PortalProvider' to the root component.");
|
|
8517
|
+
}
|
|
8518
|
+
var registerHost = useCallback(function () {
|
|
8519
|
+
dispatch({
|
|
8520
|
+
type: ACTIONS.REGISTER_HOST,
|
|
8521
|
+
hostName: hostName
|
|
8522
|
+
});
|
|
8523
|
+
}, []);
|
|
8524
|
+
var deregisterHost = useCallback(function () {
|
|
8525
|
+
dispatch({
|
|
8526
|
+
type: ACTIONS.DEREGISTER_HOST,
|
|
8527
|
+
hostName: hostName
|
|
8528
|
+
});
|
|
8529
|
+
}, []);
|
|
8530
|
+
var addUpdatePortal = useCallback(function (name, node) {
|
|
8531
|
+
dispatch({
|
|
8532
|
+
type: ACTIONS.ADD_UPDATE_PORTAL,
|
|
8533
|
+
hostName: hostName,
|
|
8534
|
+
portalName: name,
|
|
8535
|
+
node: node
|
|
8536
|
+
});
|
|
8537
|
+
}, []);
|
|
8538
|
+
var removePortal = useCallback(function (name) {
|
|
8539
|
+
dispatch({
|
|
8540
|
+
type: ACTIONS.REMOVE_PORTAL,
|
|
8541
|
+
hostName: hostName,
|
|
8542
|
+
portalName: name
|
|
8543
|
+
});
|
|
8544
|
+
}, []);
|
|
8545
|
+
return {
|
|
8546
|
+
registerHost: registerHost,
|
|
8547
|
+
deregisterHost: deregisterHost,
|
|
8548
|
+
addPortal: addUpdatePortal,
|
|
8549
|
+
updatePortal: addUpdatePortal,
|
|
8550
|
+
removePortal: removePortal
|
|
8551
|
+
};
|
|
8552
|
+
};
|
|
8553
|
+
|
|
8554
|
+
var usePortalState = function usePortalState(hostName) {
|
|
8555
|
+
var state = useContext(PortalStateContext);
|
|
8556
|
+
if (state === null) {
|
|
8557
|
+
throw new Error("You must add 'PortalProvider' to the root component.");
|
|
8558
|
+
}
|
|
8559
|
+
return state[hostName] || [];
|
|
8560
|
+
};
|
|
8561
|
+
|
|
8562
|
+
var PortalHostComponent = function PortalHostComponent(_ref) {
|
|
8563
|
+
var name = _ref.name;
|
|
8564
|
+
var state = usePortalState(name);
|
|
8565
|
+
var _usePortal = usePortal(name),
|
|
8566
|
+
registerHost = _usePortal.registerHost,
|
|
8567
|
+
deregisterHost = _usePortal.deregisterHost;
|
|
8568
|
+
useEffect(function () {
|
|
8569
|
+
registerHost();
|
|
8570
|
+
return function () {
|
|
8571
|
+
deregisterHost();
|
|
8572
|
+
};
|
|
8573
|
+
}, []);
|
|
8574
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, state.map(function (item) {
|
|
8575
|
+
return item.node;
|
|
8576
|
+
}));
|
|
8577
|
+
};
|
|
8578
|
+
var PortalHost = /*#__PURE__*/memo(PortalHostComponent);
|
|
8579
|
+
PortalHost.displayName = 'PortalHost';
|
|
8580
|
+
|
|
8581
|
+
var registerHostIfNotExist = function registerHostIfNotExist(state, hostName) {
|
|
8582
|
+
if (!(hostName in state)) {
|
|
8583
|
+
return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, hostName, []));
|
|
8584
|
+
}
|
|
8585
|
+
return _objectSpread2({}, state);
|
|
8586
|
+
};
|
|
8587
|
+
var deregisterHost = function deregisterHost(state, hostName) {
|
|
8588
|
+
return _objectSpread2({}, omit([hostName], state));
|
|
8589
|
+
};
|
|
8590
|
+
var addUpdatePortal = function addUpdatePortal(state, hostName, portalName, node) {
|
|
8591
|
+
var newState = registerHostIfNotExist(state, hostName);
|
|
8592
|
+
var index = newState[hostName].findIndex(function (item) {
|
|
8593
|
+
return item.name === portalName;
|
|
8594
|
+
});
|
|
8595
|
+
if (index !== -1) {
|
|
8596
|
+
return _objectSpread2(_objectSpread2({}, newState), {}, _defineProperty({}, hostName, newState[hostName].map(function (item, i) {
|
|
8597
|
+
if (index === i) {
|
|
8598
|
+
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
8599
|
+
node: node
|
|
8600
|
+
});
|
|
8601
|
+
}
|
|
8602
|
+
return item;
|
|
8603
|
+
})));
|
|
8604
|
+
}
|
|
8605
|
+
return _objectSpread2(_objectSpread2({}, newState), {}, _defineProperty({}, hostName, [].concat(_toConsumableArray(newState[hostName]), [{
|
|
8606
|
+
name: portalName,
|
|
8607
|
+
node: node
|
|
8608
|
+
}])));
|
|
8609
|
+
};
|
|
8610
|
+
var removePortal = function removePortal(state, hostName, portalName) {
|
|
8611
|
+
if (!(hostName in state)) {
|
|
8612
|
+
return _objectSpread2({}, state);
|
|
8613
|
+
}
|
|
8614
|
+
return _objectSpread2(_objectSpread2({}, state), {}, _defineProperty({}, hostName, state[hostName].filter(function (item) {
|
|
8615
|
+
return item.name !== portalName;
|
|
8616
|
+
})));
|
|
8617
|
+
};
|
|
8618
|
+
var reducer = function reducer(state, action) {
|
|
8619
|
+
var type = action.type;
|
|
8620
|
+
switch (type) {
|
|
8621
|
+
case ACTIONS.REGISTER_HOST:
|
|
8622
|
+
return registerHostIfNotExist(state, action.hostName);
|
|
8623
|
+
case ACTIONS.DEREGISTER_HOST:
|
|
8624
|
+
return deregisterHost(state, action.hostName);
|
|
8625
|
+
case ACTIONS.ADD_UPDATE_PORTAL:
|
|
8626
|
+
return addUpdatePortal(state, action.hostName, action.portalName, action.node);
|
|
8627
|
+
case ACTIONS.REMOVE_PORTAL:
|
|
8628
|
+
return removePortal(state, action.hostName, action.portalName);
|
|
8629
|
+
default:
|
|
8630
|
+
return _objectSpread2({}, state);
|
|
8631
|
+
}
|
|
8632
|
+
};
|
|
8633
|
+
|
|
8634
|
+
var PortalProviderComponent = function PortalProviderComponent(_ref) {
|
|
8635
|
+
var _ref$rootHostName = _ref.rootHostName,
|
|
8636
|
+
rootHostName = _ref$rootHostName === void 0 ? 'root' : _ref$rootHostName,
|
|
8637
|
+
children = _ref.children;
|
|
8638
|
+
var _useReducer = useReducer(reducer, INITIAL_STATE),
|
|
8639
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
8640
|
+
state = _useReducer2[0],
|
|
8641
|
+
dispatch = _useReducer2[1];
|
|
8642
|
+
return /*#__PURE__*/React.createElement(PortalDispatchContext.Provider, {
|
|
8643
|
+
value: dispatch
|
|
8644
|
+
}, /*#__PURE__*/React.createElement(PortalStateContext.Provider, {
|
|
8645
|
+
value: state
|
|
8646
|
+
}, children, /*#__PURE__*/React.createElement(PortalHost, {
|
|
8647
|
+
name: rootHostName
|
|
8648
|
+
})));
|
|
8649
|
+
};
|
|
8650
|
+
var PortalProvider = /*#__PURE__*/memo(PortalProviderComponent);
|
|
8651
|
+
PortalProvider.displayName = 'PortalProvider';
|
|
8652
|
+
|
|
8653
|
+
var nanoid = customAlphabet('abcdefghijklmnopqrstuvwxyz0123456789', 10);
|
|
8654
|
+
var PortalComponent = function PortalComponent(_ref) {
|
|
8655
|
+
var name = _ref.name,
|
|
8656
|
+
hostName = _ref.hostName,
|
|
8657
|
+
children = _ref.children,
|
|
8658
|
+
theme = _ref.theme;
|
|
8659
|
+
var defaultTheme = useTheme();
|
|
8660
|
+
var _usePortal = usePortal(hostName),
|
|
8661
|
+
addUpdatePortal = _usePortal.addPortal,
|
|
8662
|
+
removePortal = _usePortal.removePortal;
|
|
8663
|
+
var nameOrRandom = useMemo(function () {
|
|
8664
|
+
return name || nanoid();
|
|
8665
|
+
}, [name]);
|
|
8666
|
+
var ChildrenComponent = useMemo(function () {
|
|
8667
|
+
return /*#__PURE__*/React.createElement(ThemeProvider, {
|
|
8668
|
+
theme: theme || defaultTheme
|
|
8669
|
+
}, children);
|
|
8670
|
+
}, [theme, children, defaultTheme]);
|
|
8671
|
+
useLayoutEffect(function () {
|
|
8672
|
+
addUpdatePortal(nameOrRandom, ChildrenComponent);
|
|
8673
|
+
return function () {
|
|
8674
|
+
removePortal(nameOrRandom);
|
|
8675
|
+
};
|
|
8676
|
+
}, [addUpdatePortal]);
|
|
8677
|
+
useLayoutEffect(function () {
|
|
8678
|
+
addUpdatePortal(nameOrRandom, ChildrenComponent);
|
|
8679
|
+
}, [ChildrenComponent]);
|
|
8680
|
+
return null;
|
|
8681
|
+
};
|
|
8682
|
+
var Portal = /*#__PURE__*/memo(PortalComponent);
|
|
8683
|
+
Portal.displayName = 'Portal';
|
|
8684
|
+
var Portal$1 = Object.assign(Portal, {
|
|
8685
|
+
Provider: PortalProvider,
|
|
8686
|
+
Host: PortalHost
|
|
8687
|
+
});
|
|
8688
|
+
|
|
8689
|
+
var _excluded$m = ["visible"];
|
|
8690
|
+
var DEFAULT_BACKDROP_OPACITY = 0.4;
|
|
8691
|
+
var DEFAULT_ANIMATION_CONFIG = {
|
|
8692
|
+
easing: Easing.inOut(Easing.cubic),
|
|
8693
|
+
useNativeDriver: Platform.OS !== 'web',
|
|
8694
|
+
duration: 400
|
|
8695
|
+
};
|
|
8696
|
+
var Modal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
8697
|
+
var children = _ref.children,
|
|
8698
|
+
onShow = _ref.onShow,
|
|
8699
|
+
onRequestClose = _ref.onRequestClose,
|
|
8700
|
+
testID = _ref.testID,
|
|
8701
|
+
_ref$animationType = _ref.animationType,
|
|
8702
|
+
animationType = _ref$animationType === void 0 ? 'none' : _ref$animationType,
|
|
8703
|
+
_ref$transparent = _ref.transparent,
|
|
8704
|
+
transparent = _ref$transparent === void 0 ? false : _ref$transparent,
|
|
8705
|
+
onDismiss = _ref.onDismiss;
|
|
8706
|
+
var theme = useTheme();
|
|
8707
|
+
var animatedBackdropValue = useRef(new Animated.Value(0)).current;
|
|
8708
|
+
var animatedModalValue = useRef(new Animated.Value(0)).current;
|
|
8709
|
+
// Show or hide the backdrop and modal content
|
|
8710
|
+
var animateBackdropAndContent = useCallback(function (_ref2) {
|
|
8711
|
+
var toValue = _ref2.toValue,
|
|
8712
|
+
callback = _ref2.callback;
|
|
8713
|
+
if (animationType !== 'none') {
|
|
8714
|
+
// Backdrop animation
|
|
8715
|
+
if (!transparent) {
|
|
8716
|
+
Animated.timing(animatedBackdropValue, _objectSpread2({
|
|
8717
|
+
toValue: toValue
|
|
8718
|
+
}, DEFAULT_ANIMATION_CONFIG)).start();
|
|
8719
|
+
}
|
|
8720
|
+
// Modal content animation
|
|
8721
|
+
Animated.timing(animatedModalValue, _objectSpread2({
|
|
8722
|
+
toValue: toValue
|
|
8723
|
+
}, DEFAULT_ANIMATION_CONFIG)).start(callback);
|
|
8724
|
+
} else {
|
|
8725
|
+
callback === null || callback === void 0 ? void 0 : callback();
|
|
8726
|
+
}
|
|
8727
|
+
}, [animationType, onShow, transparent]);
|
|
8728
|
+
var backdropOpacityAnimation = animatedBackdropValue.interpolate({
|
|
8729
|
+
inputRange: [0, 1],
|
|
8730
|
+
outputRange: [0, DEFAULT_BACKDROP_OPACITY]
|
|
8731
|
+
});
|
|
8732
|
+
var modalAnimation = animatedModalValue.interpolate({
|
|
8733
|
+
inputRange: [0, 1],
|
|
8734
|
+
outputRange: animationType === 'slide' ? [Dimensions.get('window').height, 0] : [0, 1]
|
|
8735
|
+
});
|
|
8736
|
+
useImperativeHandle(ref, function () {
|
|
8737
|
+
return {
|
|
8738
|
+
show: function show() {
|
|
8739
|
+
animateBackdropAndContent({
|
|
8740
|
+
toValue: 1,
|
|
8741
|
+
callback: onShow
|
|
8742
|
+
});
|
|
8743
|
+
},
|
|
8744
|
+
hide: function hide(wrapperCallback) {
|
|
8745
|
+
animateBackdropAndContent({
|
|
8746
|
+
toValue: 0,
|
|
8747
|
+
callback: function callback() {
|
|
8748
|
+
if (Platform.OS === 'ios') {
|
|
8749
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
8750
|
+
}
|
|
8751
|
+
wrapperCallback();
|
|
8752
|
+
}
|
|
8753
|
+
});
|
|
8754
|
+
}
|
|
8755
|
+
};
|
|
8756
|
+
}, [onDismiss, onShow, animateBackdropAndContent]);
|
|
8757
|
+
// Back button handler
|
|
8758
|
+
useEffect(function () {
|
|
8759
|
+
var backHandler = BackHandler.addEventListener('hardwareBackPress', function () {
|
|
8760
|
+
onRequestClose === null || onRequestClose === void 0 ? void 0 : onRequestClose();
|
|
8761
|
+
return true;
|
|
8762
|
+
});
|
|
8763
|
+
return function () {
|
|
8764
|
+
return backHandler.remove();
|
|
8765
|
+
};
|
|
8766
|
+
}, [onRequestClose]);
|
|
8767
|
+
return /*#__PURE__*/React.createElement(Portal$1, null, /*#__PURE__*/React.createElement(Animated.View, {
|
|
8768
|
+
style: _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
8769
|
+
backgroundColor: transparent ? 'transparent' : theme.colors.overlayGlobalSurface,
|
|
8770
|
+
opacity: animationType !== 'none' ? backdropOpacityAnimation : DEFAULT_BACKDROP_OPACITY
|
|
8771
|
+
})
|
|
8772
|
+
}), /*#__PURE__*/React.createElement(Animated.View, {
|
|
8773
|
+
testID: testID,
|
|
8774
|
+
style: _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
8775
|
+
opacity: animationType === 'fade' ? modalAnimation : 1,
|
|
8776
|
+
transform: [{
|
|
8777
|
+
translateY: animationType === 'slide' ? modalAnimation : 0
|
|
8778
|
+
}]
|
|
8779
|
+
})
|
|
8780
|
+
}, children));
|
|
8781
|
+
});
|
|
8782
|
+
var ModalWrapper = function ModalWrapper(_ref3) {
|
|
8783
|
+
var _ref3$visible = _ref3.visible,
|
|
8784
|
+
visible = _ref3$visible === void 0 ? true : _ref3$visible,
|
|
8785
|
+
props = _objectWithoutProperties(_ref3, _excluded$m);
|
|
8786
|
+
var modalRef = useRef(null);
|
|
8787
|
+
var _useState = useState(visible),
|
|
8788
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
8789
|
+
internalVisible = _useState2[0],
|
|
8790
|
+
setInternalVisible = _useState2[1];
|
|
8791
|
+
useEffect(function () {
|
|
8792
|
+
if (visible) {
|
|
8793
|
+
setInternalVisible(true);
|
|
8794
|
+
} else {
|
|
8795
|
+
var _modalRef$current;
|
|
8796
|
+
// Wait for animation to finish before hiding the modal
|
|
8797
|
+
(_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 ? void 0 : _modalRef$current.hide(function () {
|
|
8798
|
+
return setInternalVisible(false);
|
|
8799
|
+
});
|
|
8800
|
+
}
|
|
8801
|
+
}, [visible]);
|
|
8802
|
+
useEffect(function () {
|
|
8803
|
+
if (internalVisible) {
|
|
8804
|
+
var _modalRef$current2;
|
|
8805
|
+
(_modalRef$current2 = modalRef.current) === null || _modalRef$current2 === void 0 ? void 0 : _modalRef$current2.show();
|
|
8806
|
+
}
|
|
8807
|
+
}, [internalVisible]);
|
|
8808
|
+
return internalVisible ? /*#__PURE__*/React.createElement(Modal, _extends$1({
|
|
8809
|
+
ref: modalRef
|
|
8810
|
+
}, props)) : null;
|
|
8811
|
+
};
|
|
8812
|
+
|
|
8473
8813
|
var BottomSheet = function BottomSheet(_ref) {
|
|
8474
8814
|
var open = _ref.open,
|
|
8475
8815
|
header = _ref.header,
|
|
@@ -8546,7 +8886,7 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
8546
8886
|
setInternalShowDivider: setInternalShowDivider
|
|
8547
8887
|
};
|
|
8548
8888
|
}, [setInternalShowDivider]);
|
|
8549
|
-
return /*#__PURE__*/React.createElement(
|
|
8889
|
+
return /*#__PURE__*/React.createElement(ModalWrapper, {
|
|
8550
8890
|
visible: visible,
|
|
8551
8891
|
onRequestClose: onRequestClose,
|
|
8552
8892
|
transparent: true,
|
|
@@ -8759,7 +9099,7 @@ var borderWidths = {
|
|
|
8759
9099
|
var config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, colors), space), radii), borderWidths);
|
|
8760
9100
|
var flexPropsKey = ['alignContent', 'alignItems', 'alignSelf', 'display', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent'];
|
|
8761
9101
|
|
|
8762
|
-
var _excluded$
|
|
9102
|
+
var _excluded$l = ["theme"];
|
|
8763
9103
|
var getThemeValue = function getThemeValue(theme, key, props) {
|
|
8764
9104
|
var propConfig = config[key];
|
|
8765
9105
|
var propValue = props[key];
|
|
@@ -8786,18 +9126,18 @@ var mapStylePropToThemeValue = function mapStylePropToThemeValue(theme, props) {
|
|
|
8786
9126
|
var configKeys = Object.keys(config);
|
|
8787
9127
|
var StyledBox = index$a(View)(function (_ref5) {
|
|
8788
9128
|
var theme = _ref5.theme,
|
|
8789
|
-
otherProps = _objectWithoutProperties(_ref5, _excluded$
|
|
9129
|
+
otherProps = _objectWithoutProperties(_ref5, _excluded$l);
|
|
8790
9130
|
var styleProps = pick(configKeys, otherProps);
|
|
8791
9131
|
var flexProps = pick(_toConsumableArray(flexPropsKey), otherProps);
|
|
8792
9132
|
return _objectSpread2(_objectSpread2({}, mapStylePropToThemeValue(theme, styleProps)), flexProps);
|
|
8793
9133
|
});
|
|
8794
9134
|
|
|
8795
|
-
var _excluded$
|
|
9135
|
+
var _excluded$k = ["children", "style", "testID"];
|
|
8796
9136
|
var Box = function Box(_ref) {
|
|
8797
9137
|
var children = _ref.children,
|
|
8798
9138
|
style = _ref.style,
|
|
8799
9139
|
testID = _ref.testID,
|
|
8800
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
9140
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$k);
|
|
8801
9141
|
return /*#__PURE__*/React.createElement(StyledBox, _extends$1({}, otherProps, {
|
|
8802
9142
|
style: style,
|
|
8803
9143
|
testID: testID
|
|
@@ -11437,7 +11777,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
11437
11777
|
})));
|
|
11438
11778
|
};
|
|
11439
11779
|
|
|
11440
|
-
var _excluded$
|
|
11780
|
+
var _excluded$j = ["rounded", "size", "testID", "style"];
|
|
11441
11781
|
var Image = function Image(_ref) {
|
|
11442
11782
|
var _ref$rounded = _ref.rounded,
|
|
11443
11783
|
rounded = _ref$rounded === void 0 ? false : _ref$rounded,
|
|
@@ -11445,7 +11785,7 @@ var Image = function Image(_ref) {
|
|
|
11445
11785
|
size = _ref$size === void 0 ? '6xlarge' : _ref$size,
|
|
11446
11786
|
testID = _ref.testID,
|
|
11447
11787
|
style = _ref.style,
|
|
11448
|
-
imageNativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
11788
|
+
imageNativeProps = _objectWithoutProperties(_ref, _excluded$j);
|
|
11449
11789
|
var theme = useTheme();
|
|
11450
11790
|
var imageSize = theme.__hd__.image.sizes[size];
|
|
11451
11791
|
return /*#__PURE__*/React.createElement(Image$1, _extends$1({
|
|
@@ -11650,12 +11990,12 @@ var Indicator = index$a(View)(function (_ref2) {
|
|
|
11650
11990
|
};
|
|
11651
11991
|
});
|
|
11652
11992
|
|
|
11653
|
-
var _excluded$
|
|
11993
|
+
var _excluded$i = ["intent", "children"];
|
|
11654
11994
|
var DataCard = function DataCard(_ref) {
|
|
11655
11995
|
var _ref$intent = _ref.intent,
|
|
11656
11996
|
intent = _ref$intent === void 0 ? 'info' : _ref$intent,
|
|
11657
11997
|
children = _ref.children,
|
|
11658
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
11998
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$i);
|
|
11659
11999
|
return /*#__PURE__*/React.createElement(StyledDataCard, nativeProps, /*#__PURE__*/React.createElement(Indicator, {
|
|
11660
12000
|
themeIntent: intent,
|
|
11661
12001
|
testID: "data-card-indicator"
|
|
@@ -11673,11 +12013,11 @@ var StyledCard$1 = index$a(View)(function (_ref) {
|
|
|
11673
12013
|
});
|
|
11674
12014
|
});
|
|
11675
12015
|
|
|
11676
|
-
var _excluded$
|
|
12016
|
+
var _excluded$h = ["intent", "children"];
|
|
11677
12017
|
var Card = function Card(_ref) {
|
|
11678
12018
|
var intent = _ref.intent,
|
|
11679
12019
|
children = _ref.children,
|
|
11680
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
12020
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$h);
|
|
11681
12021
|
return /*#__PURE__*/React.createElement(StyledCard$1, _extends$1({}, nativeProps, {
|
|
11682
12022
|
themeIntent: intent
|
|
11683
12023
|
}), children);
|
|
@@ -11884,7 +12224,7 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
11884
12224
|
});
|
|
11885
12225
|
CardCarousel.displayName = 'CardCarousel';
|
|
11886
12226
|
|
|
11887
|
-
var _excluded$
|
|
12227
|
+
var _excluded$g = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "shouldShowPagination", "testID", "pageControlPosition"];
|
|
11888
12228
|
function useStateFromProp(initialValue) {
|
|
11889
12229
|
var _useState = useState(initialValue),
|
|
11890
12230
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -11910,7 +12250,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
11910
12250
|
testID = _ref.testID,
|
|
11911
12251
|
_ref$pageControlPosit = _ref.pageControlPosition,
|
|
11912
12252
|
pageControlPosition = _ref$pageControlPosit === void 0 ? 'top' : _ref$pageControlPosit,
|
|
11913
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
12253
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$g);
|
|
11914
12254
|
useDeprecation("shouldShowPagination prop has been deprecated", shouldShowPagination !== noop);
|
|
11915
12255
|
useDeprecation("The use of 'pageControlPosition == bottom' has been deprecated", pageControlPosition === 'bottom');
|
|
11916
12256
|
var carouselRef = useRef(null);
|
|
@@ -12247,7 +12587,7 @@ var StyledErrorAndMaxLengthContainer = index$a(View)(function () {
|
|
|
12247
12587
|
};
|
|
12248
12588
|
});
|
|
12249
12589
|
|
|
12250
|
-
var _excluded$
|
|
12590
|
+
var _excluded$f = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "hideCharacterCount", "helpText", "value", "defaultValue", "renderInputValue", "allowFontScaling", "variant"];
|
|
12251
12591
|
var getState$1 = function getState(_ref) {
|
|
12252
12592
|
var disabled = _ref.disabled,
|
|
12253
12593
|
error = _ref.error,
|
|
@@ -12299,7 +12639,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
12299
12639
|
allowFontScaling = _ref2$allowFontScalin === void 0 ? false : _ref2$allowFontScalin,
|
|
12300
12640
|
_ref2$variant = _ref2.variant,
|
|
12301
12641
|
variant = _ref2$variant === void 0 ? 'text' : _ref2$variant,
|
|
12302
|
-
nativeProps = _objectWithoutProperties(_ref2, _excluded$
|
|
12642
|
+
nativeProps = _objectWithoutProperties(_ref2, _excluded$f);
|
|
12303
12643
|
var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
|
|
12304
12644
|
var isEmptyValue = displayText.length === 0;
|
|
12305
12645
|
var actualSuffix = loading ? 'loading' : suffix;
|
|
@@ -12720,719 +13060,393 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
12720
13060
|
style: style
|
|
12721
13061
|
})), /*#__PURE__*/React.createElement(BottomSheet$1, {
|
|
12722
13062
|
open: open,
|
|
12723
|
-
onRequestClose: function onRequestClose() {
|
|
12724
|
-
return setOpen(false);
|
|
12725
|
-
},
|
|
12726
|
-
header: label,
|
|
12727
|
-
footer: /*#__PURE__*/React.createElement(CompoundButton, {
|
|
12728
|
-
variant: "text",
|
|
12729
|
-
text: confirmLabel,
|
|
12730
|
-
onPress: function onPress() {
|
|
12731
|
-
if (selectingDate) {
|
|
12732
|
-
onChange(selectingDate);
|
|
12733
|
-
}
|
|
12734
|
-
setOpen(false);
|
|
12735
|
-
}
|
|
12736
|
-
})
|
|
12737
|
-
}, /*#__PURE__*/React.createElement(StyledPickerWrapper$1, null, /*#__PURE__*/React.createElement(DateTimePicker, {
|
|
12738
|
-
testID: "datePickerIOS",
|
|
12739
|
-
value: selectingDate,
|
|
12740
|
-
minimumDate: minDate,
|
|
12741
|
-
maximumDate: maxDate,
|
|
12742
|
-
mode: "date",
|
|
12743
|
-
onChange: function onChange(_, date) {
|
|
12744
|
-
if (date) {
|
|
12745
|
-
setSelectingDate(date);
|
|
12746
|
-
}
|
|
12747
|
-
},
|
|
12748
|
-
display: "spinner",
|
|
12749
|
-
style: {
|
|
12750
|
-
flex: 1
|
|
12751
|
-
},
|
|
12752
|
-
textColor: theme.colors.onDefaultGlobalSurface
|
|
12753
|
-
}))));
|
|
12754
|
-
};
|
|
12755
|
-
|
|
12756
|
-
var _excluded$f = ["variant"];
|
|
12757
|
-
var DatePicker = function DatePicker(_ref) {
|
|
12758
|
-
var _ref$variant = _ref.variant,
|
|
12759
|
-
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
12760
|
-
props = _objectWithoutProperties(_ref, _excluded$f);
|
|
12761
|
-
if (variant === 'calendar') {
|
|
12762
|
-
return /*#__PURE__*/React.createElement(DatePickerCalendar, props);
|
|
12763
|
-
}
|
|
12764
|
-
if (Platform.OS === 'ios') {
|
|
12765
|
-
return /*#__PURE__*/React.createElement(DatePickerIOS, props);
|
|
12766
|
-
}
|
|
12767
|
-
return /*#__PURE__*/React.createElement(DatePickerAndroid, props);
|
|
12768
|
-
};
|
|
12769
|
-
|
|
12770
|
-
var AnimatedPressable$1 = Animated.createAnimatedComponent(Pressable);
|
|
12771
|
-
var StyledContainer$3 = index$a(View)(function (_ref) {
|
|
12772
|
-
var theme = _ref.theme,
|
|
12773
|
-
enableShadow = _ref.enableShadow;
|
|
12774
|
-
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
12775
|
-
shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
|
|
12776
|
-
shadowOffset: theme.__hd__.drawer.shadows.offset,
|
|
12777
|
-
shadowOpacity: theme.__hd__.drawer.shadows.opacity,
|
|
12778
|
-
shadowRadius: theme.__hd__.drawer.shadows.radius,
|
|
12779
|
-
overflow: 'hidden',
|
|
12780
|
-
zIndex: 9999,
|
|
12781
|
-
elevation: 9999
|
|
12782
|
-
});
|
|
12783
|
-
});
|
|
12784
|
-
var StyledDragableContainer = index$a(View)(function (_ref2) {
|
|
12785
|
-
var theme = _ref2.theme,
|
|
12786
|
-
enableShadow = _ref2.enableShadow;
|
|
12787
|
-
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
12788
|
-
shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
|
|
12789
|
-
shadowOffset: theme.__hd__.drawer.shadows.offset,
|
|
12790
|
-
shadowOpacity: theme.__hd__.drawer.shadows.opacity,
|
|
12791
|
-
shadowRadius: theme.__hd__.drawer.shadows.radius,
|
|
12792
|
-
overflow: 'hidden',
|
|
12793
|
-
zIndex: 9999,
|
|
12794
|
-
elevation: 9999,
|
|
12795
|
-
flexDirection: 'column-reverse'
|
|
12796
|
-
});
|
|
12797
|
-
});
|
|
12798
|
-
var StyledBackdrop$1 = index$a(AnimatedPressable$1)(function (_ref3) {
|
|
12799
|
-
var theme = _ref3.theme;
|
|
12800
|
-
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
12801
|
-
backgroundColor: theme.__hd__.drawer.colors.backdrop
|
|
12802
|
-
});
|
|
12803
|
-
});
|
|
12804
|
-
var StyledDrawerContainer = index$a(Animated.View)(function (_ref4) {
|
|
12805
|
-
var theme = _ref4.theme,
|
|
12806
|
-
enableShadow = _ref4.enableShadow;
|
|
12807
|
-
return {
|
|
12808
|
-
borderBottomLeftRadius: theme.__hd__.drawer.radii["default"],
|
|
12809
|
-
borderBottomRightRadius: theme.__hd__.drawer.radii["default"],
|
|
12810
|
-
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
12811
|
-
elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
|
|
12812
|
-
overflow: 'hidden'
|
|
12813
|
-
};
|
|
12814
|
-
});
|
|
12815
|
-
var StyledDragableDrawerContainer = index$a(Animated.View)(function (_ref5) {
|
|
12816
|
-
var theme = _ref5.theme,
|
|
12817
|
-
enableShadow = _ref5.enableShadow;
|
|
12818
|
-
return {
|
|
12819
|
-
borderTopLeftRadius: theme.__hd__.drawer.radii["default"],
|
|
12820
|
-
borderTopRightRadius: theme.__hd__.drawer.radii["default"],
|
|
12821
|
-
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
12822
|
-
elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
|
|
12823
|
-
overflow: 'hidden',
|
|
12824
|
-
maxHeight: '100%'
|
|
12825
|
-
};
|
|
12826
|
-
});
|
|
12827
|
-
var StyledHandlerContainer = index$a(View)(function (_ref6) {
|
|
12828
|
-
var theme = _ref6.theme;
|
|
12829
|
-
return {
|
|
12830
|
-
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
12831
|
-
paddingVertical: theme.__hd__.drawer.space.handlerPaddingVertical,
|
|
12832
|
-
alignItems: 'center'
|
|
12833
|
-
};
|
|
12834
|
-
});
|
|
12835
|
-
var StyledHandler = index$a(View)(function (_ref7) {
|
|
12836
|
-
var theme = _ref7.theme;
|
|
12837
|
-
return {
|
|
12838
|
-
width: theme.__hd__.drawer.sizes.handlerWidth,
|
|
12839
|
-
height: theme.__hd__.drawer.sizes.handlerHeight,
|
|
12840
|
-
backgroundColor: theme.__hd__.drawer.colors.handler,
|
|
12841
|
-
borderRadius: theme.__hd__.drawer.radii.handler
|
|
12842
|
-
};
|
|
12843
|
-
});
|
|
12844
|
-
|
|
12845
|
-
var getOffset = function getOffset(height, percentage) {
|
|
12846
|
-
if (percentage < 0) return height;
|
|
12847
|
-
if (percentage > 100) return 0;
|
|
12848
|
-
return height * ((100 - percentage) / 100);
|
|
12849
|
-
};
|
|
12850
|
-
var calculateSnapPointsData = function calculateSnapPointsData(minimumHeight, height, snapPoints) {
|
|
12851
|
-
var filteredSnapPoints = snapPoints.filter(function (value) {
|
|
12852
|
-
return value >= minimumHeight;
|
|
12853
|
-
});
|
|
12854
|
-
var snapPointsOffsetValues = [minimumHeight].concat(_toConsumableArray(filteredSnapPoints)).map(function (value) {
|
|
12855
|
-
return getOffset(height, value);
|
|
12856
|
-
});
|
|
12857
|
-
var uniqSnapPointOffsetValues = Array.from(new Set([].concat(_toConsumableArray(snapPointsOffsetValues), [0])));
|
|
12858
|
-
return {
|
|
12859
|
-
list: uniqSnapPointOffsetValues,
|
|
12860
|
-
minHeightOffset: Math.max.apply(Math, uniqSnapPointOffsetValues),
|
|
12861
|
-
maxHeightOffset: 0 // Max height
|
|
12862
|
-
};
|
|
12863
|
-
};
|
|
12864
|
-
|
|
12865
|
-
var calculateAnimatedToValue = function calculateAnimatedToValue(position, heightSnapPoints) {
|
|
12866
|
-
var distances = heightSnapPoints.map(function (height) {
|
|
12867
|
-
return Math.abs(position - height);
|
|
12868
|
-
});
|
|
12869
|
-
var minIndex = distances.indexOf(Math.min.apply(Math, _toConsumableArray(distances)));
|
|
12870
|
-
return heightSnapPoints[minIndex];
|
|
12871
|
-
};
|
|
12872
|
-
|
|
12873
|
-
var DragableDrawer = function DragableDrawer(_ref) {
|
|
12874
|
-
var children = _ref.children,
|
|
12875
|
-
initialHeightPercentage = _ref.initialHeightPercentage,
|
|
12876
|
-
_ref$minimumHeightPer = _ref.minimumHeightPercentage,
|
|
12877
|
-
minimumHeightPercentage = _ref$minimumHeightPer === void 0 ? 10 : _ref$minimumHeightPer,
|
|
12878
|
-
_ref$snapPoints = _ref.snapPoints,
|
|
12879
|
-
snapPoints = _ref$snapPoints === void 0 ? [] : _ref$snapPoints,
|
|
12880
|
-
onExpanded = _ref.onExpanded,
|
|
12881
|
-
onCollapsed = _ref.onCollapsed,
|
|
12882
|
-
testID = _ref.testID;
|
|
12883
|
-
var _useState = useState(0),
|
|
12884
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
12885
|
-
height = _useState2[0],
|
|
12886
|
-
setHeight = _useState2[1];
|
|
12887
|
-
var baseHeightForMeasure = useRef(0);
|
|
12888
|
-
var snapPointsData = useRef({
|
|
12889
|
-
list: [],
|
|
12890
|
-
minHeightOffset: 0,
|
|
12891
|
-
maxHeightOffset: 0
|
|
12892
|
-
});
|
|
12893
|
-
// Track drag
|
|
12894
|
-
var pan = useRef(new Animated.Value(0)).current;
|
|
12895
|
-
var offset = useRef(0);
|
|
12896
|
-
var offsetBeforePan = useRef(0);
|
|
12897
|
-
var _useState3 = useState(-1),
|
|
12898
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
12899
|
-
animatedToValue = _useState4[0],
|
|
12900
|
-
setAnimatedToValue = _useState4[1];
|
|
12901
|
-
useEffect(function () {
|
|
12902
|
-
var id = pan.addListener(function (_ref2) {
|
|
12903
|
-
var value = _ref2.value;
|
|
12904
|
-
offset.current = value;
|
|
12905
|
-
});
|
|
12906
|
-
return function () {
|
|
12907
|
-
return pan.removeListener(id);
|
|
12908
|
-
};
|
|
12909
|
-
}, []);
|
|
12910
|
-
useEffect(function () {
|
|
12911
|
-
if (height > 0) {
|
|
12912
|
-
var initialOffset = getOffset(height, initialHeightPercentage || minimumHeightPercentage);
|
|
12913
|
-
setAnimatedToValue(initialOffset);
|
|
12914
|
-
}
|
|
12915
|
-
}, [height]);
|
|
12916
|
-
useEffect(function () {
|
|
12917
|
-
if (height > 0) {
|
|
12918
|
-
pan.setValue(height);
|
|
12919
|
-
offset.current = height;
|
|
12920
|
-
baseHeightForMeasure.current = height;
|
|
12921
|
-
// Calculate snap points information
|
|
12922
|
-
snapPointsData.current = calculateSnapPointsData(minimumHeightPercentage, height, snapPoints);
|
|
12923
|
-
}
|
|
12924
|
-
}, [height, minimumHeightPercentage]);
|
|
12925
|
-
useEffect(function () {
|
|
12926
|
-
if (animatedToValue >= 0) {
|
|
12927
|
-
var animation = Animated.timing(pan, {
|
|
12928
|
-
toValue: animatedToValue,
|
|
12929
|
-
useNativeDriver: true,
|
|
12930
|
-
easing: Easing.inOut(Easing.cubic)
|
|
12931
|
-
});
|
|
12932
|
-
animation.start(function () {
|
|
12933
|
-
if (animatedToValue === 0) {
|
|
12934
|
-
onExpanded === null || onExpanded === void 0 ? void 0 : onExpanded();
|
|
12935
|
-
} else if (animatedToValue === getOffset(height, minimumHeightPercentage)) {
|
|
12936
|
-
onCollapsed === null || onCollapsed === void 0 ? void 0 : onCollapsed();
|
|
12937
|
-
}
|
|
12938
|
-
setAnimatedToValue(-1);
|
|
12939
|
-
});
|
|
12940
|
-
return function () {
|
|
12941
|
-
return animation.stop();
|
|
12942
|
-
};
|
|
12943
|
-
}
|
|
12944
|
-
}, [animatedToValue]);
|
|
12945
|
-
var panResponder = useRef(PanResponder.create({
|
|
12946
|
-
onMoveShouldSetPanResponder: function onMoveShouldSetPanResponder() {
|
|
12947
|
-
return true;
|
|
12948
|
-
},
|
|
12949
|
-
onPanResponderGrant: function onPanResponderGrant() {
|
|
12950
|
-
offsetBeforePan.current = offset.current;
|
|
12951
|
-
pan.setOffset(offset.current);
|
|
12952
|
-
pan.setValue(0);
|
|
12953
|
-
},
|
|
12954
|
-
onPanResponderMove: function onPanResponderMove(_, gesture) {
|
|
12955
|
-
var _snapPointsData$curre;
|
|
12956
|
-
var panDistance = gesture.dy;
|
|
12957
|
-
// Moving toward top, stop at highest snap point
|
|
12958
|
-
if (offsetBeforePan.current + panDistance < 0) {
|
|
12959
|
-
pan.setValue(-offsetBeforePan.current);
|
|
12960
|
-
return;
|
|
13063
|
+
onRequestClose: function onRequestClose() {
|
|
13064
|
+
return setOpen(false);
|
|
13065
|
+
},
|
|
13066
|
+
header: label,
|
|
13067
|
+
footer: /*#__PURE__*/React.createElement(CompoundButton, {
|
|
13068
|
+
variant: "text",
|
|
13069
|
+
text: confirmLabel,
|
|
13070
|
+
onPress: function onPress() {
|
|
13071
|
+
if (selectingDate) {
|
|
13072
|
+
onChange(selectingDate);
|
|
13073
|
+
}
|
|
13074
|
+
setOpen(false);
|
|
12961
13075
|
}
|
|
12962
|
-
|
|
12963
|
-
|
|
12964
|
-
|
|
12965
|
-
|
|
13076
|
+
})
|
|
13077
|
+
}, /*#__PURE__*/React.createElement(StyledPickerWrapper$1, null, /*#__PURE__*/React.createElement(DateTimePicker, {
|
|
13078
|
+
testID: "datePickerIOS",
|
|
13079
|
+
value: selectingDate,
|
|
13080
|
+
minimumDate: minDate,
|
|
13081
|
+
maximumDate: maxDate,
|
|
13082
|
+
mode: "date",
|
|
13083
|
+
onChange: function onChange(_, date) {
|
|
13084
|
+
if (date) {
|
|
13085
|
+
setSelectingDate(date);
|
|
12966
13086
|
}
|
|
12967
|
-
pan.setValue(panDistance);
|
|
12968
13087
|
},
|
|
12969
|
-
|
|
12970
|
-
pan.flattenOffset();
|
|
12971
|
-
// Attach to nearest snappoint
|
|
12972
|
-
var panDistance = gesture.dy;
|
|
12973
|
-
var offsetAfterPan = offsetBeforePan.current + panDistance;
|
|
12974
|
-
var animatedValue = calculateAnimatedToValue(offsetAfterPan, snapPointsData.current.list);
|
|
12975
|
-
setAnimatedToValue(animatedValue);
|
|
12976
|
-
}
|
|
12977
|
-
})).current;
|
|
12978
|
-
return /*#__PURE__*/React.createElement(StyledDragableContainer, {
|
|
12979
|
-
testID: testID,
|
|
12980
|
-
enableShadow: true,
|
|
12981
|
-
pointerEvents: "box-none"
|
|
12982
|
-
}, /*#__PURE__*/React.createElement(StyledDragableDrawerContainer, {
|
|
12983
|
-
enableShadow: true,
|
|
13088
|
+
display: "spinner",
|
|
12984
13089
|
style: {
|
|
12985
|
-
|
|
12986
|
-
scaleY: baseHeightForMeasure.current > 0 ? 1 : 0
|
|
12987
|
-
}, {
|
|
12988
|
-
translateY: pan
|
|
12989
|
-
}]
|
|
13090
|
+
flex: 1
|
|
12990
13091
|
},
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
setHeight(nativeEvent.layout.height);
|
|
12994
|
-
}
|
|
12995
|
-
}, /*#__PURE__*/React.createElement(StyledHandlerContainer, panResponder.panHandlers, /*#__PURE__*/React.createElement(StyledHandler, null)), children));
|
|
13092
|
+
textColor: theme.colors.onDefaultGlobalSurface
|
|
13093
|
+
}))));
|
|
12996
13094
|
};
|
|
12997
13095
|
|
|
12998
|
-
var
|
|
12999
|
-
|
|
13000
|
-
|
|
13001
|
-
_ref$
|
|
13002
|
-
|
|
13003
|
-
|
|
13004
|
-
|
|
13005
|
-
|
|
13006
|
-
|
|
13007
|
-
|
|
13008
|
-
|
|
13009
|
-
|
|
13010
|
-
var enableShadow = visible && !hasBackdrop;
|
|
13011
|
-
var interpolateTranslateY = animatedValue.interpolate({
|
|
13012
|
-
inputRange: [0, 1],
|
|
13013
|
-
outputRange: [-height, 0]
|
|
13014
|
-
});
|
|
13015
|
-
var interpolateBackdropOpacity = hasBackdrop ? animatedValue.interpolate({
|
|
13016
|
-
inputRange: [0, 1],
|
|
13017
|
-
outputRange: [0, 0.35]
|
|
13018
|
-
}) : 0;
|
|
13019
|
-
useEffect(function () {
|
|
13020
|
-
var animation = Animated.timing(animatedValue, {
|
|
13021
|
-
toValue: visible ? 1 : 0,
|
|
13022
|
-
easing: Easing.inOut(Easing.cubic),
|
|
13023
|
-
useNativeDriver: true
|
|
13024
|
-
});
|
|
13025
|
-
animation.start();
|
|
13026
|
-
return function () {
|
|
13027
|
-
return animation.stop();
|
|
13028
|
-
};
|
|
13029
|
-
}, [visible]);
|
|
13030
|
-
return /*#__PURE__*/React.createElement(StyledContainer$3, {
|
|
13031
|
-
testID: testID,
|
|
13032
|
-
enableShadow: enableShadow,
|
|
13033
|
-
pointerEvents: "box-none"
|
|
13034
|
-
}, /*#__PURE__*/React.createElement(StyledBackdrop$1, {
|
|
13035
|
-
pointerEvents: visible ? 'auto' : 'box-none',
|
|
13036
|
-
onPress: onDismiss,
|
|
13037
|
-
style: {
|
|
13038
|
-
opacity: interpolateBackdropOpacity
|
|
13039
|
-
}
|
|
13040
|
-
}), /*#__PURE__*/React.createElement(StyledDrawerContainer, {
|
|
13041
|
-
enableShadow: enableShadow,
|
|
13042
|
-
onLayout: function onLayout(_ref2) {
|
|
13043
|
-
var nativeEvent = _ref2.nativeEvent;
|
|
13044
|
-
return setHeight(nativeEvent.layout.height);
|
|
13045
|
-
},
|
|
13046
|
-
style: {
|
|
13047
|
-
transform: [{
|
|
13048
|
-
translateY: interpolateTranslateY
|
|
13049
|
-
}]
|
|
13050
|
-
}
|
|
13051
|
-
}, children));
|
|
13096
|
+
var _excluded$e = ["variant"];
|
|
13097
|
+
var DatePicker = function DatePicker(_ref) {
|
|
13098
|
+
var _ref$variant = _ref.variant,
|
|
13099
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
13100
|
+
props = _objectWithoutProperties(_ref, _excluded$e);
|
|
13101
|
+
if (variant === 'calendar') {
|
|
13102
|
+
return /*#__PURE__*/React.createElement(DatePickerCalendar, props);
|
|
13103
|
+
}
|
|
13104
|
+
if (Platform.OS === 'ios') {
|
|
13105
|
+
return /*#__PURE__*/React.createElement(DatePickerIOS, props);
|
|
13106
|
+
}
|
|
13107
|
+
return /*#__PURE__*/React.createElement(DatePickerAndroid, props);
|
|
13052
13108
|
};
|
|
13053
|
-
var index$7 = Object.assign(Drawer, {
|
|
13054
|
-
Dragable: DragableDrawer
|
|
13055
|
-
});
|
|
13056
13109
|
|
|
13057
|
-
var
|
|
13058
|
-
|
|
13059
|
-
|
|
13060
|
-
|
|
13061
|
-
|
|
13062
|
-
|
|
13063
|
-
|
|
13064
|
-
|
|
13065
|
-
|
|
13066
|
-
|
|
13110
|
+
var AnimatedPressable$1 = Animated.createAnimatedComponent(Pressable);
|
|
13111
|
+
var StyledContainer$3 = index$a(View)(function (_ref) {
|
|
13112
|
+
var theme = _ref.theme,
|
|
13113
|
+
enableShadow = _ref.enableShadow;
|
|
13114
|
+
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
13115
|
+
shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
|
|
13116
|
+
shadowOffset: theme.__hd__.drawer.shadows.offset,
|
|
13117
|
+
shadowOpacity: theme.__hd__.drawer.shadows.opacity,
|
|
13118
|
+
shadowRadius: theme.__hd__.drawer.shadows.radius,
|
|
13119
|
+
overflow: 'hidden',
|
|
13120
|
+
zIndex: 9999,
|
|
13121
|
+
elevation: 9999
|
|
13122
|
+
});
|
|
13067
13123
|
});
|
|
13068
|
-
var
|
|
13124
|
+
var StyledDragableContainer = index$a(View)(function (_ref2) {
|
|
13069
13125
|
var theme = _ref2.theme,
|
|
13070
|
-
|
|
13126
|
+
enableShadow = _ref2.enableShadow;
|
|
13127
|
+
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
13128
|
+
shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
|
|
13129
|
+
shadowOffset: theme.__hd__.drawer.shadows.offset,
|
|
13130
|
+
shadowOpacity: theme.__hd__.drawer.shadows.opacity,
|
|
13131
|
+
shadowRadius: theme.__hd__.drawer.shadows.radius,
|
|
13132
|
+
overflow: 'hidden',
|
|
13133
|
+
zIndex: 9999,
|
|
13134
|
+
elevation: 9999,
|
|
13135
|
+
flexDirection: 'column-reverse'
|
|
13136
|
+
});
|
|
13137
|
+
});
|
|
13138
|
+
var StyledBackdrop$1 = index$a(AnimatedPressable$1)(function (_ref3) {
|
|
13139
|
+
var theme = _ref3.theme;
|
|
13140
|
+
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
13141
|
+
backgroundColor: theme.__hd__.drawer.colors.backdrop
|
|
13142
|
+
});
|
|
13143
|
+
});
|
|
13144
|
+
var StyledDrawerContainer = index$a(Animated.View)(function (_ref4) {
|
|
13145
|
+
var theme = _ref4.theme,
|
|
13146
|
+
enableShadow = _ref4.enableShadow;
|
|
13071
13147
|
return {
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
13148
|
+
borderBottomLeftRadius: theme.__hd__.drawer.radii["default"],
|
|
13149
|
+
borderBottomRightRadius: theme.__hd__.drawer.radii["default"],
|
|
13150
|
+
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
13151
|
+
elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
|
|
13152
|
+
overflow: 'hidden'
|
|
13075
13153
|
};
|
|
13076
13154
|
});
|
|
13077
|
-
var
|
|
13078
|
-
var theme =
|
|
13079
|
-
|
|
13155
|
+
var StyledDragableDrawerContainer = index$a(Animated.View)(function (_ref5) {
|
|
13156
|
+
var theme = _ref5.theme,
|
|
13157
|
+
enableShadow = _ref5.enableShadow;
|
|
13080
13158
|
return {
|
|
13081
|
-
|
|
13082
|
-
|
|
13159
|
+
borderTopLeftRadius: theme.__hd__.drawer.radii["default"],
|
|
13160
|
+
borderTopRightRadius: theme.__hd__.drawer.radii["default"],
|
|
13161
|
+
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
13162
|
+
elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
|
|
13163
|
+
overflow: 'hidden',
|
|
13164
|
+
maxHeight: '100%'
|
|
13083
13165
|
};
|
|
13084
13166
|
});
|
|
13085
|
-
|
|
13086
|
-
var
|
|
13087
|
-
|
|
13088
|
-
|
|
13089
|
-
|
|
13090
|
-
|
|
13091
|
-
testID = _ref.testID,
|
|
13092
|
-
_ref$variant = _ref.variant,
|
|
13093
|
-
variant = _ref$variant === void 0 ? 'light' : _ref$variant;
|
|
13094
|
-
var theme = useTheme();
|
|
13095
|
-
return /*#__PURE__*/React.createElement(StyledWrapper$6, {
|
|
13096
|
-
style: style,
|
|
13097
|
-
testID: testID
|
|
13098
|
-
}, image !== undefined && /*#__PURE__*/React.cloneElement(image, _objectSpread2(_objectSpread2({}, image.props), {}, {
|
|
13099
|
-
style: [{
|
|
13100
|
-
marginBottom: theme.__hd__.empty.space.imageMargin
|
|
13101
|
-
}, image.props.style]
|
|
13102
|
-
})), /*#__PURE__*/React.createElement(StyledTitle, {
|
|
13103
|
-
themeVariant: variant,
|
|
13104
|
-
level: "h4",
|
|
13105
|
-
typeface: "playful"
|
|
13106
|
-
}, title), !!description && /*#__PURE__*/React.createElement(StyledDescription, {
|
|
13107
|
-
themeVariant: variant,
|
|
13108
|
-
typeface: "playful"
|
|
13109
|
-
}, description));
|
|
13110
|
-
};
|
|
13111
|
-
|
|
13112
|
-
var customAlphabet = function customAlphabet(alphabet) {
|
|
13113
|
-
var defaultSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 21;
|
|
13114
|
-
return function () {
|
|
13115
|
-
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSize;
|
|
13116
|
-
var id = '';
|
|
13117
|
-
var i = size;
|
|
13118
|
-
while (i--) {
|
|
13119
|
-
id += alphabet[Math.random() * alphabet.length | 0];
|
|
13120
|
-
}
|
|
13121
|
-
return id;
|
|
13167
|
+
var StyledHandlerContainer = index$a(View)(function (_ref6) {
|
|
13168
|
+
var theme = _ref6.theme;
|
|
13169
|
+
return {
|
|
13170
|
+
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
13171
|
+
paddingVertical: theme.__hd__.drawer.space.handlerPaddingVertical,
|
|
13172
|
+
alignItems: 'center'
|
|
13122
13173
|
};
|
|
13123
|
-
};
|
|
13124
|
-
|
|
13125
|
-
var
|
|
13126
|
-
|
|
13127
|
-
|
|
13128
|
-
|
|
13129
|
-
|
|
13130
|
-
|
|
13131
|
-
}
|
|
13132
|
-
|
|
13133
|
-
|
|
13134
|
-
var PortalStateContext = /*#__PURE__*/createContext(null);
|
|
13135
|
-
var PortalDispatchContext = /*#__PURE__*/createContext(null);
|
|
13174
|
+
});
|
|
13175
|
+
var StyledHandler = index$a(View)(function (_ref7) {
|
|
13176
|
+
var theme = _ref7.theme;
|
|
13177
|
+
return {
|
|
13178
|
+
width: theme.__hd__.drawer.sizes.handlerWidth,
|
|
13179
|
+
height: theme.__hd__.drawer.sizes.handlerHeight,
|
|
13180
|
+
backgroundColor: theme.__hd__.drawer.colors.handler,
|
|
13181
|
+
borderRadius: theme.__hd__.drawer.radii.handler
|
|
13182
|
+
};
|
|
13183
|
+
});
|
|
13136
13184
|
|
|
13137
|
-
var
|
|
13138
|
-
|
|
13139
|
-
|
|
13140
|
-
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
var
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
}
|
|
13149
|
-
var
|
|
13150
|
-
dispatch({
|
|
13151
|
-
type: ACTIONS.DEREGISTER_HOST,
|
|
13152
|
-
hostName: hostName
|
|
13153
|
-
});
|
|
13154
|
-
}, []);
|
|
13155
|
-
var addUpdatePortal = useCallback(function (name, node) {
|
|
13156
|
-
dispatch({
|
|
13157
|
-
type: ACTIONS.ADD_UPDATE_PORTAL,
|
|
13158
|
-
hostName: hostName,
|
|
13159
|
-
portalName: name,
|
|
13160
|
-
node: node
|
|
13161
|
-
});
|
|
13162
|
-
}, []);
|
|
13163
|
-
var removePortal = useCallback(function (name) {
|
|
13164
|
-
dispatch({
|
|
13165
|
-
type: ACTIONS.REMOVE_PORTAL,
|
|
13166
|
-
hostName: hostName,
|
|
13167
|
-
portalName: name
|
|
13168
|
-
});
|
|
13169
|
-
}, []);
|
|
13185
|
+
var getOffset = function getOffset(height, percentage) {
|
|
13186
|
+
if (percentage < 0) return height;
|
|
13187
|
+
if (percentage > 100) return 0;
|
|
13188
|
+
return height * ((100 - percentage) / 100);
|
|
13189
|
+
};
|
|
13190
|
+
var calculateSnapPointsData = function calculateSnapPointsData(minimumHeight, height, snapPoints) {
|
|
13191
|
+
var filteredSnapPoints = snapPoints.filter(function (value) {
|
|
13192
|
+
return value >= minimumHeight;
|
|
13193
|
+
});
|
|
13194
|
+
var snapPointsOffsetValues = [minimumHeight].concat(_toConsumableArray(filteredSnapPoints)).map(function (value) {
|
|
13195
|
+
return getOffset(height, value);
|
|
13196
|
+
});
|
|
13197
|
+
var uniqSnapPointOffsetValues = Array.from(new Set([].concat(_toConsumableArray(snapPointsOffsetValues), [0])));
|
|
13170
13198
|
return {
|
|
13171
|
-
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
updatePortal: addUpdatePortal,
|
|
13175
|
-
removePortal: removePortal
|
|
13199
|
+
list: uniqSnapPointOffsetValues,
|
|
13200
|
+
minHeightOffset: Math.max.apply(Math, uniqSnapPointOffsetValues),
|
|
13201
|
+
maxHeightOffset: 0 // Max height
|
|
13176
13202
|
};
|
|
13177
13203
|
};
|
|
13178
13204
|
|
|
13179
|
-
var
|
|
13180
|
-
var
|
|
13181
|
-
|
|
13182
|
-
|
|
13183
|
-
|
|
13184
|
-
return
|
|
13205
|
+
var calculateAnimatedToValue = function calculateAnimatedToValue(position, heightSnapPoints) {
|
|
13206
|
+
var distances = heightSnapPoints.map(function (height) {
|
|
13207
|
+
return Math.abs(position - height);
|
|
13208
|
+
});
|
|
13209
|
+
var minIndex = distances.indexOf(Math.min.apply(Math, _toConsumableArray(distances)));
|
|
13210
|
+
return heightSnapPoints[minIndex];
|
|
13185
13211
|
};
|
|
13186
13212
|
|
|
13187
|
-
var
|
|
13188
|
-
var
|
|
13189
|
-
|
|
13190
|
-
|
|
13191
|
-
|
|
13192
|
-
|
|
13213
|
+
var DragableDrawer = function DragableDrawer(_ref) {
|
|
13214
|
+
var children = _ref.children,
|
|
13215
|
+
initialHeightPercentage = _ref.initialHeightPercentage,
|
|
13216
|
+
_ref$minimumHeightPer = _ref.minimumHeightPercentage,
|
|
13217
|
+
minimumHeightPercentage = _ref$minimumHeightPer === void 0 ? 10 : _ref$minimumHeightPer,
|
|
13218
|
+
_ref$snapPoints = _ref.snapPoints,
|
|
13219
|
+
snapPoints = _ref$snapPoints === void 0 ? [] : _ref$snapPoints,
|
|
13220
|
+
onExpanded = _ref.onExpanded,
|
|
13221
|
+
onCollapsed = _ref.onCollapsed,
|
|
13222
|
+
testID = _ref.testID;
|
|
13223
|
+
var _useState = useState(0),
|
|
13224
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13225
|
+
height = _useState2[0],
|
|
13226
|
+
setHeight = _useState2[1];
|
|
13227
|
+
var baseHeightForMeasure = useRef(0);
|
|
13228
|
+
var snapPointsData = useRef({
|
|
13229
|
+
list: [],
|
|
13230
|
+
minHeightOffset: 0,
|
|
13231
|
+
maxHeightOffset: 0
|
|
13232
|
+
});
|
|
13233
|
+
// Track drag
|
|
13234
|
+
var pan = useRef(new Animated.Value(0)).current;
|
|
13235
|
+
var offset = useRef(0);
|
|
13236
|
+
var offsetBeforePan = useRef(0);
|
|
13237
|
+
var _useState3 = useState(-1),
|
|
13238
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
13239
|
+
animatedToValue = _useState4[0],
|
|
13240
|
+
setAnimatedToValue = _useState4[1];
|
|
13193
13241
|
useEffect(function () {
|
|
13194
|
-
|
|
13242
|
+
var id = pan.addListener(function (_ref2) {
|
|
13243
|
+
var value = _ref2.value;
|
|
13244
|
+
offset.current = value;
|
|
13245
|
+
});
|
|
13195
13246
|
return function () {
|
|
13196
|
-
|
|
13247
|
+
return pan.removeListener(id);
|
|
13197
13248
|
};
|
|
13198
13249
|
}, []);
|
|
13199
|
-
|
|
13200
|
-
|
|
13201
|
-
|
|
13202
|
-
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
|
|
13211
|
-
|
|
13212
|
-
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
|
|
13250
|
+
useEffect(function () {
|
|
13251
|
+
if (height > 0) {
|
|
13252
|
+
var initialOffset = getOffset(height, initialHeightPercentage || minimumHeightPercentage);
|
|
13253
|
+
setAnimatedToValue(initialOffset);
|
|
13254
|
+
}
|
|
13255
|
+
}, [height]);
|
|
13256
|
+
useEffect(function () {
|
|
13257
|
+
if (height > 0) {
|
|
13258
|
+
pan.setValue(height);
|
|
13259
|
+
offset.current = height;
|
|
13260
|
+
baseHeightForMeasure.current = height;
|
|
13261
|
+
// Calculate snap points information
|
|
13262
|
+
snapPointsData.current = calculateSnapPointsData(minimumHeightPercentage, height, snapPoints);
|
|
13263
|
+
}
|
|
13264
|
+
}, [height, minimumHeightPercentage]);
|
|
13265
|
+
useEffect(function () {
|
|
13266
|
+
if (animatedToValue >= 0) {
|
|
13267
|
+
var animation = Animated.timing(pan, {
|
|
13268
|
+
toValue: animatedToValue,
|
|
13269
|
+
useNativeDriver: true,
|
|
13270
|
+
easing: Easing.inOut(Easing.cubic)
|
|
13271
|
+
});
|
|
13272
|
+
animation.start(function () {
|
|
13273
|
+
if (animatedToValue === 0) {
|
|
13274
|
+
onExpanded === null || onExpanded === void 0 ? void 0 : onExpanded();
|
|
13275
|
+
} else if (animatedToValue === getOffset(height, minimumHeightPercentage)) {
|
|
13276
|
+
onCollapsed === null || onCollapsed === void 0 ? void 0 : onCollapsed();
|
|
13277
|
+
}
|
|
13278
|
+
setAnimatedToValue(-1);
|
|
13279
|
+
});
|
|
13280
|
+
return function () {
|
|
13281
|
+
return animation.stop();
|
|
13282
|
+
};
|
|
13283
|
+
}
|
|
13284
|
+
}, [animatedToValue]);
|
|
13285
|
+
var panResponder = useRef(PanResponder.create({
|
|
13286
|
+
onMoveShouldSetPanResponder: function onMoveShouldSetPanResponder() {
|
|
13287
|
+
return true;
|
|
13288
|
+
},
|
|
13289
|
+
onPanResponderGrant: function onPanResponderGrant() {
|
|
13290
|
+
offsetBeforePan.current = offset.current;
|
|
13291
|
+
pan.setOffset(offset.current);
|
|
13292
|
+
pan.setValue(0);
|
|
13293
|
+
},
|
|
13294
|
+
onPanResponderMove: function onPanResponderMove(_, gesture) {
|
|
13295
|
+
var _snapPointsData$curre;
|
|
13296
|
+
var panDistance = gesture.dy;
|
|
13297
|
+
// Moving toward top, stop at highest snap point
|
|
13298
|
+
if (offsetBeforePan.current + panDistance < 0) {
|
|
13299
|
+
pan.setValue(-offsetBeforePan.current);
|
|
13300
|
+
return;
|
|
13226
13301
|
}
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
13240
|
-
|
|
13241
|
-
|
|
13242
|
-
};
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
rootHostName = _ref$rootHostName === void 0 ? 'root' : _ref$rootHostName,
|
|
13262
|
-
children = _ref.children;
|
|
13263
|
-
var _useReducer = useReducer(reducer, INITIAL_STATE),
|
|
13264
|
-
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
13265
|
-
state = _useReducer2[0],
|
|
13266
|
-
dispatch = _useReducer2[1];
|
|
13267
|
-
return /*#__PURE__*/React.createElement(PortalDispatchContext.Provider, {
|
|
13268
|
-
value: dispatch
|
|
13269
|
-
}, /*#__PURE__*/React.createElement(PortalStateContext.Provider, {
|
|
13270
|
-
value: state
|
|
13271
|
-
}, children, /*#__PURE__*/React.createElement(PortalHost, {
|
|
13272
|
-
name: rootHostName
|
|
13273
|
-
})));
|
|
13302
|
+
// Moving toward bottom, stop at lowest snap point
|
|
13303
|
+
if (offsetBeforePan.current + panDistance > ((_snapPointsData$curre = snapPointsData.current) === null || _snapPointsData$curre === void 0 ? void 0 : _snapPointsData$curre.minHeightOffset)) {
|
|
13304
|
+
pan.setValue(baseHeightForMeasure.current - baseHeightForMeasure.current * (minimumHeightPercentage / 100) - offsetBeforePan.current);
|
|
13305
|
+
return;
|
|
13306
|
+
}
|
|
13307
|
+
pan.setValue(panDistance);
|
|
13308
|
+
},
|
|
13309
|
+
onPanResponderRelease: function onPanResponderRelease(_, gesture) {
|
|
13310
|
+
pan.flattenOffset();
|
|
13311
|
+
// Attach to nearest snappoint
|
|
13312
|
+
var panDistance = gesture.dy;
|
|
13313
|
+
var offsetAfterPan = offsetBeforePan.current + panDistance;
|
|
13314
|
+
var animatedValue = calculateAnimatedToValue(offsetAfterPan, snapPointsData.current.list);
|
|
13315
|
+
setAnimatedToValue(animatedValue);
|
|
13316
|
+
}
|
|
13317
|
+
})).current;
|
|
13318
|
+
return /*#__PURE__*/React.createElement(StyledDragableContainer, {
|
|
13319
|
+
testID: testID,
|
|
13320
|
+
enableShadow: true,
|
|
13321
|
+
pointerEvents: "box-none"
|
|
13322
|
+
}, /*#__PURE__*/React.createElement(StyledDragableDrawerContainer, {
|
|
13323
|
+
enableShadow: true,
|
|
13324
|
+
style: {
|
|
13325
|
+
transform: [{
|
|
13326
|
+
scaleY: baseHeightForMeasure.current > 0 ? 1 : 0
|
|
13327
|
+
}, {
|
|
13328
|
+
translateY: pan
|
|
13329
|
+
}]
|
|
13330
|
+
},
|
|
13331
|
+
onLayout: function onLayout(_ref3) {
|
|
13332
|
+
var nativeEvent = _ref3.nativeEvent;
|
|
13333
|
+
setHeight(nativeEvent.layout.height);
|
|
13334
|
+
}
|
|
13335
|
+
}, /*#__PURE__*/React.createElement(StyledHandlerContainer, panResponder.panHandlers, /*#__PURE__*/React.createElement(StyledHandler, null)), children));
|
|
13274
13336
|
};
|
|
13275
|
-
var PortalProvider = /*#__PURE__*/memo(PortalProviderComponent);
|
|
13276
|
-
PortalProvider.displayName = 'PortalProvider';
|
|
13277
13337
|
|
|
13278
|
-
var
|
|
13279
|
-
var
|
|
13280
|
-
var name = _ref.name,
|
|
13281
|
-
hostName = _ref.hostName,
|
|
13338
|
+
var Drawer = function Drawer(_ref) {
|
|
13339
|
+
var visible = _ref.visible,
|
|
13282
13340
|
children = _ref.children,
|
|
13283
|
-
|
|
13284
|
-
|
|
13285
|
-
|
|
13286
|
-
|
|
13287
|
-
|
|
13288
|
-
var
|
|
13289
|
-
|
|
13290
|
-
|
|
13291
|
-
|
|
13292
|
-
|
|
13293
|
-
|
|
13294
|
-
}, children);
|
|
13295
|
-
}, [theme, children, defaultTheme]);
|
|
13296
|
-
useLayoutEffect(function () {
|
|
13297
|
-
addUpdatePortal(nameOrRandom, ChildrenComponent);
|
|
13298
|
-
return function () {
|
|
13299
|
-
removePortal(nameOrRandom);
|
|
13300
|
-
};
|
|
13301
|
-
}, [addUpdatePortal]);
|
|
13302
|
-
useLayoutEffect(function () {
|
|
13303
|
-
addUpdatePortal(nameOrRandom, ChildrenComponent);
|
|
13304
|
-
}, [ChildrenComponent]);
|
|
13305
|
-
return null;
|
|
13306
|
-
};
|
|
13307
|
-
var Portal = /*#__PURE__*/memo(PortalComponent);
|
|
13308
|
-
Portal.displayName = 'Portal';
|
|
13309
|
-
var Portal$1 = Object.assign(Portal, {
|
|
13310
|
-
Provider: PortalProvider,
|
|
13311
|
-
Host: PortalHost
|
|
13312
|
-
});
|
|
13313
|
-
|
|
13314
|
-
var _excluded$e = ["visible"];
|
|
13315
|
-
var DEFAULT_BACKDROP_OPACITY = 0.4;
|
|
13316
|
-
var DEFAULT_ANIMATION_CONFIG = {
|
|
13317
|
-
easing: Easing.inOut(Easing.cubic),
|
|
13318
|
-
useNativeDriver: Platform.OS !== 'web',
|
|
13319
|
-
duration: 400
|
|
13320
|
-
};
|
|
13321
|
-
var Modal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
13322
|
-
var children = _ref.children,
|
|
13323
|
-
onShow = _ref.onShow,
|
|
13324
|
-
onRequestClose = _ref.onRequestClose,
|
|
13325
|
-
testID = _ref.testID,
|
|
13326
|
-
_ref$animationType = _ref.animationType,
|
|
13327
|
-
animationType = _ref$animationType === void 0 ? 'none' : _ref$animationType,
|
|
13328
|
-
_ref$transparent = _ref.transparent,
|
|
13329
|
-
transparent = _ref$transparent === void 0 ? false : _ref$transparent,
|
|
13330
|
-
onDismiss = _ref.onDismiss;
|
|
13331
|
-
var theme = useTheme();
|
|
13332
|
-
var animatedBackdropValue = useRef(new Animated.Value(0)).current;
|
|
13333
|
-
var animatedModalValue = useRef(new Animated.Value(0)).current;
|
|
13334
|
-
// Show or hide the backdrop and modal content
|
|
13335
|
-
var animateBackdropAndContent = useCallback(function (_ref2) {
|
|
13336
|
-
var toValue = _ref2.toValue,
|
|
13337
|
-
callback = _ref2.callback;
|
|
13338
|
-
if (animationType !== 'none') {
|
|
13339
|
-
// Backdrop animation
|
|
13340
|
-
if (!transparent) {
|
|
13341
|
-
Animated.timing(animatedBackdropValue, _objectSpread2({
|
|
13342
|
-
toValue: toValue
|
|
13343
|
-
}, DEFAULT_ANIMATION_CONFIG)).start();
|
|
13344
|
-
}
|
|
13345
|
-
// Modal content animation
|
|
13346
|
-
Animated.timing(animatedModalValue, _objectSpread2({
|
|
13347
|
-
toValue: toValue
|
|
13348
|
-
}, DEFAULT_ANIMATION_CONFIG)).start(callback);
|
|
13349
|
-
} else {
|
|
13350
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
13351
|
-
}
|
|
13352
|
-
}, [animationType, onShow, transparent]);
|
|
13353
|
-
var backdropOpacityAnimation = animatedBackdropValue.interpolate({
|
|
13341
|
+
_ref$hasBackdrop = _ref.hasBackdrop,
|
|
13342
|
+
hasBackdrop = _ref$hasBackdrop === void 0 ? true : _ref$hasBackdrop,
|
|
13343
|
+
onDismiss = _ref.onDismiss,
|
|
13344
|
+
testID = _ref.testID;
|
|
13345
|
+
var animatedValue = useRef(new Animated.Value(visible ? 1 : 0)).current;
|
|
13346
|
+
var _useState = useState(Dimensions.get('window').height),
|
|
13347
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
13348
|
+
height = _useState2[0],
|
|
13349
|
+
setHeight = _useState2[1];
|
|
13350
|
+
var enableShadow = visible && !hasBackdrop;
|
|
13351
|
+
var interpolateTranslateY = animatedValue.interpolate({
|
|
13354
13352
|
inputRange: [0, 1],
|
|
13355
|
-
outputRange: [
|
|
13353
|
+
outputRange: [-height, 0]
|
|
13356
13354
|
});
|
|
13357
|
-
var
|
|
13355
|
+
var interpolateBackdropOpacity = hasBackdrop ? animatedValue.interpolate({
|
|
13358
13356
|
inputRange: [0, 1],
|
|
13359
|
-
outputRange:
|
|
13360
|
-
});
|
|
13361
|
-
useImperativeHandle(ref, function () {
|
|
13362
|
-
return {
|
|
13363
|
-
show: function show() {
|
|
13364
|
-
animateBackdropAndContent({
|
|
13365
|
-
toValue: 1,
|
|
13366
|
-
callback: onShow
|
|
13367
|
-
});
|
|
13368
|
-
},
|
|
13369
|
-
hide: function hide(wrapperCallback) {
|
|
13370
|
-
animateBackdropAndContent({
|
|
13371
|
-
toValue: 0,
|
|
13372
|
-
callback: function callback() {
|
|
13373
|
-
if (Platform.OS === 'ios') {
|
|
13374
|
-
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
13375
|
-
}
|
|
13376
|
-
wrapperCallback();
|
|
13377
|
-
}
|
|
13378
|
-
});
|
|
13379
|
-
}
|
|
13380
|
-
};
|
|
13381
|
-
}, [onDismiss, onShow, animateBackdropAndContent]);
|
|
13382
|
-
// Back button handler
|
|
13357
|
+
outputRange: [0, 0.35]
|
|
13358
|
+
}) : 0;
|
|
13383
13359
|
useEffect(function () {
|
|
13384
|
-
var
|
|
13385
|
-
|
|
13386
|
-
|
|
13360
|
+
var animation = Animated.timing(animatedValue, {
|
|
13361
|
+
toValue: visible ? 1 : 0,
|
|
13362
|
+
easing: Easing.inOut(Easing.cubic),
|
|
13363
|
+
useNativeDriver: true
|
|
13387
13364
|
});
|
|
13365
|
+
animation.start();
|
|
13388
13366
|
return function () {
|
|
13389
|
-
return
|
|
13367
|
+
return animation.stop();
|
|
13390
13368
|
};
|
|
13391
|
-
}, [
|
|
13392
|
-
return /*#__PURE__*/React.createElement(
|
|
13393
|
-
style: _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
13394
|
-
backgroundColor: transparent ? 'transparent' : theme.colors.overlayGlobalSurface,
|
|
13395
|
-
opacity: animationType !== 'none' ? backdropOpacityAnimation : DEFAULT_BACKDROP_OPACITY
|
|
13396
|
-
})
|
|
13397
|
-
}), /*#__PURE__*/React.createElement(Animated.View, {
|
|
13369
|
+
}, [visible]);
|
|
13370
|
+
return /*#__PURE__*/React.createElement(StyledContainer$3, {
|
|
13398
13371
|
testID: testID,
|
|
13399
|
-
|
|
13400
|
-
|
|
13372
|
+
enableShadow: enableShadow,
|
|
13373
|
+
pointerEvents: "box-none"
|
|
13374
|
+
}, /*#__PURE__*/React.createElement(StyledBackdrop$1, {
|
|
13375
|
+
pointerEvents: visible ? 'auto' : 'box-none',
|
|
13376
|
+
onPress: onDismiss,
|
|
13377
|
+
style: {
|
|
13378
|
+
opacity: interpolateBackdropOpacity
|
|
13379
|
+
}
|
|
13380
|
+
}), /*#__PURE__*/React.createElement(StyledDrawerContainer, {
|
|
13381
|
+
enableShadow: enableShadow,
|
|
13382
|
+
onLayout: function onLayout(_ref2) {
|
|
13383
|
+
var nativeEvent = _ref2.nativeEvent;
|
|
13384
|
+
return setHeight(nativeEvent.layout.height);
|
|
13385
|
+
},
|
|
13386
|
+
style: {
|
|
13401
13387
|
transform: [{
|
|
13402
|
-
translateY:
|
|
13388
|
+
translateY: interpolateTranslateY
|
|
13403
13389
|
}]
|
|
13404
|
-
}
|
|
13390
|
+
}
|
|
13405
13391
|
}, children));
|
|
13392
|
+
};
|
|
13393
|
+
var index$7 = Object.assign(Drawer, {
|
|
13394
|
+
Dragable: DragableDrawer
|
|
13406
13395
|
});
|
|
13407
|
-
|
|
13408
|
-
|
|
13409
|
-
|
|
13410
|
-
|
|
13411
|
-
|
|
13412
|
-
|
|
13413
|
-
|
|
13414
|
-
|
|
13415
|
-
|
|
13416
|
-
|
|
13417
|
-
|
|
13418
|
-
|
|
13419
|
-
|
|
13420
|
-
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
}
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13396
|
+
|
|
13397
|
+
var StyledWrapper$6 = index$a(View)(function (_ref) {
|
|
13398
|
+
var theme = _ref.theme;
|
|
13399
|
+
return {
|
|
13400
|
+
display: 'flex',
|
|
13401
|
+
flex: 1,
|
|
13402
|
+
flexDirection: 'column',
|
|
13403
|
+
alignItems: 'center',
|
|
13404
|
+
justifyContent: 'center',
|
|
13405
|
+
padding: theme.__hd__.empty.space.wrapperPadding
|
|
13406
|
+
};
|
|
13407
|
+
});
|
|
13408
|
+
var StyledTitle = index$a(Typography.Title)(function (_ref2) {
|
|
13409
|
+
var theme = _ref2.theme,
|
|
13410
|
+
themeVariant = _ref2.themeVariant;
|
|
13411
|
+
return {
|
|
13412
|
+
textAlign: 'center',
|
|
13413
|
+
marginBottom: theme.__hd__.empty.space.titleMargin,
|
|
13414
|
+
color: themeVariant === 'dark' ? theme.__hd__.empty.colors.invertedText : theme.__hd__.empty.colors.text
|
|
13415
|
+
};
|
|
13416
|
+
});
|
|
13417
|
+
var StyledDescription = index$a(Typography.Body)(function (_ref3) {
|
|
13418
|
+
var theme = _ref3.theme,
|
|
13419
|
+
themeVariant = _ref3.themeVariant;
|
|
13420
|
+
return {
|
|
13421
|
+
textAlign: 'center',
|
|
13422
|
+
color: themeVariant === 'dark' ? theme.__hd__.empty.colors.invertedSubduedText : theme.__hd__.empty.colors.subduedText
|
|
13423
|
+
};
|
|
13424
|
+
});
|
|
13425
|
+
|
|
13426
|
+
var Empty = function Empty(_ref) {
|
|
13427
|
+
var image = _ref.image,
|
|
13428
|
+
title = _ref.title,
|
|
13429
|
+
description = _ref.description,
|
|
13430
|
+
style = _ref.style,
|
|
13431
|
+
testID = _ref.testID,
|
|
13432
|
+
_ref$variant = _ref.variant,
|
|
13433
|
+
variant = _ref$variant === void 0 ? 'light' : _ref$variant;
|
|
13434
|
+
var theme = useTheme();
|
|
13435
|
+
return /*#__PURE__*/React.createElement(StyledWrapper$6, {
|
|
13436
|
+
style: style,
|
|
13437
|
+
testID: testID
|
|
13438
|
+
}, image !== undefined && /*#__PURE__*/React.cloneElement(image, _objectSpread2(_objectSpread2({}, image.props), {}, {
|
|
13439
|
+
style: [{
|
|
13440
|
+
marginBottom: theme.__hd__.empty.space.imageMargin
|
|
13441
|
+
}, image.props.style]
|
|
13442
|
+
})), /*#__PURE__*/React.createElement(StyledTitle, {
|
|
13443
|
+
themeVariant: variant,
|
|
13444
|
+
level: "h4",
|
|
13445
|
+
typeface: "playful"
|
|
13446
|
+
}, title), !!description && /*#__PURE__*/React.createElement(StyledDescription, {
|
|
13447
|
+
themeVariant: variant,
|
|
13448
|
+
typeface: "playful"
|
|
13449
|
+
}, description));
|
|
13436
13450
|
};
|
|
13437
13451
|
|
|
13438
13452
|
var StyledErrorModal = index$a(ModalWrapper)({
|