@hero-design/rn 8.78.0 → 8.79.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +12 -0
- package/es/index.js +28 -16
- package/lib/index.js +28 -16
- package/package.json +1 -1
- package/src/components/BottomSheet/index.tsx +14 -15
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +1729 -0
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +35 -0
- package/src/components/Select/MultiSelect/index.tsx +5 -1
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +1617 -0
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +33 -0
- package/src/components/Select/SingleSelect/index.tsx +5 -1
- package/src/components/Select/types.ts +8 -0
- package/stats/8.78.1/rn-stats.html +4842 -0
- package/stats/8.79.0/rn-stats.html +4844 -0
- package/types/components/BottomSheet/index.d.ts +1 -1
- package/types/components/Select/MultiSelect/index.d.ts +1 -1
- package/types/components/Select/SingleSelect/index.d.ts +1 -1
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/Select/types.d.ts +8 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(node:
|
|
1
|
+
(node:2821) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
|
|
2
2
|
(Use `node --trace-warnings ...` to show where the warning was created)
|
|
3
3
|
[36m
|
|
4
4
|
[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
5
5
|
[1m[33m(!) [plugin replace] @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
6
6
|
[1m[33m(!) [plugin node-resolve] preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.[39m[22m
|
|
7
|
-
[32mcreated [1mlib/index.js, es/index.js[22m in [
|
|
7
|
+
[32mcreated [1mlib/index.js, es/index.js[22m in [1m50s[22m[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @hero-design/rn
|
|
2
2
|
|
|
3
|
+
## 8.79.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#3489](https://github.com/Thinkei/hero-design/pull/3489) [`94719952550e8923edd82d6d236c366e4d220c44`](https://github.com/Thinkei/hero-design/commit/94719952550e8923edd82d6d236c366e4d220c44) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Select] Support custom BottomSheet config
|
|
8
|
+
|
|
9
|
+
## 8.78.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#3487](https://github.com/Thinkei/hero-design/pull/3487) [`5bcbcf14116726514e58aef14c9f7758cd8d1683`](https://github.com/Thinkei/hero-design/commit/5bcbcf14116726514e58aef14c9f7758cd8d1683) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [BottomSheet] Add missing dependencies
|
|
14
|
+
|
|
3
15
|
## 8.78.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/es/index.js
CHANGED
|
@@ -9718,16 +9718,24 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
9718
9718
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
9719
9719
|
internalShowDivider = _useState4[0],
|
|
9720
9720
|
setInternalShowDivider = _useState4[1];
|
|
9721
|
-
var canCallOnDismiss = useRef(false);
|
|
9722
9721
|
useEffect(function () {
|
|
9723
|
-
// Prevent calling onDismiss when the component has not yet opened
|
|
9724
|
-
if (open && !canCallOnDismiss.current) {
|
|
9725
|
-
canCallOnDismiss.current = true;
|
|
9726
|
-
}
|
|
9727
9722
|
// Show the modal before the open animation start
|
|
9728
9723
|
if (open && !visible) {
|
|
9729
9724
|
setVisibility(open);
|
|
9730
9725
|
}
|
|
9726
|
+
// Delay closing the modal until after the closing animation end
|
|
9727
|
+
animatedValue.current.removeAllListeners();
|
|
9728
|
+
animatedValue.current.addListener(function (_ref2) {
|
|
9729
|
+
var value = _ref2.value;
|
|
9730
|
+
var endValueOfTransition = open ? 1 : 0;
|
|
9731
|
+
if (endValueOfTransition === 0 && value === endValueOfTransition) {
|
|
9732
|
+
setVisibility(false);
|
|
9733
|
+
onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
9734
|
+
}
|
|
9735
|
+
});
|
|
9736
|
+
return function () {
|
|
9737
|
+
return animatedValue.current.removeAllListeners();
|
|
9738
|
+
};
|
|
9731
9739
|
}, [open]);
|
|
9732
9740
|
// Animation
|
|
9733
9741
|
useEffect(function () {
|
|
@@ -9736,13 +9744,7 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
9736
9744
|
easing: Easing.inOut(Easing.cubic),
|
|
9737
9745
|
useNativeDriver: true
|
|
9738
9746
|
});
|
|
9739
|
-
animation.start(
|
|
9740
|
-
if (!open && canCallOnDismiss.current) {
|
|
9741
|
-
setVisibility(false);
|
|
9742
|
-
onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
9743
|
-
}
|
|
9744
|
-
onAnimationEnd === null || onAnimationEnd === void 0 || onAnimationEnd();
|
|
9745
|
-
});
|
|
9747
|
+
animation.start(onAnimationEnd);
|
|
9746
9748
|
return function () {
|
|
9747
9749
|
return animation.stop();
|
|
9748
9750
|
};
|
|
@@ -17429,7 +17431,9 @@ function MultiSelect(_ref) {
|
|
|
17429
17431
|
testID = _ref.testID,
|
|
17430
17432
|
value = _ref.value,
|
|
17431
17433
|
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
17432
|
-
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta
|
|
17434
|
+
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
|
|
17435
|
+
_ref$bottomSheetConfi = _ref.bottomSheetConfig,
|
|
17436
|
+
bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi;
|
|
17433
17437
|
var _useKeyboard = useKeyboard(),
|
|
17434
17438
|
isKeyboardVisible = _useKeyboard.isKeyboardVisible,
|
|
17435
17439
|
keyboardHeight = _useKeyboard.keyboardHeight;
|
|
@@ -17450,6 +17454,8 @@ function MultiSelect(_ref) {
|
|
|
17450
17454
|
return opt.text;
|
|
17451
17455
|
}).join(', ');
|
|
17452
17456
|
var rawValue = value.length > 0 ? value.join(', ') : '';
|
|
17457
|
+
var bottomSheetVariant = bottomSheetConfig.variant,
|
|
17458
|
+
bottomSheetHeader = bottomSheetConfig.header;
|
|
17453
17459
|
useEffect(function () {
|
|
17454
17460
|
setSelectingValue(value);
|
|
17455
17461
|
}, [open, value]);
|
|
@@ -17477,12 +17483,13 @@ function MultiSelect(_ref) {
|
|
|
17477
17483
|
return renderSelectedValue(value, props);
|
|
17478
17484
|
} : undefined
|
|
17479
17485
|
}))))), /*#__PURE__*/React__default.createElement(BottomSheet$1, {
|
|
17486
|
+
variant: bottomSheetVariant || 'fixed',
|
|
17480
17487
|
open: open,
|
|
17481
17488
|
onRequestClose: function onRequestClose() {
|
|
17482
17489
|
onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
17483
17490
|
setOpen(false);
|
|
17484
17491
|
},
|
|
17485
|
-
header: label,
|
|
17492
|
+
header: bottomSheetHeader || label,
|
|
17486
17493
|
style: {
|
|
17487
17494
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0
|
|
17488
17495
|
},
|
|
@@ -17632,7 +17639,9 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
17632
17639
|
testID = _ref.testID,
|
|
17633
17640
|
value = _ref.value,
|
|
17634
17641
|
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
17635
|
-
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta
|
|
17642
|
+
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
|
|
17643
|
+
_ref$bottomSheetConfi = _ref.bottomSheetConfig,
|
|
17644
|
+
bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi;
|
|
17636
17645
|
var _useKeyboard = useKeyboard(),
|
|
17637
17646
|
isKeyboardVisible = _useKeyboard.isKeyboardVisible,
|
|
17638
17647
|
keyboardHeight = _useKeyboard.keyboardHeight;
|
|
@@ -17647,6 +17656,8 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
17647
17656
|
return value === opt.value;
|
|
17648
17657
|
})) === null || _flatOptions$find === void 0 ? void 0 : _flatOptions$find.text;
|
|
17649
17658
|
var rawValue = value ? String(value) : undefined;
|
|
17659
|
+
var bottomSheetVariant = bottomSheetConfig.variant,
|
|
17660
|
+
bottomSheetHeader = bottomSheetConfig.header;
|
|
17650
17661
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(View, {
|
|
17651
17662
|
pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
|
|
17652
17663
|
}, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
|
|
@@ -17671,12 +17682,13 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
17671
17682
|
return renderSelectedValue(value, props);
|
|
17672
17683
|
} : undefined
|
|
17673
17684
|
}))))), /*#__PURE__*/React__default.createElement(BottomSheet$1, {
|
|
17685
|
+
variant: bottomSheetVariant || 'fixed',
|
|
17674
17686
|
open: open,
|
|
17675
17687
|
onRequestClose: function onRequestClose() {
|
|
17676
17688
|
onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
17677
17689
|
setOpen(false);
|
|
17678
17690
|
},
|
|
17679
|
-
header: label,
|
|
17691
|
+
header: bottomSheetHeader || label,
|
|
17680
17692
|
style: {
|
|
17681
17693
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0
|
|
17682
17694
|
},
|
package/lib/index.js
CHANGED
|
@@ -9745,16 +9745,24 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
9745
9745
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
9746
9746
|
internalShowDivider = _useState4[0],
|
|
9747
9747
|
setInternalShowDivider = _useState4[1];
|
|
9748
|
-
var canCallOnDismiss = React.useRef(false);
|
|
9749
9748
|
React.useEffect(function () {
|
|
9750
|
-
// Prevent calling onDismiss when the component has not yet opened
|
|
9751
|
-
if (open && !canCallOnDismiss.current) {
|
|
9752
|
-
canCallOnDismiss.current = true;
|
|
9753
|
-
}
|
|
9754
9749
|
// Show the modal before the open animation start
|
|
9755
9750
|
if (open && !visible) {
|
|
9756
9751
|
setVisibility(open);
|
|
9757
9752
|
}
|
|
9753
|
+
// Delay closing the modal until after the closing animation end
|
|
9754
|
+
animatedValue.current.removeAllListeners();
|
|
9755
|
+
animatedValue.current.addListener(function (_ref2) {
|
|
9756
|
+
var value = _ref2.value;
|
|
9757
|
+
var endValueOfTransition = open ? 1 : 0;
|
|
9758
|
+
if (endValueOfTransition === 0 && value === endValueOfTransition) {
|
|
9759
|
+
setVisibility(false);
|
|
9760
|
+
onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
9761
|
+
}
|
|
9762
|
+
});
|
|
9763
|
+
return function () {
|
|
9764
|
+
return animatedValue.current.removeAllListeners();
|
|
9765
|
+
};
|
|
9758
9766
|
}, [open]);
|
|
9759
9767
|
// Animation
|
|
9760
9768
|
React.useEffect(function () {
|
|
@@ -9763,13 +9771,7 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
9763
9771
|
easing: reactNative.Easing.inOut(reactNative.Easing.cubic),
|
|
9764
9772
|
useNativeDriver: true
|
|
9765
9773
|
});
|
|
9766
|
-
animation.start(
|
|
9767
|
-
if (!open && canCallOnDismiss.current) {
|
|
9768
|
-
setVisibility(false);
|
|
9769
|
-
onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
9770
|
-
}
|
|
9771
|
-
onAnimationEnd === null || onAnimationEnd === void 0 || onAnimationEnd();
|
|
9772
|
-
});
|
|
9774
|
+
animation.start(onAnimationEnd);
|
|
9773
9775
|
return function () {
|
|
9774
9776
|
return animation.stop();
|
|
9775
9777
|
};
|
|
@@ -17456,7 +17458,9 @@ function MultiSelect(_ref) {
|
|
|
17456
17458
|
testID = _ref.testID,
|
|
17457
17459
|
value = _ref.value,
|
|
17458
17460
|
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
17459
|
-
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta
|
|
17461
|
+
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
|
|
17462
|
+
_ref$bottomSheetConfi = _ref.bottomSheetConfig,
|
|
17463
|
+
bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi;
|
|
17460
17464
|
var _useKeyboard = useKeyboard(),
|
|
17461
17465
|
isKeyboardVisible = _useKeyboard.isKeyboardVisible,
|
|
17462
17466
|
keyboardHeight = _useKeyboard.keyboardHeight;
|
|
@@ -17477,6 +17481,8 @@ function MultiSelect(_ref) {
|
|
|
17477
17481
|
return opt.text;
|
|
17478
17482
|
}).join(', ');
|
|
17479
17483
|
var rawValue = value.length > 0 ? value.join(', ') : '';
|
|
17484
|
+
var bottomSheetVariant = bottomSheetConfig.variant,
|
|
17485
|
+
bottomSheetHeader = bottomSheetConfig.header;
|
|
17480
17486
|
React.useEffect(function () {
|
|
17481
17487
|
setSelectingValue(value);
|
|
17482
17488
|
}, [open, value]);
|
|
@@ -17504,12 +17510,13 @@ function MultiSelect(_ref) {
|
|
|
17504
17510
|
return renderSelectedValue(value, props);
|
|
17505
17511
|
} : undefined
|
|
17506
17512
|
}))))), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
|
|
17513
|
+
variant: bottomSheetVariant || 'fixed',
|
|
17507
17514
|
open: open,
|
|
17508
17515
|
onRequestClose: function onRequestClose() {
|
|
17509
17516
|
onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
17510
17517
|
setOpen(false);
|
|
17511
17518
|
},
|
|
17512
|
-
header: label,
|
|
17519
|
+
header: bottomSheetHeader || label,
|
|
17513
17520
|
style: {
|
|
17514
17521
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0
|
|
17515
17522
|
},
|
|
@@ -17659,7 +17666,9 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
17659
17666
|
testID = _ref.testID,
|
|
17660
17667
|
value = _ref.value,
|
|
17661
17668
|
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
17662
|
-
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta
|
|
17669
|
+
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
|
|
17670
|
+
_ref$bottomSheetConfi = _ref.bottomSheetConfig,
|
|
17671
|
+
bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi;
|
|
17663
17672
|
var _useKeyboard = useKeyboard(),
|
|
17664
17673
|
isKeyboardVisible = _useKeyboard.isKeyboardVisible,
|
|
17665
17674
|
keyboardHeight = _useKeyboard.keyboardHeight;
|
|
@@ -17674,6 +17683,8 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
17674
17683
|
return value === opt.value;
|
|
17675
17684
|
})) === null || _flatOptions$find === void 0 ? void 0 : _flatOptions$find.text;
|
|
17676
17685
|
var rawValue = value ? String(value) : undefined;
|
|
17686
|
+
var bottomSheetVariant = bottomSheetConfig.variant,
|
|
17687
|
+
bottomSheetHeader = bottomSheetConfig.header;
|
|
17677
17688
|
return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
17678
17689
|
pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
|
|
17679
17690
|
}, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
|
|
@@ -17698,12 +17709,13 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
17698
17709
|
return renderSelectedValue(value, props);
|
|
17699
17710
|
} : undefined
|
|
17700
17711
|
}))))), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
|
|
17712
|
+
variant: bottomSheetVariant || 'fixed',
|
|
17701
17713
|
open: open,
|
|
17702
17714
|
onRequestClose: function onRequestClose() {
|
|
17703
17715
|
onDismiss === null || onDismiss === void 0 || onDismiss();
|
|
17704
17716
|
setOpen(false);
|
|
17705
17717
|
},
|
|
17706
|
-
header: label,
|
|
17718
|
+
header: bottomSheetHeader || label,
|
|
17707
17719
|
style: {
|
|
17708
17720
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0
|
|
17709
17721
|
},
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
StyledWrapper,
|
|
23
23
|
} from './StyledBottomSheet';
|
|
24
24
|
|
|
25
|
-
interface BottomSheetProps {
|
|
25
|
+
export interface BottomSheetProps {
|
|
26
26
|
/**
|
|
27
27
|
* Bottom sheet open state.
|
|
28
28
|
*/
|
|
@@ -115,18 +115,24 @@ const BottomSheet = ({
|
|
|
115
115
|
const animatedValue = useRef(new Animated.Value(open ? 0 : 1));
|
|
116
116
|
const [internalShowDivider, setInternalShowDivider] =
|
|
117
117
|
useState<boolean>(showDivider);
|
|
118
|
-
const canCallOnDismiss = useRef(false);
|
|
119
118
|
|
|
120
119
|
useEffect(() => {
|
|
121
|
-
// Prevent calling onDismiss when the component has not yet opened
|
|
122
|
-
if (open && !canCallOnDismiss.current) {
|
|
123
|
-
canCallOnDismiss.current = true;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
120
|
// Show the modal before the open animation start
|
|
127
121
|
if (open && !visible) {
|
|
128
122
|
setVisibility(open);
|
|
129
123
|
}
|
|
124
|
+
|
|
125
|
+
// Delay closing the modal until after the closing animation end
|
|
126
|
+
animatedValue.current.removeAllListeners();
|
|
127
|
+
animatedValue.current.addListener(({ value }) => {
|
|
128
|
+
const endValueOfTransition = open ? 1 : 0;
|
|
129
|
+
if (endValueOfTransition === 0 && value === endValueOfTransition) {
|
|
130
|
+
setVisibility(false);
|
|
131
|
+
onDismiss?.();
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
return () => animatedValue.current.removeAllListeners();
|
|
130
136
|
}, [open]);
|
|
131
137
|
|
|
132
138
|
// Animation
|
|
@@ -137,14 +143,7 @@ const BottomSheet = ({
|
|
|
137
143
|
useNativeDriver: true,
|
|
138
144
|
});
|
|
139
145
|
|
|
140
|
-
animation.start(
|
|
141
|
-
if (!open && canCallOnDismiss.current) {
|
|
142
|
-
setVisibility(false);
|
|
143
|
-
onDismiss?.();
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
onAnimationEnd?.();
|
|
147
|
-
});
|
|
146
|
+
animation.start(onAnimationEnd);
|
|
148
147
|
|
|
149
148
|
return () => animation.stop();
|
|
150
149
|
}, [open]);
|