@hero-design/rn 8.42.0 → 8.42.2
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 +684 -684
- package/lib/index.js +683 -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';
|
|
@@ -8484,6 +8484,332 @@ var BottomSheetScrollView = function BottomSheetScrollView(_ref) {
|
|
|
8484
8484
|
}));
|
|
8485
8485
|
};
|
|
8486
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
|
+
|
|
8487
8813
|
var BottomSheet = function BottomSheet(_ref) {
|
|
8488
8814
|
var open = _ref.open,
|
|
8489
8815
|
header = _ref.header,
|
|
@@ -8560,7 +8886,7 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
8560
8886
|
setInternalShowDivider: setInternalShowDivider
|
|
8561
8887
|
};
|
|
8562
8888
|
}, [setInternalShowDivider]);
|
|
8563
|
-
return /*#__PURE__*/React.createElement(
|
|
8889
|
+
return /*#__PURE__*/React.createElement(ModalWrapper, {
|
|
8564
8890
|
visible: visible,
|
|
8565
8891
|
onRequestClose: onRequestClose,
|
|
8566
8892
|
transparent: true,
|
|
@@ -8773,7 +9099,7 @@ var borderWidths = {
|
|
|
8773
9099
|
var config = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, colors), space), radii), borderWidths);
|
|
8774
9100
|
var flexPropsKey = ['alignContent', 'alignItems', 'alignSelf', 'display', 'flex', 'flexBasis', 'flexDirection', 'flexGrow', 'flexShrink', 'flexWrap', 'justifyContent'];
|
|
8775
9101
|
|
|
8776
|
-
var _excluded$
|
|
9102
|
+
var _excluded$l = ["theme"];
|
|
8777
9103
|
var getThemeValue = function getThemeValue(theme, key, props) {
|
|
8778
9104
|
var propConfig = config[key];
|
|
8779
9105
|
var propValue = props[key];
|
|
@@ -8800,18 +9126,18 @@ var mapStylePropToThemeValue = function mapStylePropToThemeValue(theme, props) {
|
|
|
8800
9126
|
var configKeys = Object.keys(config);
|
|
8801
9127
|
var StyledBox = index$a(View)(function (_ref5) {
|
|
8802
9128
|
var theme = _ref5.theme,
|
|
8803
|
-
otherProps = _objectWithoutProperties(_ref5, _excluded$
|
|
9129
|
+
otherProps = _objectWithoutProperties(_ref5, _excluded$l);
|
|
8804
9130
|
var styleProps = pick(configKeys, otherProps);
|
|
8805
9131
|
var flexProps = pick(_toConsumableArray(flexPropsKey), otherProps);
|
|
8806
9132
|
return _objectSpread2(_objectSpread2({}, mapStylePropToThemeValue(theme, styleProps)), flexProps);
|
|
8807
9133
|
});
|
|
8808
9134
|
|
|
8809
|
-
var _excluded$
|
|
9135
|
+
var _excluded$k = ["children", "style", "testID"];
|
|
8810
9136
|
var Box = function Box(_ref) {
|
|
8811
9137
|
var children = _ref.children,
|
|
8812
9138
|
style = _ref.style,
|
|
8813
9139
|
testID = _ref.testID,
|
|
8814
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
|
9140
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$k);
|
|
8815
9141
|
return /*#__PURE__*/React.createElement(StyledBox, _extends$1({}, otherProps, {
|
|
8816
9142
|
style: style,
|
|
8817
9143
|
testID: testID
|
|
@@ -11451,7 +11777,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
11451
11777
|
})));
|
|
11452
11778
|
};
|
|
11453
11779
|
|
|
11454
|
-
var _excluded$
|
|
11780
|
+
var _excluded$j = ["rounded", "size", "testID", "style"];
|
|
11455
11781
|
var Image = function Image(_ref) {
|
|
11456
11782
|
var _ref$rounded = _ref.rounded,
|
|
11457
11783
|
rounded = _ref$rounded === void 0 ? false : _ref$rounded,
|
|
@@ -11459,7 +11785,7 @@ var Image = function Image(_ref) {
|
|
|
11459
11785
|
size = _ref$size === void 0 ? '6xlarge' : _ref$size,
|
|
11460
11786
|
testID = _ref.testID,
|
|
11461
11787
|
style = _ref.style,
|
|
11462
|
-
imageNativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
11788
|
+
imageNativeProps = _objectWithoutProperties(_ref, _excluded$j);
|
|
11463
11789
|
var theme = useTheme();
|
|
11464
11790
|
var imageSize = theme.__hd__.image.sizes[size];
|
|
11465
11791
|
return /*#__PURE__*/React.createElement(Image$1, _extends$1({
|
|
@@ -11664,12 +11990,12 @@ var Indicator = index$a(View)(function (_ref2) {
|
|
|
11664
11990
|
};
|
|
11665
11991
|
});
|
|
11666
11992
|
|
|
11667
|
-
var _excluded$
|
|
11993
|
+
var _excluded$i = ["intent", "children"];
|
|
11668
11994
|
var DataCard = function DataCard(_ref) {
|
|
11669
11995
|
var _ref$intent = _ref.intent,
|
|
11670
11996
|
intent = _ref$intent === void 0 ? 'info' : _ref$intent,
|
|
11671
11997
|
children = _ref.children,
|
|
11672
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
11998
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$i);
|
|
11673
11999
|
return /*#__PURE__*/React.createElement(StyledDataCard, nativeProps, /*#__PURE__*/React.createElement(Indicator, {
|
|
11674
12000
|
themeIntent: intent,
|
|
11675
12001
|
testID: "data-card-indicator"
|
|
@@ -11687,11 +12013,11 @@ var StyledCard$1 = index$a(View)(function (_ref) {
|
|
|
11687
12013
|
});
|
|
11688
12014
|
});
|
|
11689
12015
|
|
|
11690
|
-
var _excluded$
|
|
12016
|
+
var _excluded$h = ["intent", "children"];
|
|
11691
12017
|
var Card = function Card(_ref) {
|
|
11692
12018
|
var intent = _ref.intent,
|
|
11693
12019
|
children = _ref.children,
|
|
11694
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
12020
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$h);
|
|
11695
12021
|
return /*#__PURE__*/React.createElement(StyledCard$1, _extends$1({}, nativeProps, {
|
|
11696
12022
|
themeIntent: intent
|
|
11697
12023
|
}), children);
|
|
@@ -11898,7 +12224,7 @@ var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
11898
12224
|
});
|
|
11899
12225
|
CardCarousel.displayName = 'CardCarousel';
|
|
11900
12226
|
|
|
11901
|
-
var _excluded$
|
|
12227
|
+
var _excluded$g = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "shouldShowPagination", "testID", "pageControlPosition"];
|
|
11902
12228
|
function useStateFromProp(initialValue) {
|
|
11903
12229
|
var _useState = useState(initialValue),
|
|
11904
12230
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -11924,7 +12250,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
11924
12250
|
testID = _ref.testID,
|
|
11925
12251
|
_ref$pageControlPosit = _ref.pageControlPosition,
|
|
11926
12252
|
pageControlPosition = _ref$pageControlPosit === void 0 ? 'top' : _ref$pageControlPosit,
|
|
11927
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
12253
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$g);
|
|
11928
12254
|
useDeprecation("shouldShowPagination prop has been deprecated", shouldShowPagination !== noop);
|
|
11929
12255
|
useDeprecation("The use of 'pageControlPosition == bottom' has been deprecated", pageControlPosition === 'bottom');
|
|
11930
12256
|
var carouselRef = useRef(null);
|
|
@@ -12261,7 +12587,7 @@ var StyledErrorAndMaxLengthContainer = index$a(View)(function () {
|
|
|
12261
12587
|
};
|
|
12262
12588
|
});
|
|
12263
12589
|
|
|
12264
|
-
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"];
|
|
12265
12591
|
var getState$1 = function getState(_ref) {
|
|
12266
12592
|
var disabled = _ref.disabled,
|
|
12267
12593
|
error = _ref.error,
|
|
@@ -12313,7 +12639,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref2, ref) {
|
|
|
12313
12639
|
allowFontScaling = _ref2$allowFontScalin === void 0 ? false : _ref2$allowFontScalin,
|
|
12314
12640
|
_ref2$variant = _ref2.variant,
|
|
12315
12641
|
variant = _ref2$variant === void 0 ? 'text' : _ref2$variant,
|
|
12316
|
-
nativeProps = _objectWithoutProperties(_ref2, _excluded$
|
|
12642
|
+
nativeProps = _objectWithoutProperties(_ref2, _excluded$f);
|
|
12317
12643
|
var displayText = (_ref3 = value !== undefined ? value : defaultValue) !== null && _ref3 !== void 0 ? _ref3 : '';
|
|
12318
12644
|
var isEmptyValue = displayText.length === 0;
|
|
12319
12645
|
var actualSuffix = loading ? 'loading' : suffix;
|
|
@@ -12734,719 +13060,393 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
12734
13060
|
style: style
|
|
12735
13061
|
})), /*#__PURE__*/React.createElement(BottomSheet$1, {
|
|
12736
13062
|
open: open,
|
|
12737
|
-
onRequestClose: function onRequestClose() {
|
|
12738
|
-
return setOpen(false);
|
|
12739
|
-
},
|
|
12740
|
-
header: label,
|
|
12741
|
-
footer: /*#__PURE__*/React.createElement(CompoundButton, {
|
|
12742
|
-
variant: "text",
|
|
12743
|
-
text: confirmLabel,
|
|
12744
|
-
onPress: function onPress() {
|
|
12745
|
-
if (selectingDate) {
|
|
12746
|
-
onChange(selectingDate);
|
|
12747
|
-
}
|
|
12748
|
-
setOpen(false);
|
|
12749
|
-
}
|
|
12750
|
-
})
|
|
12751
|
-
}, /*#__PURE__*/React.createElement(StyledPickerWrapper$1, null, /*#__PURE__*/React.createElement(DateTimePicker, {
|
|
12752
|
-
testID: "datePickerIOS",
|
|
12753
|
-
value: selectingDate,
|
|
12754
|
-
minimumDate: minDate,
|
|
12755
|
-
maximumDate: maxDate,
|
|
12756
|
-
mode: "date",
|
|
12757
|
-
onChange: function onChange(_, date) {
|
|
12758
|
-
if (date) {
|
|
12759
|
-
setSelectingDate(date);
|
|
12760
|
-
}
|
|
12761
|
-
},
|
|
12762
|
-
display: "spinner",
|
|
12763
|
-
style: {
|
|
12764
|
-
flex: 1
|
|
12765
|
-
},
|
|
12766
|
-
textColor: theme.colors.onDefaultGlobalSurface
|
|
12767
|
-
}))));
|
|
12768
|
-
};
|
|
12769
|
-
|
|
12770
|
-
var _excluded$f = ["variant"];
|
|
12771
|
-
var DatePicker = function DatePicker(_ref) {
|
|
12772
|
-
var _ref$variant = _ref.variant,
|
|
12773
|
-
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
12774
|
-
props = _objectWithoutProperties(_ref, _excluded$f);
|
|
12775
|
-
if (variant === 'calendar') {
|
|
12776
|
-
return /*#__PURE__*/React.createElement(DatePickerCalendar, props);
|
|
12777
|
-
}
|
|
12778
|
-
if (Platform.OS === 'ios') {
|
|
12779
|
-
return /*#__PURE__*/React.createElement(DatePickerIOS, props);
|
|
12780
|
-
}
|
|
12781
|
-
return /*#__PURE__*/React.createElement(DatePickerAndroid, props);
|
|
12782
|
-
};
|
|
12783
|
-
|
|
12784
|
-
var AnimatedPressable$1 = Animated.createAnimatedComponent(Pressable);
|
|
12785
|
-
var StyledContainer$3 = index$a(View)(function (_ref) {
|
|
12786
|
-
var theme = _ref.theme,
|
|
12787
|
-
enableShadow = _ref.enableShadow;
|
|
12788
|
-
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
12789
|
-
shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
|
|
12790
|
-
shadowOffset: theme.__hd__.drawer.shadows.offset,
|
|
12791
|
-
shadowOpacity: theme.__hd__.drawer.shadows.opacity,
|
|
12792
|
-
shadowRadius: theme.__hd__.drawer.shadows.radius,
|
|
12793
|
-
overflow: 'hidden',
|
|
12794
|
-
zIndex: 9999,
|
|
12795
|
-
elevation: 9999
|
|
12796
|
-
});
|
|
12797
|
-
});
|
|
12798
|
-
var StyledDragableContainer = index$a(View)(function (_ref2) {
|
|
12799
|
-
var theme = _ref2.theme,
|
|
12800
|
-
enableShadow = _ref2.enableShadow;
|
|
12801
|
-
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
12802
|
-
shadowColor: enableShadow ? theme.__hd__.drawer.colors.shadow : 'transparent',
|
|
12803
|
-
shadowOffset: theme.__hd__.drawer.shadows.offset,
|
|
12804
|
-
shadowOpacity: theme.__hd__.drawer.shadows.opacity,
|
|
12805
|
-
shadowRadius: theme.__hd__.drawer.shadows.radius,
|
|
12806
|
-
overflow: 'hidden',
|
|
12807
|
-
zIndex: 9999,
|
|
12808
|
-
elevation: 9999,
|
|
12809
|
-
flexDirection: 'column-reverse'
|
|
12810
|
-
});
|
|
12811
|
-
});
|
|
12812
|
-
var StyledBackdrop$1 = index$a(AnimatedPressable$1)(function (_ref3) {
|
|
12813
|
-
var theme = _ref3.theme;
|
|
12814
|
-
return _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
12815
|
-
backgroundColor: theme.__hd__.drawer.colors.backdrop
|
|
12816
|
-
});
|
|
12817
|
-
});
|
|
12818
|
-
var StyledDrawerContainer = index$a(Animated.View)(function (_ref4) {
|
|
12819
|
-
var theme = _ref4.theme,
|
|
12820
|
-
enableShadow = _ref4.enableShadow;
|
|
12821
|
-
return {
|
|
12822
|
-
borderBottomLeftRadius: theme.__hd__.drawer.radii["default"],
|
|
12823
|
-
borderBottomRightRadius: theme.__hd__.drawer.radii["default"],
|
|
12824
|
-
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
12825
|
-
elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
|
|
12826
|
-
overflow: 'hidden'
|
|
12827
|
-
};
|
|
12828
|
-
});
|
|
12829
|
-
var StyledDragableDrawerContainer = index$a(Animated.View)(function (_ref5) {
|
|
12830
|
-
var theme = _ref5.theme,
|
|
12831
|
-
enableShadow = _ref5.enableShadow;
|
|
12832
|
-
return {
|
|
12833
|
-
borderTopLeftRadius: theme.__hd__.drawer.radii["default"],
|
|
12834
|
-
borderTopRightRadius: theme.__hd__.drawer.radii["default"],
|
|
12835
|
-
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
12836
|
-
elevation: enableShadow ? theme.__hd__.drawer.shadows.elevation : undefined,
|
|
12837
|
-
overflow: 'hidden',
|
|
12838
|
-
maxHeight: '100%'
|
|
12839
|
-
};
|
|
12840
|
-
});
|
|
12841
|
-
var StyledHandlerContainer = index$a(View)(function (_ref6) {
|
|
12842
|
-
var theme = _ref6.theme;
|
|
12843
|
-
return {
|
|
12844
|
-
backgroundColor: theme.__hd__.drawer.colors.background,
|
|
12845
|
-
paddingVertical: theme.__hd__.drawer.space.handlerPaddingVertical,
|
|
12846
|
-
alignItems: 'center'
|
|
12847
|
-
};
|
|
12848
|
-
});
|
|
12849
|
-
var StyledHandler = index$a(View)(function (_ref7) {
|
|
12850
|
-
var theme = _ref7.theme;
|
|
12851
|
-
return {
|
|
12852
|
-
width: theme.__hd__.drawer.sizes.handlerWidth,
|
|
12853
|
-
height: theme.__hd__.drawer.sizes.handlerHeight,
|
|
12854
|
-
backgroundColor: theme.__hd__.drawer.colors.handler,
|
|
12855
|
-
borderRadius: theme.__hd__.drawer.radii.handler
|
|
12856
|
-
};
|
|
12857
|
-
});
|
|
12858
|
-
|
|
12859
|
-
var getOffset = function getOffset(height, percentage) {
|
|
12860
|
-
if (percentage < 0) return height;
|
|
12861
|
-
if (percentage > 100) return 0;
|
|
12862
|
-
return height * ((100 - percentage) / 100);
|
|
12863
|
-
};
|
|
12864
|
-
var calculateSnapPointsData = function calculateSnapPointsData(minimumHeight, height, snapPoints) {
|
|
12865
|
-
var filteredSnapPoints = snapPoints.filter(function (value) {
|
|
12866
|
-
return value >= minimumHeight;
|
|
12867
|
-
});
|
|
12868
|
-
var snapPointsOffsetValues = [minimumHeight].concat(_toConsumableArray(filteredSnapPoints)).map(function (value) {
|
|
12869
|
-
return getOffset(height, value);
|
|
12870
|
-
});
|
|
12871
|
-
var uniqSnapPointOffsetValues = Array.from(new Set([].concat(_toConsumableArray(snapPointsOffsetValues), [0])));
|
|
12872
|
-
return {
|
|
12873
|
-
list: uniqSnapPointOffsetValues,
|
|
12874
|
-
minHeightOffset: Math.max.apply(Math, uniqSnapPointOffsetValues),
|
|
12875
|
-
maxHeightOffset: 0 // Max height
|
|
12876
|
-
};
|
|
12877
|
-
};
|
|
12878
|
-
|
|
12879
|
-
var calculateAnimatedToValue = function calculateAnimatedToValue(position, heightSnapPoints) {
|
|
12880
|
-
var distances = heightSnapPoints.map(function (height) {
|
|
12881
|
-
return Math.abs(position - height);
|
|
12882
|
-
});
|
|
12883
|
-
var minIndex = distances.indexOf(Math.min.apply(Math, _toConsumableArray(distances)));
|
|
12884
|
-
return heightSnapPoints[minIndex];
|
|
12885
|
-
};
|
|
12886
|
-
|
|
12887
|
-
var DragableDrawer = function DragableDrawer(_ref) {
|
|
12888
|
-
var children = _ref.children,
|
|
12889
|
-
initialHeightPercentage = _ref.initialHeightPercentage,
|
|
12890
|
-
_ref$minimumHeightPer = _ref.minimumHeightPercentage,
|
|
12891
|
-
minimumHeightPercentage = _ref$minimumHeightPer === void 0 ? 10 : _ref$minimumHeightPer,
|
|
12892
|
-
_ref$snapPoints = _ref.snapPoints,
|
|
12893
|
-
snapPoints = _ref$snapPoints === void 0 ? [] : _ref$snapPoints,
|
|
12894
|
-
onExpanded = _ref.onExpanded,
|
|
12895
|
-
onCollapsed = _ref.onCollapsed,
|
|
12896
|
-
testID = _ref.testID;
|
|
12897
|
-
var _useState = useState(0),
|
|
12898
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
12899
|
-
height = _useState2[0],
|
|
12900
|
-
setHeight = _useState2[1];
|
|
12901
|
-
var baseHeightForMeasure = useRef(0);
|
|
12902
|
-
var snapPointsData = useRef({
|
|
12903
|
-
list: [],
|
|
12904
|
-
minHeightOffset: 0,
|
|
12905
|
-
maxHeightOffset: 0
|
|
12906
|
-
});
|
|
12907
|
-
// Track drag
|
|
12908
|
-
var pan = useRef(new Animated.Value(0)).current;
|
|
12909
|
-
var offset = useRef(0);
|
|
12910
|
-
var offsetBeforePan = useRef(0);
|
|
12911
|
-
var _useState3 = useState(-1),
|
|
12912
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
12913
|
-
animatedToValue = _useState4[0],
|
|
12914
|
-
setAnimatedToValue = _useState4[1];
|
|
12915
|
-
useEffect(function () {
|
|
12916
|
-
var id = pan.addListener(function (_ref2) {
|
|
12917
|
-
var value = _ref2.value;
|
|
12918
|
-
offset.current = value;
|
|
12919
|
-
});
|
|
12920
|
-
return function () {
|
|
12921
|
-
return pan.removeListener(id);
|
|
12922
|
-
};
|
|
12923
|
-
}, []);
|
|
12924
|
-
useEffect(function () {
|
|
12925
|
-
if (height > 0) {
|
|
12926
|
-
var initialOffset = getOffset(height, initialHeightPercentage || minimumHeightPercentage);
|
|
12927
|
-
setAnimatedToValue(initialOffset);
|
|
12928
|
-
}
|
|
12929
|
-
}, [height]);
|
|
12930
|
-
useEffect(function () {
|
|
12931
|
-
if (height > 0) {
|
|
12932
|
-
pan.setValue(height);
|
|
12933
|
-
offset.current = height;
|
|
12934
|
-
baseHeightForMeasure.current = height;
|
|
12935
|
-
// Calculate snap points information
|
|
12936
|
-
snapPointsData.current = calculateSnapPointsData(minimumHeightPercentage, height, snapPoints);
|
|
12937
|
-
}
|
|
12938
|
-
}, [height, minimumHeightPercentage]);
|
|
12939
|
-
useEffect(function () {
|
|
12940
|
-
if (animatedToValue >= 0) {
|
|
12941
|
-
var animation = Animated.timing(pan, {
|
|
12942
|
-
toValue: animatedToValue,
|
|
12943
|
-
useNativeDriver: true,
|
|
12944
|
-
easing: Easing.inOut(Easing.cubic)
|
|
12945
|
-
});
|
|
12946
|
-
animation.start(function () {
|
|
12947
|
-
if (animatedToValue === 0) {
|
|
12948
|
-
onExpanded === null || onExpanded === void 0 ? void 0 : onExpanded();
|
|
12949
|
-
} else if (animatedToValue === getOffset(height, minimumHeightPercentage)) {
|
|
12950
|
-
onCollapsed === null || onCollapsed === void 0 ? void 0 : onCollapsed();
|
|
12951
|
-
}
|
|
12952
|
-
setAnimatedToValue(-1);
|
|
12953
|
-
});
|
|
12954
|
-
return function () {
|
|
12955
|
-
return animation.stop();
|
|
12956
|
-
};
|
|
12957
|
-
}
|
|
12958
|
-
}, [animatedToValue]);
|
|
12959
|
-
var panResponder = useRef(PanResponder.create({
|
|
12960
|
-
onMoveShouldSetPanResponder: function onMoveShouldSetPanResponder() {
|
|
12961
|
-
return true;
|
|
12962
|
-
},
|
|
12963
|
-
onPanResponderGrant: function onPanResponderGrant() {
|
|
12964
|
-
offsetBeforePan.current = offset.current;
|
|
12965
|
-
pan.setOffset(offset.current);
|
|
12966
|
-
pan.setValue(0);
|
|
12967
|
-
},
|
|
12968
|
-
onPanResponderMove: function onPanResponderMove(_, gesture) {
|
|
12969
|
-
var _snapPointsData$curre;
|
|
12970
|
-
var panDistance = gesture.dy;
|
|
12971
|
-
// Moving toward top, stop at highest snap point
|
|
12972
|
-
if (offsetBeforePan.current + panDistance < 0) {
|
|
12973
|
-
pan.setValue(-offsetBeforePan.current);
|
|
12974
|
-
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);
|
|
12975
13075
|
}
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
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);
|
|
12980
13086
|
}
|
|
12981
|
-
pan.setValue(panDistance);
|
|
12982
13087
|
},
|
|
12983
|
-
|
|
12984
|
-
pan.flattenOffset();
|
|
12985
|
-
// Attach to nearest snappoint
|
|
12986
|
-
var panDistance = gesture.dy;
|
|
12987
|
-
var offsetAfterPan = offsetBeforePan.current + panDistance;
|
|
12988
|
-
var animatedValue = calculateAnimatedToValue(offsetAfterPan, snapPointsData.current.list);
|
|
12989
|
-
setAnimatedToValue(animatedValue);
|
|
12990
|
-
}
|
|
12991
|
-
})).current;
|
|
12992
|
-
return /*#__PURE__*/React.createElement(StyledDragableContainer, {
|
|
12993
|
-
testID: testID,
|
|
12994
|
-
enableShadow: true,
|
|
12995
|
-
pointerEvents: "box-none"
|
|
12996
|
-
}, /*#__PURE__*/React.createElement(StyledDragableDrawerContainer, {
|
|
12997
|
-
enableShadow: true,
|
|
13088
|
+
display: "spinner",
|
|
12998
13089
|
style: {
|
|
12999
|
-
|
|
13000
|
-
scaleY: baseHeightForMeasure.current > 0 ? 1 : 0
|
|
13001
|
-
}, {
|
|
13002
|
-
translateY: pan
|
|
13003
|
-
}]
|
|
13090
|
+
flex: 1
|
|
13004
13091
|
},
|
|
13005
|
-
|
|
13006
|
-
|
|
13007
|
-
setHeight(nativeEvent.layout.height);
|
|
13008
|
-
}
|
|
13009
|
-
}, /*#__PURE__*/React.createElement(StyledHandlerContainer, panResponder.panHandlers, /*#__PURE__*/React.createElement(StyledHandler, null)), children));
|
|
13092
|
+
textColor: theme.colors.onDefaultGlobalSurface
|
|
13093
|
+
}))));
|
|
13010
13094
|
};
|
|
13011
13095
|
|
|
13012
|
-
var
|
|
13013
|
-
|
|
13014
|
-
|
|
13015
|
-
_ref$
|
|
13016
|
-
|
|
13017
|
-
|
|
13018
|
-
|
|
13019
|
-
|
|
13020
|
-
|
|
13021
|
-
|
|
13022
|
-
|
|
13023
|
-
|
|
13024
|
-
var enableShadow = visible && !hasBackdrop;
|
|
13025
|
-
var interpolateTranslateY = animatedValue.interpolate({
|
|
13026
|
-
inputRange: [0, 1],
|
|
13027
|
-
outputRange: [-height, 0]
|
|
13028
|
-
});
|
|
13029
|
-
var interpolateBackdropOpacity = hasBackdrop ? animatedValue.interpolate({
|
|
13030
|
-
inputRange: [0, 1],
|
|
13031
|
-
outputRange: [0, 0.35]
|
|
13032
|
-
}) : 0;
|
|
13033
|
-
useEffect(function () {
|
|
13034
|
-
var animation = Animated.timing(animatedValue, {
|
|
13035
|
-
toValue: visible ? 1 : 0,
|
|
13036
|
-
easing: Easing.inOut(Easing.cubic),
|
|
13037
|
-
useNativeDriver: true
|
|
13038
|
-
});
|
|
13039
|
-
animation.start();
|
|
13040
|
-
return function () {
|
|
13041
|
-
return animation.stop();
|
|
13042
|
-
};
|
|
13043
|
-
}, [visible]);
|
|
13044
|
-
return /*#__PURE__*/React.createElement(StyledContainer$3, {
|
|
13045
|
-
testID: testID,
|
|
13046
|
-
enableShadow: enableShadow,
|
|
13047
|
-
pointerEvents: "box-none"
|
|
13048
|
-
}, /*#__PURE__*/React.createElement(StyledBackdrop$1, {
|
|
13049
|
-
pointerEvents: visible ? 'auto' : 'box-none',
|
|
13050
|
-
onPress: onDismiss,
|
|
13051
|
-
style: {
|
|
13052
|
-
opacity: interpolateBackdropOpacity
|
|
13053
|
-
}
|
|
13054
|
-
}), /*#__PURE__*/React.createElement(StyledDrawerContainer, {
|
|
13055
|
-
enableShadow: enableShadow,
|
|
13056
|
-
onLayout: function onLayout(_ref2) {
|
|
13057
|
-
var nativeEvent = _ref2.nativeEvent;
|
|
13058
|
-
return setHeight(nativeEvent.layout.height);
|
|
13059
|
-
},
|
|
13060
|
-
style: {
|
|
13061
|
-
transform: [{
|
|
13062
|
-
translateY: interpolateTranslateY
|
|
13063
|
-
}]
|
|
13064
|
-
}
|
|
13065
|
-
}, 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);
|
|
13066
13108
|
};
|
|
13067
|
-
var index$7 = Object.assign(Drawer, {
|
|
13068
|
-
Dragable: DragableDrawer
|
|
13069
|
-
});
|
|
13070
13109
|
|
|
13071
|
-
var
|
|
13072
|
-
|
|
13073
|
-
|
|
13074
|
-
|
|
13075
|
-
|
|
13076
|
-
|
|
13077
|
-
|
|
13078
|
-
|
|
13079
|
-
|
|
13080
|
-
|
|
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
|
+
});
|
|
13081
13123
|
});
|
|
13082
|
-
var
|
|
13124
|
+
var StyledDragableContainer = index$a(View)(function (_ref2) {
|
|
13083
13125
|
var theme = _ref2.theme,
|
|
13084
|
-
|
|
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;
|
|
13085
13147
|
return {
|
|
13086
|
-
|
|
13087
|
-
|
|
13088
|
-
|
|
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'
|
|
13089
13153
|
};
|
|
13090
13154
|
});
|
|
13091
|
-
var
|
|
13092
|
-
var theme =
|
|
13093
|
-
|
|
13155
|
+
var StyledDragableDrawerContainer = index$a(Animated.View)(function (_ref5) {
|
|
13156
|
+
var theme = _ref5.theme,
|
|
13157
|
+
enableShadow = _ref5.enableShadow;
|
|
13094
13158
|
return {
|
|
13095
|
-
|
|
13096
|
-
|
|
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%'
|
|
13097
13165
|
};
|
|
13098
13166
|
});
|
|
13099
|
-
|
|
13100
|
-
var
|
|
13101
|
-
|
|
13102
|
-
|
|
13103
|
-
|
|
13104
|
-
|
|
13105
|
-
testID = _ref.testID,
|
|
13106
|
-
_ref$variant = _ref.variant,
|
|
13107
|
-
variant = _ref$variant === void 0 ? 'light' : _ref$variant;
|
|
13108
|
-
var theme = useTheme();
|
|
13109
|
-
return /*#__PURE__*/React.createElement(StyledWrapper$6, {
|
|
13110
|
-
style: style,
|
|
13111
|
-
testID: testID
|
|
13112
|
-
}, image !== undefined && /*#__PURE__*/React.cloneElement(image, _objectSpread2(_objectSpread2({}, image.props), {}, {
|
|
13113
|
-
style: [{
|
|
13114
|
-
marginBottom: theme.__hd__.empty.space.imageMargin
|
|
13115
|
-
}, image.props.style]
|
|
13116
|
-
})), /*#__PURE__*/React.createElement(StyledTitle, {
|
|
13117
|
-
themeVariant: variant,
|
|
13118
|
-
level: "h4",
|
|
13119
|
-
typeface: "playful"
|
|
13120
|
-
}, title), !!description && /*#__PURE__*/React.createElement(StyledDescription, {
|
|
13121
|
-
themeVariant: variant,
|
|
13122
|
-
typeface: "playful"
|
|
13123
|
-
}, description));
|
|
13124
|
-
};
|
|
13125
|
-
|
|
13126
|
-
var customAlphabet = function customAlphabet(alphabet) {
|
|
13127
|
-
var defaultSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 21;
|
|
13128
|
-
return function () {
|
|
13129
|
-
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultSize;
|
|
13130
|
-
var id = '';
|
|
13131
|
-
var i = size;
|
|
13132
|
-
while (i--) {
|
|
13133
|
-
id += alphabet[Math.random() * alphabet.length | 0];
|
|
13134
|
-
}
|
|
13135
|
-
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'
|
|
13136
13173
|
};
|
|
13137
|
-
};
|
|
13138
|
-
|
|
13139
|
-
var
|
|
13140
|
-
|
|
13141
|
-
|
|
13142
|
-
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
}
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
var PortalStateContext = /*#__PURE__*/createContext(null);
|
|
13149
|
-
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
|
+
});
|
|
13150
13184
|
|
|
13151
|
-
var
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13156
|
-
|
|
13157
|
-
var
|
|
13158
|
-
|
|
13159
|
-
|
|
13160
|
-
|
|
13161
|
-
|
|
13162
|
-
}
|
|
13163
|
-
var
|
|
13164
|
-
dispatch({
|
|
13165
|
-
type: ACTIONS.DEREGISTER_HOST,
|
|
13166
|
-
hostName: hostName
|
|
13167
|
-
});
|
|
13168
|
-
}, []);
|
|
13169
|
-
var addUpdatePortal = useCallback(function (name, node) {
|
|
13170
|
-
dispatch({
|
|
13171
|
-
type: ACTIONS.ADD_UPDATE_PORTAL,
|
|
13172
|
-
hostName: hostName,
|
|
13173
|
-
portalName: name,
|
|
13174
|
-
node: node
|
|
13175
|
-
});
|
|
13176
|
-
}, []);
|
|
13177
|
-
var removePortal = useCallback(function (name) {
|
|
13178
|
-
dispatch({
|
|
13179
|
-
type: ACTIONS.REMOVE_PORTAL,
|
|
13180
|
-
hostName: hostName,
|
|
13181
|
-
portalName: name
|
|
13182
|
-
});
|
|
13183
|
-
}, []);
|
|
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])));
|
|
13184
13198
|
return {
|
|
13185
|
-
|
|
13186
|
-
|
|
13187
|
-
|
|
13188
|
-
updatePortal: addUpdatePortal,
|
|
13189
|
-
removePortal: removePortal
|
|
13199
|
+
list: uniqSnapPointOffsetValues,
|
|
13200
|
+
minHeightOffset: Math.max.apply(Math, uniqSnapPointOffsetValues),
|
|
13201
|
+
maxHeightOffset: 0 // Max height
|
|
13190
13202
|
};
|
|
13191
13203
|
};
|
|
13192
13204
|
|
|
13193
|
-
var
|
|
13194
|
-
var
|
|
13195
|
-
|
|
13196
|
-
|
|
13197
|
-
|
|
13198
|
-
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];
|
|
13199
13211
|
};
|
|
13200
13212
|
|
|
13201
|
-
var
|
|
13202
|
-
var
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
|
|
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];
|
|
13207
13241
|
useEffect(function () {
|
|
13208
|
-
|
|
13242
|
+
var id = pan.addListener(function (_ref2) {
|
|
13243
|
+
var value = _ref2.value;
|
|
13244
|
+
offset.current = value;
|
|
13245
|
+
});
|
|
13209
13246
|
return function () {
|
|
13210
|
-
|
|
13247
|
+
return pan.removeListener(id);
|
|
13211
13248
|
};
|
|
13212
13249
|
}, []);
|
|
13213
|
-
|
|
13214
|
-
|
|
13215
|
-
|
|
13216
|
-
|
|
13217
|
-
|
|
13218
|
-
|
|
13219
|
-
|
|
13220
|
-
|
|
13221
|
-
|
|
13222
|
-
|
|
13223
|
-
|
|
13224
|
-
|
|
13225
|
-
|
|
13226
|
-
|
|
13227
|
-
|
|
13228
|
-
|
|
13229
|
-
|
|
13230
|
-
|
|
13231
|
-
|
|
13232
|
-
|
|
13233
|
-
|
|
13234
|
-
|
|
13235
|
-
|
|
13236
|
-
|
|
13237
|
-
|
|
13238
|
-
|
|
13239
|
-
|
|
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;
|
|
13240
13301
|
}
|
|
13241
|
-
|
|
13242
|
-
|
|
13243
|
-
|
|
13244
|
-
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
};
|
|
13257
|
-
|
|
13258
|
-
|
|
13259
|
-
|
|
13260
|
-
|
|
13261
|
-
|
|
13262
|
-
|
|
13263
|
-
|
|
13264
|
-
|
|
13265
|
-
|
|
13266
|
-
|
|
13267
|
-
|
|
13268
|
-
|
|
13269
|
-
|
|
13270
|
-
|
|
13271
|
-
|
|
13272
|
-
|
|
13273
|
-
|
|
13274
|
-
|
|
13275
|
-
rootHostName = _ref$rootHostName === void 0 ? 'root' : _ref$rootHostName,
|
|
13276
|
-
children = _ref.children;
|
|
13277
|
-
var _useReducer = useReducer(reducer, INITIAL_STATE),
|
|
13278
|
-
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
13279
|
-
state = _useReducer2[0],
|
|
13280
|
-
dispatch = _useReducer2[1];
|
|
13281
|
-
return /*#__PURE__*/React.createElement(PortalDispatchContext.Provider, {
|
|
13282
|
-
value: dispatch
|
|
13283
|
-
}, /*#__PURE__*/React.createElement(PortalStateContext.Provider, {
|
|
13284
|
-
value: state
|
|
13285
|
-
}, children, /*#__PURE__*/React.createElement(PortalHost, {
|
|
13286
|
-
name: rootHostName
|
|
13287
|
-
})));
|
|
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));
|
|
13288
13336
|
};
|
|
13289
|
-
var PortalProvider = /*#__PURE__*/memo(PortalProviderComponent);
|
|
13290
|
-
PortalProvider.displayName = 'PortalProvider';
|
|
13291
13337
|
|
|
13292
|
-
var
|
|
13293
|
-
var
|
|
13294
|
-
var name = _ref.name,
|
|
13295
|
-
hostName = _ref.hostName,
|
|
13338
|
+
var Drawer = function Drawer(_ref) {
|
|
13339
|
+
var visible = _ref.visible,
|
|
13296
13340
|
children = _ref.children,
|
|
13297
|
-
|
|
13298
|
-
|
|
13299
|
-
|
|
13300
|
-
|
|
13301
|
-
|
|
13302
|
-
var
|
|
13303
|
-
|
|
13304
|
-
|
|
13305
|
-
|
|
13306
|
-
|
|
13307
|
-
|
|
13308
|
-
}, children);
|
|
13309
|
-
}, [theme, children, defaultTheme]);
|
|
13310
|
-
useLayoutEffect(function () {
|
|
13311
|
-
addUpdatePortal(nameOrRandom, ChildrenComponent);
|
|
13312
|
-
return function () {
|
|
13313
|
-
removePortal(nameOrRandom);
|
|
13314
|
-
};
|
|
13315
|
-
}, [addUpdatePortal]);
|
|
13316
|
-
useLayoutEffect(function () {
|
|
13317
|
-
addUpdatePortal(nameOrRandom, ChildrenComponent);
|
|
13318
|
-
}, [ChildrenComponent]);
|
|
13319
|
-
return null;
|
|
13320
|
-
};
|
|
13321
|
-
var Portal = /*#__PURE__*/memo(PortalComponent);
|
|
13322
|
-
Portal.displayName = 'Portal';
|
|
13323
|
-
var Portal$1 = Object.assign(Portal, {
|
|
13324
|
-
Provider: PortalProvider,
|
|
13325
|
-
Host: PortalHost
|
|
13326
|
-
});
|
|
13327
|
-
|
|
13328
|
-
var _excluded$e = ["visible"];
|
|
13329
|
-
var DEFAULT_BACKDROP_OPACITY = 0.4;
|
|
13330
|
-
var DEFAULT_ANIMATION_CONFIG = {
|
|
13331
|
-
easing: Easing.inOut(Easing.cubic),
|
|
13332
|
-
useNativeDriver: Platform.OS !== 'web',
|
|
13333
|
-
duration: 400
|
|
13334
|
-
};
|
|
13335
|
-
var Modal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
13336
|
-
var children = _ref.children,
|
|
13337
|
-
onShow = _ref.onShow,
|
|
13338
|
-
onRequestClose = _ref.onRequestClose,
|
|
13339
|
-
testID = _ref.testID,
|
|
13340
|
-
_ref$animationType = _ref.animationType,
|
|
13341
|
-
animationType = _ref$animationType === void 0 ? 'none' : _ref$animationType,
|
|
13342
|
-
_ref$transparent = _ref.transparent,
|
|
13343
|
-
transparent = _ref$transparent === void 0 ? false : _ref$transparent,
|
|
13344
|
-
onDismiss = _ref.onDismiss;
|
|
13345
|
-
var theme = useTheme();
|
|
13346
|
-
var animatedBackdropValue = useRef(new Animated.Value(0)).current;
|
|
13347
|
-
var animatedModalValue = useRef(new Animated.Value(0)).current;
|
|
13348
|
-
// Show or hide the backdrop and modal content
|
|
13349
|
-
var animateBackdropAndContent = useCallback(function (_ref2) {
|
|
13350
|
-
var toValue = _ref2.toValue,
|
|
13351
|
-
callback = _ref2.callback;
|
|
13352
|
-
if (animationType !== 'none') {
|
|
13353
|
-
// Backdrop animation
|
|
13354
|
-
if (!transparent) {
|
|
13355
|
-
Animated.timing(animatedBackdropValue, _objectSpread2({
|
|
13356
|
-
toValue: toValue
|
|
13357
|
-
}, DEFAULT_ANIMATION_CONFIG)).start();
|
|
13358
|
-
}
|
|
13359
|
-
// Modal content animation
|
|
13360
|
-
Animated.timing(animatedModalValue, _objectSpread2({
|
|
13361
|
-
toValue: toValue
|
|
13362
|
-
}, DEFAULT_ANIMATION_CONFIG)).start(callback);
|
|
13363
|
-
} else {
|
|
13364
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
13365
|
-
}
|
|
13366
|
-
}, [animationType, onShow, transparent]);
|
|
13367
|
-
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({
|
|
13368
13352
|
inputRange: [0, 1],
|
|
13369
|
-
outputRange: [
|
|
13353
|
+
outputRange: [-height, 0]
|
|
13370
13354
|
});
|
|
13371
|
-
var
|
|
13355
|
+
var interpolateBackdropOpacity = hasBackdrop ? animatedValue.interpolate({
|
|
13372
13356
|
inputRange: [0, 1],
|
|
13373
|
-
outputRange:
|
|
13374
|
-
});
|
|
13375
|
-
useImperativeHandle(ref, function () {
|
|
13376
|
-
return {
|
|
13377
|
-
show: function show() {
|
|
13378
|
-
animateBackdropAndContent({
|
|
13379
|
-
toValue: 1,
|
|
13380
|
-
callback: onShow
|
|
13381
|
-
});
|
|
13382
|
-
},
|
|
13383
|
-
hide: function hide(wrapperCallback) {
|
|
13384
|
-
animateBackdropAndContent({
|
|
13385
|
-
toValue: 0,
|
|
13386
|
-
callback: function callback() {
|
|
13387
|
-
if (Platform.OS === 'ios') {
|
|
13388
|
-
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
13389
|
-
}
|
|
13390
|
-
wrapperCallback();
|
|
13391
|
-
}
|
|
13392
|
-
});
|
|
13393
|
-
}
|
|
13394
|
-
};
|
|
13395
|
-
}, [onDismiss, onShow, animateBackdropAndContent]);
|
|
13396
|
-
// Back button handler
|
|
13357
|
+
outputRange: [0, 0.35]
|
|
13358
|
+
}) : 0;
|
|
13397
13359
|
useEffect(function () {
|
|
13398
|
-
var
|
|
13399
|
-
|
|
13400
|
-
|
|
13360
|
+
var animation = Animated.timing(animatedValue, {
|
|
13361
|
+
toValue: visible ? 1 : 0,
|
|
13362
|
+
easing: Easing.inOut(Easing.cubic),
|
|
13363
|
+
useNativeDriver: true
|
|
13401
13364
|
});
|
|
13365
|
+
animation.start();
|
|
13402
13366
|
return function () {
|
|
13403
|
-
return
|
|
13367
|
+
return animation.stop();
|
|
13404
13368
|
};
|
|
13405
|
-
}, [
|
|
13406
|
-
return /*#__PURE__*/React.createElement(
|
|
13407
|
-
style: _objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
13408
|
-
backgroundColor: transparent ? 'transparent' : theme.colors.overlayGlobalSurface,
|
|
13409
|
-
opacity: animationType !== 'none' ? backdropOpacityAnimation : DEFAULT_BACKDROP_OPACITY
|
|
13410
|
-
})
|
|
13411
|
-
}), /*#__PURE__*/React.createElement(Animated.View, {
|
|
13369
|
+
}, [visible]);
|
|
13370
|
+
return /*#__PURE__*/React.createElement(StyledContainer$3, {
|
|
13412
13371
|
testID: testID,
|
|
13413
|
-
|
|
13414
|
-
|
|
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: {
|
|
13415
13387
|
transform: [{
|
|
13416
|
-
translateY:
|
|
13388
|
+
translateY: interpolateTranslateY
|
|
13417
13389
|
}]
|
|
13418
|
-
}
|
|
13390
|
+
}
|
|
13419
13391
|
}, children));
|
|
13392
|
+
};
|
|
13393
|
+
var index$7 = Object.assign(Drawer, {
|
|
13394
|
+
Dragable: DragableDrawer
|
|
13420
13395
|
});
|
|
13421
|
-
|
|
13422
|
-
|
|
13423
|
-
|
|
13424
|
-
|
|
13425
|
-
|
|
13426
|
-
|
|
13427
|
-
|
|
13428
|
-
|
|
13429
|
-
|
|
13430
|
-
|
|
13431
|
-
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13440
|
-
}
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
|
|
13445
|
-
|
|
13446
|
-
|
|
13447
|
-
|
|
13448
|
-
|
|
13449
|
-
|
|
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));
|
|
13450
13450
|
};
|
|
13451
13451
|
|
|
13452
13452
|
var StyledErrorModal = index$a(ModalWrapper)({
|