@hero-design/rn 8.103.5 → 8.103.7

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.
Files changed (54) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +16 -0
  3. package/es/index.js +174 -73
  4. package/lib/index.js +174 -73
  5. package/package.json +1 -1
  6. package/src/components/DatePicker/DatePickerAndroid.tsx +18 -4
  7. package/src/components/DatePicker/DatePickerCalendar.tsx +18 -4
  8. package/src/components/DatePicker/DatePickerIOS.tsx +18 -4
  9. package/src/components/DatePicker/StyledDatePicker.tsx +19 -2
  10. package/src/components/DatePicker/__tests__/DatePicker.spec.tsx +102 -1
  11. package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +6 -0
  12. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +2 -0
  13. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +2 -0
  14. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +4 -0
  15. package/src/components/DatePicker/types.ts +11 -0
  16. package/src/components/RichTextEditor/RichTextEditor.tsx +6 -2
  17. package/src/components/RichTextEditor/StyledRichTextEditor.ts +1 -4
  18. package/src/components/RichTextEditor/__tests__/RichTextEditor.spec.tsx +4 -2
  19. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +8 -5
  20. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +7 -0
  21. package/src/components/Select/MultiSelect/__tests__/index.spec.tsx +53 -0
  22. package/src/components/Select/MultiSelect/index.tsx +18 -8
  23. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +6 -0
  24. package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +50 -0
  25. package/src/components/Select/SingleSelect/index.tsx +19 -8
  26. package/src/components/Select/StyledSelect.tsx +25 -2
  27. package/src/components/Select/index.tsx +8 -2
  28. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +14 -0
  29. package/src/components/TextInput/index.tsx +6 -1
  30. package/src/components/TimePicker/StyledTimePicker.tsx +19 -2
  31. package/src/components/TimePicker/TimePickerAndroid.tsx +18 -4
  32. package/src/components/TimePicker/TimePickerIOS.tsx +21 -5
  33. package/src/components/TimePicker/__tests__/TimePicker.spec.tsx +72 -1
  34. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +4 -0
  35. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +4 -0
  36. package/src/components/TimePicker/types.ts +11 -0
  37. package/stats/8.103.5/rn-stats.html +0 -2
  38. package/stats/8.103.6/rn-stats.html +4842 -0
  39. package/stats/8.103.7/rn-stats.html +4844 -0
  40. package/types/components/DatePicker/DatePickerAndroid.d.ts +1 -1
  41. package/types/components/DatePicker/DatePickerCalendar.d.ts +1 -1
  42. package/types/components/DatePicker/DatePickerIOS.d.ts +1 -1
  43. package/types/components/DatePicker/StyledDatePicker.d.ts +8 -1
  44. package/types/components/DatePicker/types.d.ts +11 -0
  45. package/types/components/RichTextEditor/StyledRichTextEditor.d.ts +0 -2
  46. package/types/components/Select/MultiSelect/index.d.ts +2 -1
  47. package/types/components/Select/SingleSelect/index.d.ts +2 -1
  48. package/types/components/Select/StyledSelect.d.ts +8 -1
  49. package/types/components/Select/index.d.ts +2 -2
  50. package/types/components/Select/index.internal.d.ts +1 -1
  51. package/types/components/TimePicker/StyledTimePicker.d.ts +8 -1
  52. package/types/components/TimePicker/TimePickerAndroid.d.ts +1 -1
  53. package/types/components/TimePicker/TimePickerIOS.d.ts +1 -1
  54. package/types/components/TimePicker/types.d.ts +11 -0
package/lib/index.js CHANGED
@@ -20016,9 +20016,13 @@ var renderInput$1 = function renderInput(_ref3) {
20016
20016
  renderInputValue = _ref3.renderInputValue,
20017
20017
  ref = _ref3.ref,
20018
20018
  theme = _ref3.theme;
20019
+ var multiline = variant === 'textarea' || nativeInputProps.multiline;
20020
+ // `numberOfLines` must be `1` for single-line inputs to render properly on Android.
20021
+ var numberOfLines = multiline ? nativeInputProps.numberOfLines : 1;
20019
20022
  return renderInputValue ? renderInputValue(nativeInputProps, ref) : /*#__PURE__*/React__namespace.default.createElement(StyledTextInput, _extends$1({}, nativeInputProps, {
20020
20023
  themeVariant: variant,
20021
- multiline: variant === 'textarea' || nativeInputProps.multiline,
20024
+ multiline: multiline,
20025
+ numberOfLines: numberOfLines,
20022
20026
  ref: ref,
20023
20027
  placeholderTextColor: theme.__hd__.textInput.colors.placeholder
20024
20028
  }));
@@ -20440,6 +20444,30 @@ var useFormatDate = function useFormatDate(_ref) {
20440
20444
  };
20441
20445
  };
20442
20446
 
20447
+ var StyledPickerWrapper$1 = index$b(reactNative.View)(function (_ref) {
20448
+ var theme = _ref.theme;
20449
+ return {
20450
+ height: theme.__hd__.datePicker.sizes.height,
20451
+ alignItems: 'center'
20452
+ };
20453
+ });
20454
+ var getZIndexByState$2 = function getZIndexByState(_ref2) {
20455
+ var themeHasError = _ref2.themeHasError;
20456
+ if (themeHasError) {
20457
+ return 1;
20458
+ }
20459
+ return 0;
20460
+ };
20461
+ var StyledTouchableOpacity$2 = index$b(reactNative.TouchableOpacity)(function (_ref3) {
20462
+ var themeGroupStyleEnabled = _ref3.themeGroupStyleEnabled,
20463
+ themeHasError = _ref3.themeHasError;
20464
+ return _objectSpread2({}, themeGroupStyleEnabled && {
20465
+ zIndex: getZIndexByState$2({
20466
+ themeHasError: themeHasError
20467
+ })
20468
+ });
20469
+ });
20470
+
20443
20471
  var DatePickerAndroid = function DatePickerAndroid(_ref) {
20444
20472
  var value = _ref.value,
20445
20473
  minDate = _ref.minDate,
@@ -20459,7 +20487,10 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
20459
20487
  variant = _ref$variant === void 0 ? 'default' : _ref$variant,
20460
20488
  renderSelectedValue = _ref.renderSelectedValue,
20461
20489
  locale = _ref.locale,
20462
- TextInputComponent = _ref.TextInputComponent;
20490
+ TextInputComponent = _ref.TextInputComponent,
20491
+ inputProps = _ref.inputProps,
20492
+ _ref$groupStyleEnable = _ref.groupStyleEnabled,
20493
+ groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable;
20463
20494
  var _useState = React.useState(false),
20464
20495
  _useState2 = _slicedToArray(_useState, 2),
20465
20496
  open = _useState2[0],
@@ -20478,15 +20509,19 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
20478
20509
  value: value
20479
20510
  });
20480
20511
  var InputComponent = TextInputComponent || TextInput;
20481
- return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
20482
- onPress: function onPress() {
20483
- return setOpen(true);
20484
- },
20485
- disabled: disabled
20512
+ var onPress = React.useCallback(function () {
20513
+ setOpen(true);
20514
+ }, []);
20515
+ return /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity$2, {
20516
+ onPress: onPress,
20517
+ disabled: disabled,
20518
+ themeGroupStyleEnabled: groupStyleEnabled,
20519
+ themeHasError: !!error,
20520
+ testID: "date-picker-android-touchable-opacity"
20486
20521
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
20487
20522
  pointerEvents: "none",
20488
20523
  testID: "datePickerInputAndroid"
20489
- }, /*#__PURE__*/React__namespace.default.createElement(InputComponent, {
20524
+ }, /*#__PURE__*/React__namespace.default.createElement(InputComponent, _extends$1({}, inputProps, {
20490
20525
  label: label,
20491
20526
  value: displayValue,
20492
20527
  suffix: "calendar-dates-outlined",
@@ -20503,7 +20538,7 @@ var DatePickerAndroid = function DatePickerAndroid(_ref) {
20503
20538
  formattedDateString: displayValue
20504
20539
  }, props);
20505
20540
  } : undefined
20506
- })), /*#__PURE__*/React__namespace.default.createElement(AndroidDatePickerDialog, {
20541
+ }))), /*#__PURE__*/React__namespace.default.createElement(AndroidDatePickerDialog, {
20507
20542
  open: open,
20508
20543
  onClose: function onClose() {
20509
20544
  return setOpen(false);
@@ -20582,7 +20617,10 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
20582
20617
  supportedOrientations = _ref2$supportedOrient === void 0 ? ['portrait'] : _ref2$supportedOrient,
20583
20618
  renderSelectedValue = _ref2.renderSelectedValue,
20584
20619
  locale = _ref2.locale,
20585
- TextInputComponent = _ref2.TextInputComponent;
20620
+ TextInputComponent = _ref2.TextInputComponent,
20621
+ inputProps = _ref2.inputProps,
20622
+ _ref2$groupStyleEnabl = _ref2.groupStyleEnabled,
20623
+ groupStyleEnabled = _ref2$groupStyleEnabl === void 0 ? false : _ref2$groupStyleEnabl;
20586
20624
  var _useState5 = React.useState(false),
20587
20625
  _useState6 = _slicedToArray(_useState5, 2),
20588
20626
  open = _useState6[0],
@@ -20609,15 +20647,19 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
20609
20647
  value: value
20610
20648
  });
20611
20649
  var InputComponent = TextInputComponent || TextInput;
20612
- return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
20613
- onPress: function onPress() {
20614
- return setOpen(true);
20615
- },
20616
- disabled: disabled
20650
+ var onPress = React.useCallback(function () {
20651
+ setOpen(true);
20652
+ }, []);
20653
+ return /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity$2, {
20654
+ onPress: onPress,
20655
+ disabled: disabled,
20656
+ themeGroupStyleEnabled: groupStyleEnabled,
20657
+ themeHasError: !!error,
20658
+ testID: "date-picker-calendar-touchable-opacity"
20617
20659
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
20618
20660
  pointerEvents: "none",
20619
20661
  testID: "datePickerCalendar"
20620
- }, /*#__PURE__*/React__namespace.default.createElement(InputComponent, {
20662
+ }, /*#__PURE__*/React__namespace.default.createElement(InputComponent, _extends$1({}, inputProps, {
20621
20663
  label: label,
20622
20664
  value: displayValue,
20623
20665
  suffix: "calendar-dates-outlined",
@@ -20634,7 +20676,7 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
20634
20676
  formattedDateString: displayValue
20635
20677
  }, props);
20636
20678
  } : undefined
20637
- })), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
20679
+ }))), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
20638
20680
  open: open,
20639
20681
  onRequestClose: function onRequestClose() {
20640
20682
  return setOpen(false);
@@ -20664,14 +20706,6 @@ var DatePickerCalendar = function DatePickerCalendar(_ref2) {
20664
20706
  }))));
20665
20707
  };
20666
20708
 
20667
- var StyledPickerWrapper$1 = index$b(reactNative.View)(function (_ref) {
20668
- var theme = _ref.theme;
20669
- return {
20670
- height: theme.__hd__.datePicker.sizes.height,
20671
- alignItems: 'center'
20672
- };
20673
- });
20674
-
20675
20709
  var IOSDatePickerDialog = function IOSDatePickerDialog(_ref) {
20676
20710
  var label = _ref.label,
20677
20711
  open = _ref.open,
@@ -20765,7 +20799,10 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
20765
20799
  variant = _ref$variant === void 0 ? 'default' : _ref$variant,
20766
20800
  locale = _ref.locale,
20767
20801
  renderSelectedValue = _ref.renderSelectedValue,
20768
- TextInputComponent = _ref.TextInputComponent;
20802
+ TextInputComponent = _ref.TextInputComponent,
20803
+ inputProps = _ref.inputProps,
20804
+ _ref$groupStyleEnable = _ref.groupStyleEnabled,
20805
+ groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable;
20769
20806
  var _useState = React.useState(false),
20770
20807
  _useState2 = _slicedToArray(_useState, 2),
20771
20808
  open = _useState2[0],
@@ -20786,15 +20823,19 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
20786
20823
  value: value
20787
20824
  });
20788
20825
  var InputComponent = TextInputComponent || TextInput;
20789
- return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
20790
- onPress: function onPress() {
20791
- return setOpen(true);
20792
- },
20793
- disabled: disabled
20826
+ var onPress = React.useCallback(function () {
20827
+ setOpen(true);
20828
+ }, []);
20829
+ return /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity$2, {
20830
+ onPress: onPress,
20831
+ disabled: disabled,
20832
+ themeGroupStyleEnabled: groupStyleEnabled,
20833
+ themeHasError: !!error,
20834
+ testID: "date-picker-ios-touchable-opacity"
20794
20835
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
20795
20836
  pointerEvents: "none",
20796
20837
  testID: "datePickerInputIOS"
20797
- }, /*#__PURE__*/React__namespace.default.createElement(InputComponent, {
20838
+ }, /*#__PURE__*/React__namespace.default.createElement(InputComponent, _extends$1({}, inputProps, {
20798
20839
  label: label,
20799
20840
  value: displayValue,
20800
20841
  suffix: "calendar-dates-outlined",
@@ -20811,7 +20852,7 @@ var DatePickerIOS = function DatePickerIOS(_ref) {
20811
20852
  formattedDateString: displayValue
20812
20853
  }, props);
20813
20854
  } : undefined
20814
- })), /*#__PURE__*/React__namespace.default.createElement(IOSDatePickerDialog, {
20855
+ }))), /*#__PURE__*/React__namespace.default.createElement(IOSDatePickerDialog, {
20815
20856
  value: value,
20816
20857
  onChange: onChange,
20817
20858
  open: open,
@@ -24948,6 +24989,22 @@ var StyledSectionList = index$b(reactNative.SectionList)(function (_ref4) {
24948
24989
  paddingHorizontal: theme.__hd__.select.space.optionListHorizontalPadding
24949
24990
  };
24950
24991
  });
24992
+ var getZIndexByState$1 = function getZIndexByState(_ref5) {
24993
+ var themeHasError = _ref5.themeHasError;
24994
+ if (themeHasError) {
24995
+ return 1;
24996
+ }
24997
+ return 0;
24998
+ };
24999
+ var StyledTouchableOpacity$1 = index$b(reactNative.TouchableOpacity)(function (_ref6) {
25000
+ var themeGroupStyleEnabled = _ref6.themeGroupStyleEnabled,
25001
+ themeHasError = _ref6.themeHasError;
25002
+ return _objectSpread2({}, themeGroupStyleEnabled && {
25003
+ zIndex: getZIndexByState$1({
25004
+ themeHasError: themeHasError
25005
+ })
25006
+ });
25007
+ });
24951
25008
 
24952
25009
  var _excluded$g = ["keyExtractor", "loading", "onEndReached", "onQueryChange", "sections", "renderItem", "sectionListRef"];
24953
25010
  var BaseOptionList = function BaseOptionList(_ref) {
@@ -25086,7 +25143,7 @@ var OptionList$1 = function OptionList(_ref) {
25086
25143
  }, rest));
25087
25144
  };
25088
25145
 
25089
- var _excluded$e = ["footerLabel", "label", "loading", "inputProps", "onConfirm", "onDismiss", "onEndReached", "onQueryChange", "options", "renderOption", "renderSelectedValue", "query", "error", "editable", "disabled", "required", "style", "testID", "value", "supportedOrientations", "bottomSheetConfig"];
25146
+ var _excluded$e = ["footerLabel", "label", "loading", "inputProps", "onConfirm", "onDismiss", "onEndReached", "onQueryChange", "options", "renderOption", "renderSelectedValue", "query", "error", "editable", "disabled", "required", "style", "testID", "value", "supportedOrientations", "bottomSheetConfig", "groupStyleEnabled"];
25090
25147
  function MultiSelect(_ref) {
25091
25148
  var footerLabel = _ref.footerLabel,
25092
25149
  label = _ref.label,
@@ -25114,6 +25171,8 @@ function MultiSelect(_ref) {
25114
25171
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
25115
25172
  _ref$bottomSheetConfi = _ref.bottomSheetConfig,
25116
25173
  bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi,
25174
+ _ref$groupStyleEnable = _ref.groupStyleEnabled,
25175
+ groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable,
25117
25176
  rest = _objectWithoutProperties(_ref, _excluded$e);
25118
25177
  var _useKeyboard = useKeyboard(),
25119
25178
  isKeyboardVisible = _useKeyboard.isKeyboardVisible,
@@ -25138,15 +25197,19 @@ function MultiSelect(_ref) {
25138
25197
  var bottomSheetVariant = bottomSheetConfig.variant,
25139
25198
  bottomSheetHeader = bottomSheetConfig.header;
25140
25199
  var TextInputComponent = rest.TextInputComponent || TextInput;
25200
+ var onPress = React.useCallback(function () {
25201
+ setOpen(true);
25202
+ }, []);
25141
25203
  React.useEffect(function () {
25142
25204
  setSelectingValue(value);
25143
25205
  }, [open, value]);
25144
25206
  return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
25145
25207
  pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
25146
- }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
25147
- onPress: function onPress() {
25148
- return setOpen(true);
25149
- }
25208
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity$1, {
25209
+ onPress: onPress,
25210
+ themeGroupStyleEnabled: groupStyleEnabled,
25211
+ themeHasError: !!error,
25212
+ testID: "multi-select-touchable-opacity"
25150
25213
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
25151
25214
  pointerEvents: "none"
25152
25215
  }, /*#__PURE__*/React__namespace.default.createElement(TextInputComponent, _extends$1({}, inputProps, {
@@ -25297,7 +25360,7 @@ var OptionList = function OptionList(_ref) {
25297
25360
  }, rest));
25298
25361
  };
25299
25362
 
25300
- var _excluded$c = ["label", "loading", "inputProps", "onConfirm", "onDismiss", "onEndReached", "onQueryChange", "options", "renderOption", "renderSelectedValue", "query", "error", "editable", "disabled", "required", "style", "testID", "value", "supportedOrientations", "bottomSheetConfig"];
25363
+ var _excluded$c = ["label", "loading", "inputProps", "onConfirm", "onDismiss", "onEndReached", "onQueryChange", "options", "renderOption", "renderSelectedValue", "query", "error", "editable", "disabled", "required", "style", "testID", "value", "supportedOrientations", "bottomSheetConfig", "groupStyleEnabled"];
25301
25364
  var SingleSelect = function SingleSelect(_ref) {
25302
25365
  var _flatOptions$find;
25303
25366
  var label = _ref.label,
@@ -25325,6 +25388,8 @@ var SingleSelect = function SingleSelect(_ref) {
25325
25388
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
25326
25389
  _ref$bottomSheetConfi = _ref.bottomSheetConfig,
25327
25390
  bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi,
25391
+ _ref$groupStyleEnable = _ref.groupStyleEnabled,
25392
+ groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable,
25328
25393
  rest = _objectWithoutProperties(_ref, _excluded$c);
25329
25394
  var _useKeyboard = useKeyboard(),
25330
25395
  isKeyboardVisible = _useKeyboard.isKeyboardVisible,
@@ -25343,12 +25408,16 @@ var SingleSelect = function SingleSelect(_ref) {
25343
25408
  var bottomSheetVariant = bottomSheetConfig.variant,
25344
25409
  bottomSheetHeader = bottomSheetConfig.header;
25345
25410
  var TextInputComponent = rest.TextInputComponent || TextInput;
25411
+ var onPress = React.useCallback(function () {
25412
+ setOpen(true);
25413
+ }, []);
25346
25414
  return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
25347
25415
  pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
25348
- }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
25349
- onPress: function onPress() {
25350
- return setOpen(true);
25351
- }
25416
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity$1, {
25417
+ onPress: onPress,
25418
+ themeGroupStyleEnabled: groupStyleEnabled,
25419
+ themeHasError: !!error,
25420
+ testID: "single-select-touchable-opacity"
25352
25421
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
25353
25422
  pointerEvents: "none"
25354
25423
  }, /*#__PURE__*/React__namespace.default.createElement(TextInputComponent, _extends$1({}, inputProps, {
@@ -26691,6 +26760,30 @@ var Tag = function Tag(_ref) {
26691
26760
  }, content) : content);
26692
26761
  };
26693
26762
 
26763
+ var StyledPickerWrapper = index$b(reactNative.View)(function (_ref) {
26764
+ var theme = _ref.theme;
26765
+ return {
26766
+ height: theme.__hd__.timePicker.sizes.height,
26767
+ alignItems: 'center'
26768
+ };
26769
+ });
26770
+ var getZIndexByState = function getZIndexByState(_ref2) {
26771
+ var themeHasError = _ref2.themeHasError;
26772
+ if (themeHasError) {
26773
+ return 1;
26774
+ }
26775
+ return 0;
26776
+ };
26777
+ var StyledTouchableOpacity = index$b(reactNative.TouchableOpacity)(function (_ref3) {
26778
+ var themeGroupStyleEnabled = _ref3.themeGroupStyleEnabled,
26779
+ themeHasError = _ref3.themeHasError;
26780
+ return _objectSpread2({}, themeGroupStyleEnabled && {
26781
+ zIndex: getZIndexByState({
26782
+ themeHasError: themeHasError
26783
+ })
26784
+ });
26785
+ });
26786
+
26694
26787
  var TimePickerAndroid = function TimePickerAndroid(_ref) {
26695
26788
  var value = _ref.value,
26696
26789
  label = _ref.label,
@@ -26707,7 +26800,10 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
26707
26800
  testID = _ref.testID,
26708
26801
  _ref$showSuffix = _ref.showSuffix,
26709
26802
  showSuffix = _ref$showSuffix === void 0 ? true : _ref$showSuffix,
26710
- TextInputComponent = _ref.TextInputComponent;
26803
+ TextInputComponent = _ref.TextInputComponent,
26804
+ inputProps = _ref.inputProps,
26805
+ _ref$groupStyleEnable = _ref.groupStyleEnabled,
26806
+ groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable;
26711
26807
  var _useState = React.useState(false),
26712
26808
  _useState2 = _slicedToArray(_useState, 2),
26713
26809
  open = _useState2[0],
@@ -26716,15 +26812,19 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
26716
26812
  var displayValue = value ? formatTime(displayFormat, value) : '';
26717
26813
  var pickerInitValue = value || new Date();
26718
26814
  var InputComponent = TextInputComponent || TextInput;
26719
- return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
26720
- onPress: function onPress() {
26721
- return setOpen(true);
26722
- },
26723
- disabled: disabled
26815
+ var onPress = React.useCallback(function () {
26816
+ setOpen(true);
26817
+ }, []);
26818
+ return /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity, {
26819
+ onPress: onPress,
26820
+ disabled: disabled,
26821
+ themeGroupStyleEnabled: groupStyleEnabled,
26822
+ themeHasError: !!error,
26823
+ testID: "time-picker-android-touchable-opacity"
26724
26824
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
26725
26825
  pointerEvents: "none",
26726
26826
  testID: "timePickerInputAndroid"
26727
- }, /*#__PURE__*/React__namespace.default.createElement(InputComponent, {
26827
+ }, /*#__PURE__*/React__namespace.default.createElement(InputComponent, _extends$1({}, inputProps, {
26728
26828
  label: label,
26729
26829
  value: displayValue,
26730
26830
  suffix: showSuffix ? 'clock-3' : undefined,
@@ -26735,7 +26835,7 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
26735
26835
  helpText: helpText,
26736
26836
  style: style,
26737
26837
  testID: testID
26738
- })), open ? /*#__PURE__*/React__namespace.default.createElement(DateTimePicker__default.default, {
26838
+ }))), open ? /*#__PURE__*/React__namespace.default.createElement(DateTimePicker__default.default, {
26739
26839
  testID: "timePickerAndroid",
26740
26840
  mode: "time",
26741
26841
  value: pickerInitValue,
@@ -26750,14 +26850,6 @@ var TimePickerAndroid = function TimePickerAndroid(_ref) {
26750
26850
  }) : null);
26751
26851
  };
26752
26852
 
26753
- var StyledPickerWrapper = index$b(reactNative.View)(function (_ref) {
26754
- var theme = _ref.theme;
26755
- return {
26756
- height: theme.__hd__.timePicker.sizes.height,
26757
- alignItems: 'center'
26758
- };
26759
- });
26760
-
26761
26853
  var TimePickerIOS = function TimePickerIOS(_ref) {
26762
26854
  var value = _ref.value,
26763
26855
  label = _ref.label,
@@ -26777,7 +26869,10 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
26777
26869
  showSuffix = _ref$showSuffix === void 0 ? true : _ref$showSuffix,
26778
26870
  _ref$supportedOrienta = _ref.supportedOrientations,
26779
26871
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
26780
- TextInputComponent = _ref.TextInputComponent;
26872
+ TextInputComponent = _ref.TextInputComponent,
26873
+ inputProps = _ref.inputProps,
26874
+ _ref$groupStyleEnable = _ref.groupStyleEnabled,
26875
+ groupStyleEnabled = _ref$groupStyleEnable === void 0 ? false : _ref$groupStyleEnable;
26781
26876
  var _useState = React.useState(value || new Date()),
26782
26877
  _useState2 = _slicedToArray(_useState, 2),
26783
26878
  selectingDate = _useState2[0],
@@ -26793,15 +26888,19 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
26793
26888
  React.useEffect(function () {
26794
26889
  setSelectingDate(value || new Date());
26795
26890
  }, [value]);
26796
- return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
26797
- onPress: function onPress() {
26798
- return setOpen(true);
26799
- },
26800
- disabled: disabled
26891
+ var onPress = React.useCallback(function () {
26892
+ setOpen(true);
26893
+ }, []);
26894
+ return /*#__PURE__*/React__namespace.default.createElement(StyledTouchableOpacity, {
26895
+ onPress: onPress,
26896
+ disabled: disabled,
26897
+ themeGroupStyleEnabled: groupStyleEnabled,
26898
+ themeHasError: !!error,
26899
+ testID: "time-picker-ios-touchable-opacity"
26801
26900
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
26802
26901
  pointerEvents: "none",
26803
26902
  testID: "timePickerInputIOS"
26804
- }, /*#__PURE__*/React__namespace.default.createElement(InputComponent, {
26903
+ }, /*#__PURE__*/React__namespace.default.createElement(InputComponent, _extends$1({}, inputProps, {
26805
26904
  label: label,
26806
26905
  value: displayValue,
26807
26906
  suffix: showSuffix ? 'clock-3' : undefined,
@@ -26812,7 +26911,7 @@ var TimePickerIOS = function TimePickerIOS(_ref) {
26812
26911
  helpText: helpText,
26813
26912
  testID: testID,
26814
26913
  style: style
26815
- })), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
26914
+ }))), /*#__PURE__*/React__namespace.default.createElement(BottomSheet$1, {
26816
26915
  open: open,
26817
26916
  onRequestClose: function onRequestClose() {
26818
26917
  return setOpen(false);
@@ -45971,10 +46070,8 @@ index$b(reactNative.View)(function (_ref) {
45971
46070
  };
45972
46071
  });
45973
46072
  var StyledWebView = index$b(reactNativeWebview.WebView)(function (_ref2) {
45974
- var height = _ref2.height,
45975
- theme = _ref2.theme;
46073
+ var theme = _ref2.theme;
45976
46074
  return {
45977
- height: height,
45978
46075
  minHeight: theme.__hd__.richTextEditor.sizes.editorMinHeight,
45979
46076
  backgroundColor: 'transparent',
45980
46077
  textAlignVertical: 'center',
@@ -46227,7 +46324,12 @@ var RichTextEditor = function RichTextEditor(_ref) {
46227
46324
  }, /*#__PURE__*/React__namespace.default.createElement(StyledBorderBackDrop, {
46228
46325
  themeState: state,
46229
46326
  themeFocused: isFocused
46230
- }), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputAndLabelContainer, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableWithoutFeedback, {
46327
+ }), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputAndLabelContainer, {
46328
+ style: {
46329
+ height: webviewHeight
46330
+ },
46331
+ testID: "webViewWrapper"
46332
+ }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableWithoutFeedback, {
46231
46333
  onPress: function onPress(e) {
46232
46334
  return e.stopPropagation();
46233
46335
  }
@@ -46242,8 +46344,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
46242
46344
  onMessage: onMessage,
46243
46345
  scrollEnabled: false,
46244
46346
  hideKeyboardAccessoryView: true,
46245
- keyboardDisplayRequiresUserAction: false,
46246
- height: webviewHeight
46347
+ keyboardDisplayRequiresUserAction: false
46247
46348
  })))), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, error ? /*#__PURE__*/React__namespace.default.createElement(StyledErrorContainer$2, null, /*#__PURE__*/React__namespace.default.createElement(Icon, {
46248
46349
  testID: "input-error-icon",
46249
46350
  icon: "circle-info",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.103.5",
3
+ "version": "8.103.7",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1,10 +1,11 @@
1
- import React, { useState } from 'react';
2
- import { TouchableOpacity, View } from 'react-native';
1
+ import React, { useState, useCallback } from 'react';
2
+ import { View } from 'react-native';
3
3
 
4
4
  import TextInput from '../TextInput';
5
5
  import AndroidDatePickerDialog from './Dialog/AndroidDialog';
6
6
  import useCalculateDate from './hooks/useCalculateDate';
7
7
  import useFormatDate from './hooks/useFormatDate';
8
+ import { StyledTouchableOpacity } from './StyledDatePicker';
8
9
  import type { InternalDatePickerProps } from './types';
9
10
 
10
11
  type DatePickerAndroidProps = Omit<
@@ -31,6 +32,8 @@ const DatePickerAndroid = ({
31
32
  renderSelectedValue,
32
33
  locale,
33
34
  TextInputComponent,
35
+ inputProps,
36
+ groupStyleEnabled = false,
34
37
  }: DatePickerAndroidProps) => {
35
38
  const [open, setOpen] = useState(false);
36
39
 
@@ -44,10 +47,21 @@ const DatePickerAndroid = ({
44
47
 
45
48
  const InputComponent = TextInputComponent || TextInput;
46
49
 
50
+ const onPress = useCallback(() => {
51
+ setOpen(true);
52
+ }, []);
53
+
47
54
  return (
48
- <TouchableOpacity onPress={() => setOpen(true)} disabled={disabled}>
55
+ <StyledTouchableOpacity
56
+ onPress={onPress}
57
+ disabled={disabled}
58
+ themeGroupStyleEnabled={groupStyleEnabled}
59
+ themeHasError={!!error}
60
+ testID="date-picker-android-touchable-opacity"
61
+ >
49
62
  <View pointerEvents="none" testID="datePickerInputAndroid">
50
63
  <InputComponent
64
+ {...inputProps}
51
65
  label={label}
52
66
  value={displayValue}
53
67
  suffix="calendar-dates-outlined"
@@ -81,7 +95,7 @@ const DatePickerAndroid = ({
81
95
  onChange={onChange}
82
96
  variant={variant}
83
97
  />
84
- </TouchableOpacity>
98
+ </StyledTouchableOpacity>
85
99
  );
86
100
  };
87
101
 
@@ -1,5 +1,5 @@
1
- import React, { useState } from 'react';
2
- import { Platform, ScrollView, TouchableOpacity, View } from 'react-native';
1
+ import React, { useState, useCallback } from 'react';
2
+ import { Platform, ScrollView, View } from 'react-native';
3
3
 
4
4
  import BottomSheet from '../BottomSheet';
5
5
  import Button from '../Button';
@@ -7,6 +7,7 @@ import Calendar, { CalendarProps } from '../Calendar';
7
7
  import TextInput from '../TextInput';
8
8
  import useCalculateDate from './hooks/useCalculateDate';
9
9
  import useFormatDate from './hooks/useFormatDate';
10
+ import { StyledTouchableOpacity } from './StyledDatePicker';
10
11
  import type { InternalDatePickerProps } from './types';
11
12
 
12
13
  const InternalCalendar = ({
@@ -81,6 +82,8 @@ const DatePickerCalendar = ({
81
82
  renderSelectedValue,
82
83
  locale,
83
84
  TextInputComponent,
85
+ inputProps,
86
+ groupStyleEnabled = false,
84
87
  }: Omit<InternalDatePickerProps, 'variant'>) => {
85
88
  const [open, setOpen] = useState(false);
86
89
  const [monthPickerVisible, setMonthPickerVisible] = useState(false);
@@ -98,10 +101,21 @@ const DatePickerCalendar = ({
98
101
 
99
102
  const InputComponent = TextInputComponent || TextInput;
100
103
 
104
+ const onPress = useCallback(() => {
105
+ setOpen(true);
106
+ }, []);
107
+
101
108
  return (
102
- <TouchableOpacity onPress={() => setOpen(true)} disabled={disabled}>
109
+ <StyledTouchableOpacity
110
+ onPress={onPress}
111
+ disabled={disabled}
112
+ themeGroupStyleEnabled={groupStyleEnabled}
113
+ themeHasError={!!error}
114
+ testID="date-picker-calendar-touchable-opacity"
115
+ >
103
116
  <View pointerEvents="none" testID="datePickerCalendar">
104
117
  <InputComponent
118
+ {...inputProps}
105
119
  label={label}
106
120
  value={displayValue}
107
121
  suffix="calendar-dates-outlined"
@@ -158,7 +172,7 @@ const DatePickerCalendar = ({
158
172
  />
159
173
  </ScrollView>
160
174
  </BottomSheet>
161
- </TouchableOpacity>
175
+ </StyledTouchableOpacity>
162
176
  );
163
177
  };
164
178
 
@@ -1,11 +1,12 @@
1
- import React, { useState } from 'react';
2
- import { TouchableOpacity, View } from 'react-native';
1
+ import React, { useState, useCallback } from 'react';
2
+ import { View } from 'react-native';
3
3
 
4
4
  import { useLocale } from '../LocaleProvider/hooks';
5
5
  import TextInput from '../TextInput';
6
6
  import IOSDatePickerDialog from './Dialog/IOSDialog';
7
7
  import useCalculateDate from './hooks/useCalculateDate';
8
8
  import useFormatDate from './hooks/useFormatDate';
9
+ import { StyledTouchableOpacity } from './StyledDatePicker';
9
10
  import type { InternalDatePickerProps } from './types';
10
11
 
11
12
  type DatePickerIOSProps = Omit<
@@ -34,6 +35,8 @@ const DatePickerIOS = ({
34
35
  locale,
35
36
  renderSelectedValue,
36
37
  TextInputComponent,
38
+ inputProps,
39
+ groupStyleEnabled = false,
37
40
  }: DatePickerIOSProps) => {
38
41
  const [open, setOpen] = useState(false);
39
42
  const { lang: defaultLocale } = useLocale();
@@ -47,10 +50,21 @@ const DatePickerIOS = ({
47
50
 
48
51
  const InputComponent = TextInputComponent || TextInput;
49
52
 
53
+ const onPress = useCallback(() => {
54
+ setOpen(true);
55
+ }, []);
56
+
50
57
  return (
51
- <TouchableOpacity onPress={() => setOpen(true)} disabled={disabled}>
58
+ <StyledTouchableOpacity
59
+ onPress={onPress}
60
+ disabled={disabled}
61
+ themeGroupStyleEnabled={groupStyleEnabled}
62
+ themeHasError={!!error}
63
+ testID="date-picker-ios-touchable-opacity"
64
+ >
52
65
  <View pointerEvents="none" testID="datePickerInputIOS">
53
66
  <InputComponent
67
+ {...inputProps}
54
68
  label={label}
55
69
  value={displayValue}
56
70
  suffix="calendar-dates-outlined"
@@ -88,7 +102,7 @@ const DatePickerIOS = ({
88
102
  minDate={minDate}
89
103
  maxDate={maxDate}
90
104
  />
91
- </TouchableOpacity>
105
+ </StyledTouchableOpacity>
92
106
  );
93
107
  };
94
108