@hero-design/rn 8.63.2 → 8.64.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 +1 -1
- package/CHANGELOG.md +15 -0
- package/es/index.js +86 -38
- package/eslint.config.js +42 -0
- package/lib/index.js +86 -38
- package/package.json +9 -5
- package/rollup.config.js +13 -0
- package/sonar-project.properties +1 -1
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
- package/src/components/BottomSheet/__tests__/index.spec.tsx +17 -0
- package/src/components/BottomSheet/index.tsx +6 -0
- package/src/components/Calendar/CalendarRowItem.tsx +3 -1
- package/src/components/Calendar/StyledCalendar.tsx +21 -8
- package/src/components/Calendar/__tests__/CalendarRowItem.spec.tsx +1 -0
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +4 -2
- package/src/components/Calendar/__tests__/index.spec.tsx +7 -1
- package/src/components/Calendar/index.tsx +30 -8
- package/src/components/DatePicker/DatePickerCalendar.tsx +14 -10
- package/src/components/DatePicker/DatePickerIOS.tsx +2 -0
- package/src/components/DatePicker/__tests__/DatePickerCalendar.spec.tsx +37 -0
- package/src/components/DatePicker/__tests__/DatePickerIOS.spec.tsx +34 -0
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +5 -0
- package/src/components/DatePicker/types.ts +4 -0
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +5 -0
- package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +45 -24
- package/src/components/FAB/ActionGroup/index.tsx +6 -0
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +20 -0
- package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +28 -0
- package/src/components/Select/MultiSelect/index.tsx +6 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +15 -0
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +25 -0
- package/src/components/Select/SingleSelect/index.tsx +6 -0
- package/src/components/TimePicker/TimePickerIOS.tsx +2 -0
- package/src/components/TimePicker/__tests__/TimePickerIOS.spec.tsx +31 -0
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +5 -0
- package/src/components/TimePicker/types.ts +4 -0
- package/src/components/Toast/Toast.tsx +1 -0
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +7 -0
- package/src/testHelpers/utils.ts +21 -0
- package/stats/8.63.3/rn-stats.html +4844 -0
- package/stats/8.64.0/rn-stats.html +4842 -0
- package/types/components/BottomSheet/index.d.ts +5 -1
- package/types/components/Calendar/CalendarRowItem.d.ts +2 -1
- package/types/components/Calendar/StyledCalendar.d.ts +7 -0
- package/types/components/DatePicker/DatePickerCalendar.d.ts +1 -1
- package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
- package/types/components/DatePicker/types.d.ts +4 -0
- package/types/components/FAB/ActionGroup/index.d.ts +4 -0
- package/types/components/Select/MultiSelect/index.d.ts +5 -1
- package/types/components/Select/SingleSelect/index.d.ts +5 -1
- package/types/components/Select/index.d.ts +1 -1
- package/types/components/TimePicker/TimePickerIOS.d.ts +1 -1
- package/types/components/TimePicker/types.d.ts +4 -0
- package/types/testHelpers/utils.d.ts +1 -0
- package/.eslintrc.js +0 -13
- package/src/theme/components/.eslintrc.json +0 -10
package/lib/index.js
CHANGED
|
@@ -9232,7 +9232,9 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
9232
9232
|
style = _ref.style,
|
|
9233
9233
|
testID = _ref.testID,
|
|
9234
9234
|
_ref$keyboardAvoiding = _ref.keyboardAvoidingViewProps,
|
|
9235
|
-
keyboardAvoidingViewProps = _ref$keyboardAvoiding === void 0 ? {} : _ref$keyboardAvoiding
|
|
9235
|
+
keyboardAvoidingViewProps = _ref$keyboardAvoiding === void 0 ? {} : _ref$keyboardAvoiding,
|
|
9236
|
+
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
9237
|
+
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta;
|
|
9236
9238
|
var _Dimensions$get = reactNative.Dimensions.get('window'),
|
|
9237
9239
|
height = _Dimensions$get.height;
|
|
9238
9240
|
// Internal state to control modal open/close timing with animation
|
|
@@ -9295,7 +9297,8 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
9295
9297
|
onRequestClose: onRequestClose,
|
|
9296
9298
|
transparent: true,
|
|
9297
9299
|
testID: testID,
|
|
9298
|
-
onShow: onOpen
|
|
9300
|
+
onShow: onOpen,
|
|
9301
|
+
supportedOrientations: supportedOrientations
|
|
9299
9302
|
}, /*#__PURE__*/React__default["default"].createElement(StyledWrapper$9, {
|
|
9300
9303
|
pointerEvents: "box-none"
|
|
9301
9304
|
}, /*#__PURE__*/React__default["default"].createElement(StyledKeyboardAvoidingView, _extends$1({
|
|
@@ -11666,9 +11669,10 @@ var StyledCalendarHeader = index$9(reactNative.View)(function (_ref2) {
|
|
|
11666
11669
|
};
|
|
11667
11670
|
});
|
|
11668
11671
|
var StyledCalendarDayNameCell = index$9(reactNative.View)(function (_ref3) {
|
|
11669
|
-
var theme = _ref3.theme
|
|
11672
|
+
var theme = _ref3.theme,
|
|
11673
|
+
themeItemWidth = _ref3.themeItemWidth;
|
|
11670
11674
|
return {
|
|
11671
|
-
width: theme.__hd__.calendar.sizes.cellWidth,
|
|
11675
|
+
width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
|
|
11672
11676
|
height: theme.__hd__.calendar.sizes.cellHeight,
|
|
11673
11677
|
alignItems: 'center',
|
|
11674
11678
|
justifyContent: 'center'
|
|
@@ -11677,7 +11681,8 @@ var StyledCalendarDayNameCell = index$9(reactNative.View)(function (_ref3) {
|
|
|
11677
11681
|
var StyledCalendarCell = index$9(reactNative.TouchableOpacity)(function (_ref4) {
|
|
11678
11682
|
var theme = _ref4.theme,
|
|
11679
11683
|
_ref4$variant = _ref4.variant,
|
|
11680
|
-
variant = _ref4$variant === void 0 ? 'default' : _ref4$variant
|
|
11684
|
+
variant = _ref4$variant === void 0 ? 'default' : _ref4$variant,
|
|
11685
|
+
themeItemWidth = _ref4.themeItemWidth;
|
|
11681
11686
|
return {
|
|
11682
11687
|
borderColor: theme.__hd__.calendar.colors.border,
|
|
11683
11688
|
borderWidth: variant === 'current' ? 1 : 0,
|
|
@@ -11685,7 +11690,7 @@ var StyledCalendarCell = index$9(reactNative.TouchableOpacity)(function (_ref4)
|
|
|
11685
11690
|
alignItems: 'center',
|
|
11686
11691
|
justifyContent: 'center',
|
|
11687
11692
|
backgroundColor: variant === 'selected' ? theme.__hd__.calendar.colors.primary : undefined,
|
|
11688
|
-
width: theme.__hd__.calendar.sizes.cellCircleWidth,
|
|
11693
|
+
width: themeItemWidth || theme.__hd__.calendar.sizes.cellCircleWidth,
|
|
11689
11694
|
height: theme.__hd__.calendar.sizes.cellCircleHeight
|
|
11690
11695
|
};
|
|
11691
11696
|
});
|
|
@@ -11698,21 +11703,23 @@ var StyledCalendarRow = index$9(reactNative.View)(function (_ref5) {
|
|
|
11698
11703
|
};
|
|
11699
11704
|
});
|
|
11700
11705
|
var StyledCalendarRowItem = index$9(reactNative.View)(function (_ref6) {
|
|
11701
|
-
var theme = _ref6.theme
|
|
11706
|
+
var theme = _ref6.theme,
|
|
11707
|
+
themeItemWidth = _ref6.themeItemWidth;
|
|
11702
11708
|
return {
|
|
11703
11709
|
flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
|
|
11704
11710
|
alignItems: 'center',
|
|
11705
|
-
width: theme.__hd__.calendar.sizes.cellWidth,
|
|
11711
|
+
width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
|
|
11706
11712
|
height: theme.__hd__.calendar.sizes.cellHeight,
|
|
11707
11713
|
justifyContent: 'center'
|
|
11708
11714
|
};
|
|
11709
11715
|
});
|
|
11710
11716
|
var StyledDisabledCalendarRowItem = index$9(reactNative.View)(function (_ref7) {
|
|
11711
|
-
var theme = _ref7.theme
|
|
11717
|
+
var theme = _ref7.theme,
|
|
11718
|
+
themeItemWidth = _ref7.themeItemWidth;
|
|
11712
11719
|
return {
|
|
11713
11720
|
flexBasis: "".concat(Math.floor(100.0 / 7.0), "%"),
|
|
11714
11721
|
alignItems: 'center',
|
|
11715
|
-
width: theme.__hd__.calendar.sizes.cellWidth,
|
|
11722
|
+
width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
|
|
11716
11723
|
height: theme.__hd__.calendar.sizes.cellHeight
|
|
11717
11724
|
};
|
|
11718
11725
|
});
|
|
@@ -11745,9 +11752,11 @@ var CalendarRowItem = function CalendarRowItem(_ref) {
|
|
|
11745
11752
|
_ref$textIntent = _ref.textIntent,
|
|
11746
11753
|
textIntent = _ref$textIntent === void 0 ? 'body' : _ref$textIntent,
|
|
11747
11754
|
_ref$marked = _ref.marked,
|
|
11748
|
-
marked = _ref$marked === void 0 ? false : _ref$marked
|
|
11755
|
+
marked = _ref$marked === void 0 ? false : _ref$marked,
|
|
11756
|
+
itemWidth = _ref.itemWidth;
|
|
11749
11757
|
return /*#__PURE__*/React__default["default"].createElement(StyledCalendarRowItem, {
|
|
11750
|
-
testID: "calendar-date-cell"
|
|
11758
|
+
testID: "calendar-date-cell",
|
|
11759
|
+
themeItemWidth: itemWidth
|
|
11751
11760
|
}, /*#__PURE__*/React__default["default"].createElement(StyledCalendarCell, {
|
|
11752
11761
|
variant: getCellVariant(isSelected, isCurrent),
|
|
11753
11762
|
onPress: onPress
|
|
@@ -11819,14 +11828,21 @@ var Calendar = function Calendar(_ref) {
|
|
|
11819
11828
|
var parsedMaskedDate = markedDates.reduce(function (current, markedDate) {
|
|
11820
11829
|
return _objectSpread2(_objectSpread2({}, current), {}, _defineProperty({}, markedDate.toDateString(), true));
|
|
11821
11830
|
}, {});
|
|
11822
|
-
var
|
|
11823
|
-
|
|
11824
|
-
monthPickerVisible =
|
|
11825
|
-
setMonthPickerVisible =
|
|
11826
|
-
var
|
|
11827
|
-
|
|
11828
|
-
contentHeight =
|
|
11829
|
-
setContentHeight =
|
|
11831
|
+
var _useState = React.useState(false),
|
|
11832
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
11833
|
+
monthPickerVisible = _useState2[0],
|
|
11834
|
+
setMonthPickerVisible = _useState2[1];
|
|
11835
|
+
var _useState3 = React.useState(0),
|
|
11836
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
11837
|
+
contentHeight = _useState4[0],
|
|
11838
|
+
setContentHeight = _useState4[1];
|
|
11839
|
+
var _useState5 = React.useState(0),
|
|
11840
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
11841
|
+
contentWidth = _useState6[0],
|
|
11842
|
+
setContentWidth = _useState6[1];
|
|
11843
|
+
var calendarItemWidth = React.useMemo(function () {
|
|
11844
|
+
return contentWidth > 0 ? contentWidth / 7 : undefined;
|
|
11845
|
+
}, [contentWidth]);
|
|
11830
11846
|
var useMonthPicker = onMonthChange !== noop$1;
|
|
11831
11847
|
var firstDateOfMonth = new Date(currentYear, currentMonth, 1);
|
|
11832
11848
|
var lastDateOfMonth = new Date(currentYear, currentMonth + 1, 0);
|
|
@@ -11892,16 +11908,23 @@ var Calendar = function Calendar(_ref) {
|
|
|
11892
11908
|
onChange: onMonthChange,
|
|
11893
11909
|
style: {
|
|
11894
11910
|
height: contentHeight + theme.__hd__.calendar.space.iosPickerMarginVertical * 2,
|
|
11895
|
-
marginVertical: -theme.__hd__.calendar.space.iosPickerMarginVertical
|
|
11911
|
+
marginVertical: -theme.__hd__.calendar.space.iosPickerMarginVertical,
|
|
11912
|
+
width: contentWidth
|
|
11896
11913
|
}
|
|
11897
11914
|
})) : /*#__PURE__*/React__default["default"].createElement(Box, {
|
|
11898
11915
|
onLayout: reactNative.Platform.OS === 'ios' ? function (e) {
|
|
11899
|
-
|
|
11916
|
+
var _e$nativeEvent$layout = e.nativeEvent.layout,
|
|
11917
|
+
width = _e$nativeEvent$layout.width,
|
|
11918
|
+
height = _e$nativeEvent$layout.height;
|
|
11919
|
+
setContentHeight(height);
|
|
11920
|
+
setContentWidth(width);
|
|
11900
11921
|
} : undefined
|
|
11901
11922
|
}, /*#__PURE__*/React__default["default"].createElement(StyledCalendarRow, null, DAYS_OF_WEEK.map(function (day) {
|
|
11902
11923
|
return /*#__PURE__*/React__default["default"].createElement(StyledCalendarRowItem, {
|
|
11903
11924
|
key: day
|
|
11904
|
-
}, /*#__PURE__*/React__default["default"].createElement(StyledCalendarDayNameCell,
|
|
11925
|
+
}, /*#__PURE__*/React__default["default"].createElement(StyledCalendarDayNameCell, {
|
|
11926
|
+
themeItemWidth: calendarItemWidth
|
|
11927
|
+
}, /*#__PURE__*/React__default["default"].createElement(Typography.Body, {
|
|
11905
11928
|
variant: "small"
|
|
11906
11929
|
}, day)));
|
|
11907
11930
|
})), /*#__PURE__*/React__default["default"].createElement(StyledCalendarRow, null, daysOfPreviousMonth.map(function (date) {
|
|
@@ -11914,12 +11937,15 @@ var Calendar = function Calendar(_ref) {
|
|
|
11914
11937
|
return onChange === null || onChange === void 0 ? void 0 : onChange(date);
|
|
11915
11938
|
},
|
|
11916
11939
|
textIntent: "subdued",
|
|
11917
|
-
marked: parsedMaskedDate[date.toDateString()]
|
|
11940
|
+
marked: parsedMaskedDate[date.toDateString()],
|
|
11941
|
+
itemWidth: contentWidth > 0 ? contentWidth / 7 : undefined
|
|
11918
11942
|
}) : /*#__PURE__*/React__default["default"].createElement(StyledDisabledCalendarRowItem, {
|
|
11943
|
+
themeItemWidth: calendarItemWidth,
|
|
11919
11944
|
testID: "calendar-disabled-cell"
|
|
11920
11945
|
});
|
|
11921
11946
|
}), daysOfCurrentMonth.map(function (date) {
|
|
11922
11947
|
return date ? /*#__PURE__*/React__default["default"].createElement(CalendarRowItem, {
|
|
11948
|
+
itemWidth: calendarItemWidth,
|
|
11923
11949
|
key: date.toDateString(),
|
|
11924
11950
|
date: date,
|
|
11925
11951
|
isCurrent: isEqDate(now, date),
|
|
@@ -11929,10 +11955,12 @@ var Calendar = function Calendar(_ref) {
|
|
|
11929
11955
|
},
|
|
11930
11956
|
marked: parsedMaskedDate[date.toDateString()]
|
|
11931
11957
|
}) : /*#__PURE__*/React__default["default"].createElement(StyledDisabledCalendarRowItem, {
|
|
11958
|
+
themeItemWidth: calendarItemWidth,
|
|
11932
11959
|
testID: "calendar-disabled-cell"
|
|
11933
11960
|
});
|
|
11934
11961
|
}), daysOfNextMonth.map(function (date) {
|
|
11935
11962
|
return date ? /*#__PURE__*/React__default["default"].createElement(CalendarRowItem, {
|
|
11963
|
+
itemWidth: calendarItemWidth,
|
|
11936
11964
|
key: date.toDateString(),
|
|
11937
11965
|
date: date,
|
|
11938
11966
|
isCurrent: isEqDate(now, date),
|
|
@@ -11943,6 +11971,7 @@ var Calendar = function Calendar(_ref) {
|
|
|
11943
11971
|
textIntent: "subdued",
|
|
11944
11972
|
marked: parsedMaskedDate[date.toDateString()]
|
|
11945
11973
|
}) : /*#__PURE__*/React__default["default"].createElement(StyledDisabledCalendarRowItem, {
|
|
11974
|
+
themeItemWidth: calendarItemWidth,
|
|
11946
11975
|
testID: "calendar-disabled-cell"
|
|
11947
11976
|
});
|
|
11948
11977
|
})), reactNative.Platform.OS === 'android' && monthPickerVisible && /*#__PURE__*/React__default["default"].createElement(reactNativeMonthYearPicker.MonthYearPickerDialogueAndroid, {
|
|
@@ -13390,7 +13419,9 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
|
|
|
13390
13419
|
style = _ref2.style,
|
|
13391
13420
|
testID = _ref2.testID,
|
|
13392
13421
|
monthPickerConfirmLabel = _ref2.monthPickerConfirmLabel,
|
|
13393
|
-
monthPickerCancelLabel = _ref2.monthPickerCancelLabel
|
|
13422
|
+
monthPickerCancelLabel = _ref2.monthPickerCancelLabel,
|
|
13423
|
+
_ref2$supportedOrient = _ref2.supportedOrientations,
|
|
13424
|
+
supportedOrientations = _ref2$supportedOrient === void 0 ? ['portrait'] : _ref2$supportedOrient;
|
|
13394
13425
|
var _useState5 = React.useState(false),
|
|
13395
13426
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
13396
13427
|
open = _useState6[0],
|
|
@@ -13445,8 +13476,9 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
|
|
|
13445
13476
|
}
|
|
13446
13477
|
setOpen(false);
|
|
13447
13478
|
}
|
|
13448
|
-
})
|
|
13449
|
-
|
|
13479
|
+
}),
|
|
13480
|
+
supportedOrientations: supportedOrientations
|
|
13481
|
+
}, /*#__PURE__*/React__default["default"].createElement(reactNative.ScrollView, null, /*#__PURE__*/React__default["default"].createElement(InternalCalendar, {
|
|
13450
13482
|
minDate: minDate,
|
|
13451
13483
|
maxDate: maxDate,
|
|
13452
13484
|
value: value,
|
|
@@ -13456,7 +13488,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
|
|
|
13456
13488
|
onToggleMonthPicker: function onToggleMonthPicker(visible) {
|
|
13457
13489
|
return setMonthPickerVisible(visible);
|
|
13458
13490
|
}
|
|
13459
|
-
})));
|
|
13491
|
+
}))));
|
|
13460
13492
|
};
|
|
13461
13493
|
|
|
13462
13494
|
var StyledPickerWrapper$1 = index$9(reactNative.View)(function (_ref) {
|
|
@@ -13482,7 +13514,9 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
13482
13514
|
error = _ref.error,
|
|
13483
13515
|
helpText = _ref.helpText,
|
|
13484
13516
|
style = _ref.style,
|
|
13485
|
-
testID = _ref.testID
|
|
13517
|
+
testID = _ref.testID,
|
|
13518
|
+
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
13519
|
+
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta;
|
|
13486
13520
|
var _useState = React.useState(getDateValue(value || new Date(), minDate, maxDate)),
|
|
13487
13521
|
_useState2 = _slicedToArray(_useState, 2),
|
|
13488
13522
|
selectingDate = _useState2[0],
|
|
@@ -13533,7 +13567,8 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
|
|
|
13533
13567
|
}
|
|
13534
13568
|
setOpen(false);
|
|
13535
13569
|
}
|
|
13536
|
-
})
|
|
13570
|
+
}),
|
|
13571
|
+
supportedOrientations: supportedOrientations
|
|
13537
13572
|
}, /*#__PURE__*/React__default["default"].createElement(StyledPickerWrapper$1, null, /*#__PURE__*/React__default["default"].createElement(DateTimePicker__default["default"], {
|
|
13538
13573
|
testID: "datePickerIOS",
|
|
13539
13574
|
value: selectingDate,
|
|
@@ -14811,7 +14846,9 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
14811
14846
|
fabTitle = _ref.fabTitle,
|
|
14812
14847
|
onBackdropPress = _ref.onBackdropPress,
|
|
14813
14848
|
_ref$fabIcon = _ref.fabIcon,
|
|
14814
|
-
fabIcon = _ref$fabIcon === void 0 ? 'add' : _ref$fabIcon
|
|
14849
|
+
fabIcon = _ref$fabIcon === void 0 ? 'add' : _ref$fabIcon,
|
|
14850
|
+
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
14851
|
+
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta;
|
|
14815
14852
|
useDeprecation("FAB.ActionGroup's headerTitle prop will be removed in the next major release. Please remove it.", headerTitle !== undefined);
|
|
14816
14853
|
var theme = useTheme();
|
|
14817
14854
|
var fabRef = React.useRef(null);
|
|
@@ -14867,7 +14904,8 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
|
|
|
14867
14904
|
visible: active,
|
|
14868
14905
|
animationType: "fade",
|
|
14869
14906
|
transparent: true,
|
|
14870
|
-
statusBarTranslucent: true
|
|
14907
|
+
statusBarTranslucent: true,
|
|
14908
|
+
supportedOrientations: supportedOrientations
|
|
14871
14909
|
}, /*#__PURE__*/React__default["default"].createElement(StyledContainerInModal, {
|
|
14872
14910
|
testID: testID,
|
|
14873
14911
|
style: [style]
|
|
@@ -15070,6 +15108,7 @@ var Toast$1 = function Toast(_ref2) {
|
|
|
15070
15108
|
outputRange: toastConfig.position === 'top' ? [-20, distance] : [20, -distance]
|
|
15071
15109
|
});
|
|
15072
15110
|
return /*#__PURE__*/React__default["default"].createElement(Container, {
|
|
15111
|
+
testID: "toast-container",
|
|
15073
15112
|
themeVariant: variant,
|
|
15074
15113
|
themeIntent: intent,
|
|
15075
15114
|
style: [style, {
|
|
@@ -16628,7 +16667,9 @@ function MultiSelect(_ref) {
|
|
|
16628
16667
|
required = _ref.required,
|
|
16629
16668
|
style = _ref.style,
|
|
16630
16669
|
testID = _ref.testID,
|
|
16631
|
-
value = _ref.value
|
|
16670
|
+
value = _ref.value,
|
|
16671
|
+
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
16672
|
+
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta;
|
|
16632
16673
|
var _useKeyboard = useKeyboard(),
|
|
16633
16674
|
isKeyboardVisible = _useKeyboard.isKeyboardVisible,
|
|
16634
16675
|
keyboardHeight = _useKeyboard.keyboardHeight;
|
|
@@ -16707,7 +16748,8 @@ function MultiSelect(_ref) {
|
|
|
16707
16748
|
var scrollParams = getScrollParams(value === null || value === void 0 ? void 0 : value[0], sections);
|
|
16708
16749
|
(_sectionListRef$curre = sectionListRef.current) === null || _sectionListRef$curre === void 0 || _sectionListRef$curre.scrollToLocation(scrollParams);
|
|
16709
16750
|
}
|
|
16710
|
-
}
|
|
16751
|
+
},
|
|
16752
|
+
supportedOrientations: supportedOrientations
|
|
16711
16753
|
}, onQueryChange && /*#__PURE__*/React__default["default"].createElement(StyledSearchBar, null, /*#__PURE__*/React__default["default"].createElement(TextInput, {
|
|
16712
16754
|
editable: true,
|
|
16713
16755
|
placeholder: "Search",
|
|
@@ -16828,7 +16870,9 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
16828
16870
|
required = _ref.required,
|
|
16829
16871
|
style = _ref.style,
|
|
16830
16872
|
testID = _ref.testID,
|
|
16831
|
-
value = _ref.value
|
|
16873
|
+
value = _ref.value,
|
|
16874
|
+
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
16875
|
+
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta;
|
|
16832
16876
|
var _useKeyboard = useKeyboard(),
|
|
16833
16877
|
isKeyboardVisible = _useKeyboard.isKeyboardVisible,
|
|
16834
16878
|
keyboardHeight = _useKeyboard.keyboardHeight;
|
|
@@ -16882,7 +16926,8 @@ var SingleSelect = function SingleSelect(_ref) {
|
|
|
16882
16926
|
var scrollParams = getScrollParams(value, sections);
|
|
16883
16927
|
(_sectionListRef$curre = sectionListRef.current) === null || _sectionListRef$curre === void 0 || _sectionListRef$curre.scrollToLocation(scrollParams);
|
|
16884
16928
|
}
|
|
16885
|
-
}
|
|
16929
|
+
},
|
|
16930
|
+
supportedOrientations: supportedOrientations
|
|
16886
16931
|
}, onQueryChange && /*#__PURE__*/React__default["default"].createElement(StyledSearchBar, null, /*#__PURE__*/React__default["default"].createElement(TextInput, {
|
|
16887
16932
|
editable: true,
|
|
16888
16933
|
placeholder: "Search",
|
|
@@ -18229,7 +18274,9 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
|
|
|
18229
18274
|
style = _ref.style,
|
|
18230
18275
|
testID = _ref.testID,
|
|
18231
18276
|
_ref$showSuffix = _ref.showSuffix,
|
|
18232
|
-
showSuffix = _ref$showSuffix === void 0 ? true : _ref$showSuffix
|
|
18277
|
+
showSuffix = _ref$showSuffix === void 0 ? true : _ref$showSuffix,
|
|
18278
|
+
_ref$supportedOrienta = _ref.supportedOrientations,
|
|
18279
|
+
supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta;
|
|
18233
18280
|
var _useState = React.useState(value || new Date()),
|
|
18234
18281
|
_useState2 = _slicedToArray(_useState, 2),
|
|
18235
18282
|
selectingDate = _useState2[0],
|
|
@@ -18275,7 +18322,8 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
|
|
|
18275
18322
|
}
|
|
18276
18323
|
setOpen(false);
|
|
18277
18324
|
}
|
|
18278
|
-
})
|
|
18325
|
+
}),
|
|
18326
|
+
supportedOrientations: supportedOrientations
|
|
18279
18327
|
}, /*#__PURE__*/React__default["default"].createElement(StyledPickerWrapper, null, /*#__PURE__*/React__default["default"].createElement(DateTimePicker__default["default"], {
|
|
18280
18328
|
testID: "timePickerIOS",
|
|
18281
18329
|
value: selectingDate,
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.64.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
7
7
|
"types": "types/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"lint": "eslint src
|
|
9
|
+
"lint": "eslint src",
|
|
10
10
|
"type-check": "tsc --noEmit",
|
|
11
11
|
"test": "jest --runInBand",
|
|
12
12
|
"test:watch": "jest --runInBand --watch",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"nanoid": "^4.0.2"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@hero-design/react-native-month-year-picker": "^8.42.
|
|
31
|
+
"@hero-design/react-native-month-year-picker": "^8.42.10",
|
|
32
32
|
"@react-native-community/datetimepicker": "^3.5.2 || ^7.6.1",
|
|
33
33
|
"@react-native-community/slider": "^4.5.1",
|
|
34
34
|
"react": "18.2.0",
|
|
@@ -47,8 +47,11 @@
|
|
|
47
47
|
"@babel/preset-typescript": "^7.20.0",
|
|
48
48
|
"@babel/runtime": "^7.20.0",
|
|
49
49
|
"@emotion/jest": "^11.11.0",
|
|
50
|
-
"@
|
|
51
|
-
"@
|
|
50
|
+
"@eslint/compat": "^1.1.1",
|
|
51
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
52
|
+
"@eslint/js": "^9.8.0",
|
|
53
|
+
"@hero-design/eslint-plugin": "9.0.1",
|
|
54
|
+
"@hero-design/react-native-month-year-picker": "^8.42.10",
|
|
52
55
|
"@react-native-community/datetimepicker": "7.6.1",
|
|
53
56
|
"@react-native-community/slider": "^4.5.1",
|
|
54
57
|
"@rollup/plugin-babel": "^5.3.1",
|
|
@@ -86,6 +89,7 @@
|
|
|
86
89
|
"rollup": "^2.68.0",
|
|
87
90
|
"rollup-plugin-copy": "^3.4.0",
|
|
88
91
|
"rollup-plugin-flow": "^1.1.1",
|
|
92
|
+
"rollup-plugin-visualizer": "^5.12.0",
|
|
89
93
|
"ts-jest": "^29.1.1",
|
|
90
94
|
"typescript": "4.8.4"
|
|
91
95
|
},
|
package/rollup.config.js
CHANGED
|
@@ -6,11 +6,16 @@ import json from '@rollup/plugin-json';
|
|
|
6
6
|
import replace from '@rollup/plugin-replace';
|
|
7
7
|
import copy from 'rollup-plugin-copy';
|
|
8
8
|
import flow from 'rollup-plugin-flow';
|
|
9
|
+
import { visualizer } from 'rollup-plugin-visualizer';
|
|
9
10
|
|
|
10
11
|
import pkg from './package.json';
|
|
11
12
|
|
|
12
13
|
const extensions = ['.js', '.jsx', '.ts', '.tsx'];
|
|
13
14
|
|
|
15
|
+
const generateBuildStats = process.env.GENERATE_BUILD_STATS === 'true';
|
|
16
|
+
const bundleTemplate = process.env.BUNDLE_TEMPLATE || 'treemap';
|
|
17
|
+
const fileName = process.env.FILE_NAME || `stats/${pkg.version}/rn-stats.html`;
|
|
18
|
+
|
|
14
19
|
export default {
|
|
15
20
|
input: 'src/index.ts',
|
|
16
21
|
output: [
|
|
@@ -54,5 +59,13 @@ export default {
|
|
|
54
59
|
},
|
|
55
60
|
],
|
|
56
61
|
}),
|
|
62
|
+
...(generateBuildStats
|
|
63
|
+
? [
|
|
64
|
+
visualizer({
|
|
65
|
+
filename: fileName,
|
|
66
|
+
template: bundleTemplate,
|
|
67
|
+
}),
|
|
68
|
+
]
|
|
69
|
+
: []),
|
|
57
70
|
],
|
|
58
71
|
};
|
package/sonar-project.properties
CHANGED
|
@@ -6,6 +6,6 @@ sonar.organization=thinkei
|
|
|
6
6
|
|
|
7
7
|
sonar.sources=.
|
|
8
8
|
sonar.inclusions=**/*
|
|
9
|
-
sonar.exclusions=**/__tests__/**,**/public
|
|
9
|
+
sonar.exclusions=**/__tests__/**,**/public/**,**/stats/**,**.config.js
|
|
10
10
|
sonar.java.binaries=**/src/main/java
|
|
11
11
|
sonar.javascript.lcov.reportPaths=./coverage/lcov.info
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { Button, Text } from 'react-native';
|
|
4
4
|
import BottomSheet from '..';
|
|
5
5
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
6
|
+
import { setOrientation } from '../../../testHelpers/utils';
|
|
6
7
|
|
|
7
8
|
const Content = () => <Text>Content</Text>;
|
|
8
9
|
|
|
@@ -57,6 +58,22 @@ describe('BottomSheet', () => {
|
|
|
57
58
|
expect(toJSON()).toMatchSnapshot();
|
|
58
59
|
});
|
|
59
60
|
|
|
61
|
+
it('renders correctly in landscape mode', () => {
|
|
62
|
+
const { getByText } = renderWithTheme(
|
|
63
|
+
<BottomSheet
|
|
64
|
+
open
|
|
65
|
+
header="Title"
|
|
66
|
+
onRequestClose={jest.fn()}
|
|
67
|
+
supportedOrientations={['landscape', 'portrait']}
|
|
68
|
+
>
|
|
69
|
+
<Content />
|
|
70
|
+
</BottomSheet>
|
|
71
|
+
);
|
|
72
|
+
setOrientation('landscape');
|
|
73
|
+
expect(getByText('Title')).toBeDefined();
|
|
74
|
+
expect(getByText('Content')).toBeDefined();
|
|
75
|
+
});
|
|
76
|
+
|
|
60
77
|
describe('Header', () => {
|
|
61
78
|
it('renders default header correctly', () => {
|
|
62
79
|
const { getByText } = renderWithTheme(
|
|
@@ -78,6 +78,10 @@ interface BottomSheetProps {
|
|
|
78
78
|
* keyboardAvoidingView's props
|
|
79
79
|
* */
|
|
80
80
|
keyboardAvoidingViewProps?: KeyboardAvoidingViewProps;
|
|
81
|
+
/**
|
|
82
|
+
* Supported orientations for the BottomSheet modal, iOS only.
|
|
83
|
+
*/
|
|
84
|
+
supportedOrientations?: ('portrait' | 'landscape')[];
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
const BottomSheet = ({
|
|
@@ -95,6 +99,7 @@ const BottomSheet = ({
|
|
|
95
99
|
style,
|
|
96
100
|
testID,
|
|
97
101
|
keyboardAvoidingViewProps = {},
|
|
102
|
+
supportedOrientations = ['portrait'],
|
|
98
103
|
}: BottomSheetProps): JSX.Element => {
|
|
99
104
|
const { height } = Dimensions.get('window');
|
|
100
105
|
|
|
@@ -161,6 +166,7 @@ const BottomSheet = ({
|
|
|
161
166
|
transparent
|
|
162
167
|
testID={testID}
|
|
163
168
|
onShow={onOpen}
|
|
169
|
+
supportedOrientations={supportedOrientations}
|
|
164
170
|
>
|
|
165
171
|
<StyledWrapper pointerEvents="box-none">
|
|
166
172
|
<StyledKeyboardAvoidingView
|
|
@@ -20,6 +20,7 @@ export interface CalendarRowItemProps {
|
|
|
20
20
|
isSelected?: boolean;
|
|
21
21
|
textIntent?: 'body' | 'subdued';
|
|
22
22
|
marked?: boolean;
|
|
23
|
+
itemWidth?: number;
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
const CalendarRowItem = ({
|
|
@@ -29,8 +30,9 @@ const CalendarRowItem = ({
|
|
|
29
30
|
isSelected,
|
|
30
31
|
textIntent = 'body',
|
|
31
32
|
marked = false,
|
|
33
|
+
itemWidth,
|
|
32
34
|
}: CalendarRowItemProps) => (
|
|
33
|
-
<StyledCalendarRowItem testID="calendar-date-cell">
|
|
35
|
+
<StyledCalendarRowItem testID="calendar-date-cell" themeItemWidth={itemWidth}>
|
|
34
36
|
<StyledCalendarCell
|
|
35
37
|
variant={getCellVariant(isSelected, isCurrent)}
|
|
36
38
|
onPress={onPress}
|
|
@@ -12,8 +12,12 @@ const StyledCalendarHeader = styled(View)(({ theme }) => ({
|
|
|
12
12
|
paddingVertical: theme.__hd__.calendar.space.headerVerticalPadding,
|
|
13
13
|
}));
|
|
14
14
|
|
|
15
|
-
const StyledCalendarDayNameCell = styled(View)<
|
|
16
|
-
|
|
15
|
+
const StyledCalendarDayNameCell = styled(View)<
|
|
16
|
+
ViewProps & {
|
|
17
|
+
themeItemWidth?: number;
|
|
18
|
+
}
|
|
19
|
+
>(({ theme, themeItemWidth }) => ({
|
|
20
|
+
width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
|
|
17
21
|
height: theme.__hd__.calendar.sizes.cellHeight,
|
|
18
22
|
alignItems: 'center',
|
|
19
23
|
justifyContent: 'center',
|
|
@@ -21,7 +25,8 @@ const StyledCalendarDayNameCell = styled(View)<ViewProps>(({ theme }) => ({
|
|
|
21
25
|
|
|
22
26
|
const StyledCalendarCell = styled(TouchableOpacity)<{
|
|
23
27
|
variant?: 'default' | 'current' | 'selected';
|
|
24
|
-
|
|
28
|
+
themeItemWidth?: number;
|
|
29
|
+
}>(({ theme, variant = 'default', themeItemWidth }) => ({
|
|
25
30
|
borderColor: theme.__hd__.calendar.colors.border,
|
|
26
31
|
borderWidth: variant === 'current' ? 1 : 0,
|
|
27
32
|
borderRadius: theme.__hd__.calendar.radii.default,
|
|
@@ -29,7 +34,7 @@ const StyledCalendarCell = styled(TouchableOpacity)<{
|
|
|
29
34
|
justifyContent: 'center',
|
|
30
35
|
backgroundColor:
|
|
31
36
|
variant === 'selected' ? theme.__hd__.calendar.colors.primary : undefined,
|
|
32
|
-
width: theme.__hd__.calendar.sizes.cellCircleWidth,
|
|
37
|
+
width: themeItemWidth || theme.__hd__.calendar.sizes.cellCircleWidth,
|
|
33
38
|
height: theme.__hd__.calendar.sizes.cellCircleHeight,
|
|
34
39
|
}));
|
|
35
40
|
|
|
@@ -39,18 +44,26 @@ const StyledCalendarRow = styled(View)<ViewProps>(({ theme }) => ({
|
|
|
39
44
|
flexWrap: 'wrap',
|
|
40
45
|
}));
|
|
41
46
|
|
|
42
|
-
const StyledCalendarRowItem = styled(View)<
|
|
47
|
+
const StyledCalendarRowItem = styled(View)<
|
|
48
|
+
ViewProps & {
|
|
49
|
+
themeItemWidth?: number;
|
|
50
|
+
}
|
|
51
|
+
>(({ theme, themeItemWidth }) => ({
|
|
43
52
|
flexBasis: `${Math.floor(100.0 / 7.0)}%`,
|
|
44
53
|
alignItems: 'center',
|
|
45
|
-
width: theme.__hd__.calendar.sizes.cellWidth,
|
|
54
|
+
width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
|
|
46
55
|
height: theme.__hd__.calendar.sizes.cellHeight,
|
|
47
56
|
justifyContent: 'center',
|
|
48
57
|
}));
|
|
49
58
|
|
|
50
|
-
const StyledDisabledCalendarRowItem = styled(View)<
|
|
59
|
+
const StyledDisabledCalendarRowItem = styled(View)<
|
|
60
|
+
ViewProps & {
|
|
61
|
+
themeItemWidth?: number;
|
|
62
|
+
}
|
|
63
|
+
>(({ theme, themeItemWidth }) => ({
|
|
51
64
|
flexBasis: `${Math.floor(100.0 / 7.0)}%`,
|
|
52
65
|
alignItems: 'center',
|
|
53
|
-
width: theme.__hd__.calendar.sizes.cellWidth,
|
|
66
|
+
width: themeItemWidth || theme.__hd__.calendar.sizes.cellWidth,
|
|
54
67
|
height: theme.__hd__.calendar.sizes.cellHeight,
|
|
55
68
|
}));
|
|
56
69
|
|
|
@@ -16,12 +16,13 @@ exports[`CalendarRowItem renders correctly 1`] = `
|
|
|
16
16
|
"flexBasis": "14%",
|
|
17
17
|
"height": 48,
|
|
18
18
|
"justifyContent": "center",
|
|
19
|
-
"width":
|
|
19
|
+
"width": 120,
|
|
20
20
|
},
|
|
21
21
|
undefined,
|
|
22
22
|
]
|
|
23
23
|
}
|
|
24
24
|
testID="calendar-date-cell"
|
|
25
|
+
themeItemWidth={120}
|
|
25
26
|
>
|
|
26
27
|
<View
|
|
27
28
|
accessibilityState={
|
|
@@ -143,12 +144,13 @@ exports[`CalendarRowItem renders correctly 2`] = `
|
|
|
143
144
|
"flexBasis": "14%",
|
|
144
145
|
"height": 48,
|
|
145
146
|
"justifyContent": "center",
|
|
146
|
-
"width":
|
|
147
|
+
"width": 120,
|
|
147
148
|
},
|
|
148
149
|
undefined,
|
|
149
150
|
]
|
|
150
151
|
}
|
|
151
152
|
testID="calendar-date-cell"
|
|
153
|
+
themeItemWidth={120}
|
|
152
154
|
>
|
|
153
155
|
<View
|
|
154
156
|
accessibilityState={
|
|
@@ -2,15 +2,21 @@ import { fireEvent } from '@testing-library/react-native';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Calendar from '..';
|
|
4
4
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
5
|
+
import { setOrientation } from '../../../testHelpers/utils';
|
|
5
6
|
|
|
6
7
|
Date.now = jest.fn(() => new Date(2022, 10, 2).valueOf());
|
|
7
8
|
|
|
8
9
|
describe('Calendar', () => {
|
|
9
|
-
it
|
|
10
|
+
it.each`
|
|
11
|
+
orientation
|
|
12
|
+
${'portrait'}
|
|
13
|
+
${'landscape'}
|
|
14
|
+
`('renders correctly', ({ orientation }) => {
|
|
10
15
|
const onChange = jest.fn();
|
|
11
16
|
const onTitlePress = jest.fn();
|
|
12
17
|
const onPreviousPress = jest.fn();
|
|
13
18
|
const onNextPress = jest.fn();
|
|
19
|
+
setOrientation(orientation);
|
|
14
20
|
const { getByText, queryAllByTestId, queryByTestId } = renderWithTheme(
|
|
15
21
|
<Calendar
|
|
16
22
|
value={new Date(2022, 10, 5)}
|