@hero-design/rn 8.136.2 → 8.137.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.137.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#5516](https://github.com/Thinkei/hero-design/pull/5516) [`22172f6`](https://github.com/Thinkei/hero-design/commit/22172f65028e66509964b69c431b4660d0e66e45) Thanks [@ttkien](https://github.com/ttkien)! - [Select] Add `assistiveInfoConfig` prop to render an optional info trigger below the field
8
+
9
+ - [#5516](https://github.com/Thinkei/hero-design/pull/5516) [`22172f6`](https://github.com/Thinkei/hero-design/commit/22172f65028e66509964b69c431b4660d0e66e45) Thanks [@ttkien](https://github.com/ttkien)! - [TextInput] Add `assistiveInfoConfig` prop to render an optional info trigger below the field
10
+
11
+ ## 8.136.3
12
+
13
+ ### Patch Changes
14
+
15
+ - [#5502](https://github.com/Thinkei/hero-design/pull/5502) [`61d504b`](https://github.com/Thinkei/hero-design/commit/61d504b72a5d2631dd66d10ce0af97cbc5cd30c7) Thanks [@ttkien](https://github.com/ttkien)! - [SectionHeading] Remove redundant icon wrapper spacing when no icon is provided
16
+
3
17
  ## 8.136.2
4
18
 
5
19
  ### Patch Changes
package/es/index.js CHANGED
@@ -7322,6 +7322,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
7322
7322
  containerMarginTop: theme.space.small,
7323
7323
  labelInsideTextInputMarginTop: 0,
7324
7324
  errorAndHelpTextContainerPaddingTop: theme.space.xxsmall,
7325
+ assistiveInfoTriggerPadding: theme.space.xsmall,
7326
+ assistiveInfoTriggerGap: theme.space.xsmall,
7325
7327
  inputAndLabelContainerPaddingTop: theme.lineHeights.medium,
7326
7328
  labelFocusedTranslateY: theme.space.xsmall * 2,
7327
7329
  textareaLabelIdleTranslateY: theme.space.large
@@ -21387,7 +21389,43 @@ var StyledErrorAndMaxLengthContainer = index$c(View)(function (_ref14) {
21387
21389
  };
21388
21390
  });
21389
21391
 
21390
- var _excluded$t = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "hideCharacterCount", "helpText", "value", "defaultValue", "renderInputValue", "allowFontScaling", "variant"];
21392
+ var StyledTouchable = index$c(TouchableOpacity)(function () {
21393
+ return {
21394
+ alignSelf: 'flex-start'
21395
+ };
21396
+ });
21397
+ var StyledRow$1 = index$c(View)(function (_ref) {
21398
+ var theme = _ref.theme;
21399
+ return {
21400
+ flexDirection: 'row',
21401
+ alignItems: 'center',
21402
+ padding: theme.__hd__.textInput.space.assistiveInfoTriggerPadding,
21403
+ gap: theme.__hd__.textInput.space.assistiveInfoTriggerGap
21404
+ };
21405
+ });
21406
+
21407
+ var AssistiveInfoTrigger = function AssistiveInfoTrigger(_ref) {
21408
+ var accessibilityLabel = _ref.accessibilityLabel,
21409
+ disabled = _ref.disabled,
21410
+ label = _ref.label,
21411
+ onPress = _ref.onPress,
21412
+ testID = _ref.testID;
21413
+ return /*#__PURE__*/React__default.createElement(StyledTouchable, {
21414
+ onPress: onPress,
21415
+ disabled: disabled,
21416
+ accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : 'More information',
21417
+ accessibilityRole: "button",
21418
+ testID: testID
21419
+ }, /*#__PURE__*/React__default.createElement(StyledRow$1, null, /*#__PURE__*/React__default.createElement(Icon, {
21420
+ icon: "circle-info-outlined",
21421
+ size: "xsmall",
21422
+ intent: disabled ? 'disabled-text' : 'muted'
21423
+ }), !!label && /*#__PURE__*/React__default.createElement(Typography.Caption, {
21424
+ intent: disabled ? 'disabled' : 'muted'
21425
+ }, label)));
21426
+ };
21427
+
21428
+ var _excluded$t = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "hideCharacterCount", "helpText", "assistiveInfoConfig", "value", "defaultValue", "renderInputValue", "allowFontScaling", "variant", "pointerEvents"];
21391
21429
  var getState$3 = function getState(_ref) {
21392
21430
  var disabled = _ref.disabled,
21393
21431
  error = _ref.error,
@@ -21496,6 +21534,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
21496
21534
  _ref8$hideCharacterCo = _ref8.hideCharacterCount,
21497
21535
  hideCharacterCount = _ref8$hideCharacterCo === void 0 ? false : _ref8$hideCharacterCo,
21498
21536
  helpText = _ref8.helpText,
21537
+ assistiveInfoConfig = _ref8.assistiveInfoConfig,
21499
21538
  value = _ref8.value,
21500
21539
  defaultValue = _ref8.defaultValue,
21501
21540
  renderInputValue = _ref8.renderInputValue,
@@ -21503,6 +21542,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
21503
21542
  allowFontScaling = _ref8$allowFontScalin === void 0 ? false : _ref8$allowFontScalin,
21504
21543
  _ref8$variant = _ref8.variant,
21505
21544
  variant = _ref8$variant === void 0 ? 'text' : _ref8$variant,
21545
+ pointerEvents = _ref8.pointerEvents,
21506
21546
  nativeProps = _objectWithoutProperties(_ref8, _excluded$t);
21507
21547
  var displayText = getDisplayText(value, defaultValue);
21508
21548
  var isEmptyValue = displayText.length === 0;
@@ -21634,17 +21674,20 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
21634
21674
  defaultValue: defaultValue,
21635
21675
  placeholder: isFocused || label === undefined ? nativeProps.placeholder : EMPTY_PLACEHOLDER_VALUE
21636
21676
  });
21677
+ var isPressable = state !== 'disabled' && state !== 'readonly' && !loading;
21637
21678
  return /*#__PURE__*/React__default.createElement(StyledContainer$7, {
21638
21679
  style: styleWithoutBackgroundColor,
21639
- pointerEvents: state === 'disabled' || state === 'readonly' || loading ? 'none' : 'auto',
21640
21680
  testID: testID
21641
21681
  }, /*#__PURE__*/React__default.createElement(Pressable, {
21642
- onPress: focusInnerTextInput,
21682
+ onPress: isPressable ? focusInnerTextInput : undefined,
21643
21683
  accessible: false,
21644
- importantForAccessibility: "no"
21684
+ importantForAccessibility: "no",
21685
+ disabled: !isPressable,
21686
+ pointerEvents: pointerEvents
21645
21687
  }, /*#__PURE__*/React__default.createElement(StyledTextInputContainer, {
21646
21688
  themeVariant: variant,
21647
- themeState: state
21689
+ themeState: state,
21690
+ pointerEvents: isPressable ? 'auto' : 'none'
21648
21691
  }, /*#__PURE__*/React__default.createElement(StyledBorderBackDrop, {
21649
21692
  themeFocused: isFocused,
21650
21693
  themeState: state,
@@ -21709,7 +21752,12 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
21709
21752
  state: state,
21710
21753
  loading: loading,
21711
21754
  suffix: suffix
21712
- }))), /*#__PURE__*/React__default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21755
+ }))), !!assistiveInfoConfig && /*#__PURE__*/React__default.createElement(AssistiveInfoTrigger, {
21756
+ onPress: assistiveInfoConfig.onPress,
21757
+ label: assistiveInfoConfig.label,
21758
+ testID: assistiveInfoConfig.testID,
21759
+ disabled: !isPressable
21760
+ }), /*#__PURE__*/React__default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21713
21761
  error: error,
21714
21762
  helpText: helpText
21715
21763
  }), renderMaxLengthMessage({
@@ -27467,14 +27515,14 @@ var SectionHeading = function SectionHeading(_ref) {
27467
27515
  themeSize: size,
27468
27516
  style: style,
27469
27517
  testID: testID
27470
- }, /*#__PURE__*/React__default.createElement(StyledWrapper$4, null, /*#__PURE__*/React__default.createElement(StyledIconWrapper$2, null, icon !== undefined && (typeof icon === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
27518
+ }, /*#__PURE__*/React__default.createElement(StyledWrapper$4, null, icon !== undefined && /*#__PURE__*/React__default.createElement(StyledIconWrapper$2, null, typeof icon === 'string' ? /*#__PURE__*/React__default.createElement(Icon, {
27471
27519
  icon: icon,
27472
27520
  size: ICON_SIZE_MAP[size],
27473
27521
  intent: ICON_INTENT_MAP[intent]
27474
27522
  }) : (/*#__PURE__*/React__default.cloneElement(icon, _objectSpread2({
27475
27523
  size: ICON_SIZE_MAP[size],
27476
27524
  intent: ICON_INTENT_MAP[intent]
27477
- }, icon.props))))), size === 'small' ? /*#__PURE__*/React__default.createElement(Typography.Caption, {
27525
+ }, icon.props)))), size === 'small' ? /*#__PURE__*/React__default.createElement(Typography.Caption, {
27478
27526
  intent: intent
27479
27527
  }, text) : /*#__PURE__*/React__default.createElement(Typography.Body, {
27480
27528
  variant: "small",
@@ -27521,10 +27569,8 @@ var StyledSectionSpacer = index$c(View)(function (_ref3) {
27521
27569
  height: themeCompact ? theme.__hd__.sectionList.space.sectionSpacingCompact : theme.__hd__.sectionList.space.sectionSpacing
27522
27570
  };
27523
27571
  });
27524
- var StyledSectionHeading = index$c(SectionHeading)(function (_ref4) {
27525
- var theme = _ref4.theme;
27572
+ var StyledSectionHeading = index$c(SectionHeading)(function () {
27526
27573
  return {
27527
- paddingLeft: theme.__hd__.sectionList.space.headingPaddingLeft,
27528
27574
  marginBottom: 0
27529
27575
  };
27530
27576
  });
@@ -27847,7 +27893,8 @@ function MultiSelect(_ref) {
27847
27893
  _ref$supportedOrienta = _ref.supportedOrientations,
27848
27894
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
27849
27895
  _ref$bottomSheetConfi = _ref.bottomSheetConfig,
27850
- bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi;
27896
+ bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi,
27897
+ assistiveInfoConfig = _ref.assistiveInfoConfig;
27851
27898
  var _useKeyboard = useKeyboard(),
27852
27899
  isKeyboardVisible = _useKeyboard.isKeyboardVisible,
27853
27900
  keyboardHeight = _useKeyboard.keyboardHeight;
@@ -27885,9 +27932,7 @@ function MultiSelect(_ref) {
27885
27932
  }, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
27886
27933
  onPress: onPress,
27887
27934
  testID: "multi-select-touchable-opacity"
27888
- }, /*#__PURE__*/React__default.createElement(View, {
27889
- pointerEvents: "none"
27890
- }, /*#__PURE__*/React__default.createElement(TextInput, _extends$1({}, inputProps, {
27935
+ }, /*#__PURE__*/React__default.createElement(View, null, /*#__PURE__*/React__default.createElement(TextInput, _extends$1({}, inputProps, {
27891
27936
  label: label,
27892
27937
  value: renderSelectedValue ? rawValue : displayedValue,
27893
27938
  suffix: selectSuffix,
@@ -27899,6 +27944,7 @@ function MultiSelect(_ref) {
27899
27944
  pointerEvents: "none",
27900
27945
  style: style,
27901
27946
  testID: testID,
27947
+ assistiveInfoConfig: assistiveInfoConfig,
27902
27948
  renderInputValue: renderSelectedValue !== undefined && (rawValue === null || rawValue === void 0 ? void 0 : rawValue.length) > 0 ? function (nativeInputProps) {
27903
27949
  return renderSelectedValue(value, nativeInputProps);
27904
27950
  } : undefined
@@ -28061,7 +28107,8 @@ var SingleSelect = function SingleSelect(_ref) {
28061
28107
  _ref$supportedOrienta = _ref.supportedOrientations,
28062
28108
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
28063
28109
  _ref$bottomSheetConfi = _ref.bottomSheetConfig,
28064
- bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi;
28110
+ bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi,
28111
+ assistiveInfoConfig = _ref.assistiveInfoConfig;
28065
28112
  var _useKeyboard = useKeyboard(),
28066
28113
  isKeyboardVisible = _useKeyboard.isKeyboardVisible,
28067
28114
  keyboardHeight = _useKeyboard.keyboardHeight;
@@ -28092,9 +28139,7 @@ var SingleSelect = function SingleSelect(_ref) {
28092
28139
  }, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
28093
28140
  onPress: onPress,
28094
28141
  testID: "single-select-touchable-opacity"
28095
- }, /*#__PURE__*/React__default.createElement(View, {
28096
- pointerEvents: "none"
28097
- }, /*#__PURE__*/React__default.createElement(TextInput, _extends$1({}, inputProps, {
28142
+ }, /*#__PURE__*/React__default.createElement(View, null, /*#__PURE__*/React__default.createElement(TextInput, _extends$1({}, inputProps, {
28098
28143
  label: label,
28099
28144
  value: renderSelectedValue ? rawValue : displayedValue,
28100
28145
  suffix: selectSuffix,
@@ -28103,9 +28148,10 @@ var SingleSelect = function SingleSelect(_ref) {
28103
28148
  editable: editable,
28104
28149
  disabled: disabled,
28105
28150
  required: required,
28106
- pointerEvents: "none",
28107
28151
  style: style,
28108
28152
  testID: testID,
28153
+ pointerEvents: "none",
28154
+ assistiveInfoConfig: assistiveInfoConfig,
28109
28155
  renderInputValue: renderSelectedValue !== undefined && !!rawValue ? function (nativeInputProps) {
28110
28156
  return renderSelectedValue(value, nativeInputProps);
28111
28157
  } : undefined
package/lib/index.js CHANGED
@@ -7351,6 +7351,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
7351
7351
  containerMarginTop: theme.space.small,
7352
7352
  labelInsideTextInputMarginTop: 0,
7353
7353
  errorAndHelpTextContainerPaddingTop: theme.space.xxsmall,
7354
+ assistiveInfoTriggerPadding: theme.space.xsmall,
7355
+ assistiveInfoTriggerGap: theme.space.xsmall,
7354
7356
  inputAndLabelContainerPaddingTop: theme.lineHeights.medium,
7355
7357
  labelFocusedTranslateY: theme.space.xsmall * 2,
7356
7358
  textareaLabelIdleTranslateY: theme.space.large
@@ -21416,7 +21418,43 @@ var StyledErrorAndMaxLengthContainer = index$c(reactNative.View)(function (_ref1
21416
21418
  };
21417
21419
  });
21418
21420
 
21419
- var _excluded$t = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "hideCharacterCount", "helpText", "value", "defaultValue", "renderInputValue", "allowFontScaling", "variant"];
21421
+ var StyledTouchable = index$c(reactNative.TouchableOpacity)(function () {
21422
+ return {
21423
+ alignSelf: 'flex-start'
21424
+ };
21425
+ });
21426
+ var StyledRow$1 = index$c(reactNative.View)(function (_ref) {
21427
+ var theme = _ref.theme;
21428
+ return {
21429
+ flexDirection: 'row',
21430
+ alignItems: 'center',
21431
+ padding: theme.__hd__.textInput.space.assistiveInfoTriggerPadding,
21432
+ gap: theme.__hd__.textInput.space.assistiveInfoTriggerGap
21433
+ };
21434
+ });
21435
+
21436
+ var AssistiveInfoTrigger = function AssistiveInfoTrigger(_ref) {
21437
+ var accessibilityLabel = _ref.accessibilityLabel,
21438
+ disabled = _ref.disabled,
21439
+ label = _ref.label,
21440
+ onPress = _ref.onPress,
21441
+ testID = _ref.testID;
21442
+ return /*#__PURE__*/React__namespace.default.createElement(StyledTouchable, {
21443
+ onPress: onPress,
21444
+ disabled: disabled,
21445
+ accessibilityLabel: accessibilityLabel !== null && accessibilityLabel !== void 0 ? accessibilityLabel : 'More information',
21446
+ accessibilityRole: "button",
21447
+ testID: testID
21448
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledRow$1, null, /*#__PURE__*/React__namespace.default.createElement(Icon, {
21449
+ icon: "circle-info-outlined",
21450
+ size: "xsmall",
21451
+ intent: disabled ? 'disabled-text' : 'muted'
21452
+ }), !!label && /*#__PURE__*/React__namespace.default.createElement(Typography.Caption, {
21453
+ intent: disabled ? 'disabled' : 'muted'
21454
+ }, label)));
21455
+ };
21456
+
21457
+ var _excluded$t = ["label", "prefix", "suffix", "style", "textStyle", "testID", "accessibilityLabelledBy", "error", "required", "editable", "disabled", "loading", "maxLength", "hideCharacterCount", "helpText", "assistiveInfoConfig", "value", "defaultValue", "renderInputValue", "allowFontScaling", "variant", "pointerEvents"];
21420
21458
  var getState$3 = function getState(_ref) {
21421
21459
  var disabled = _ref.disabled,
21422
21460
  error = _ref.error,
@@ -21525,6 +21563,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21525
21563
  _ref8$hideCharacterCo = _ref8.hideCharacterCount,
21526
21564
  hideCharacterCount = _ref8$hideCharacterCo === void 0 ? false : _ref8$hideCharacterCo,
21527
21565
  helpText = _ref8.helpText,
21566
+ assistiveInfoConfig = _ref8.assistiveInfoConfig,
21528
21567
  value = _ref8.value,
21529
21568
  defaultValue = _ref8.defaultValue,
21530
21569
  renderInputValue = _ref8.renderInputValue,
@@ -21532,6 +21571,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21532
21571
  allowFontScaling = _ref8$allowFontScalin === void 0 ? false : _ref8$allowFontScalin,
21533
21572
  _ref8$variant = _ref8.variant,
21534
21573
  variant = _ref8$variant === void 0 ? 'text' : _ref8$variant,
21574
+ pointerEvents = _ref8.pointerEvents,
21535
21575
  nativeProps = _objectWithoutProperties(_ref8, _excluded$t);
21536
21576
  var displayText = getDisplayText(value, defaultValue);
21537
21577
  var isEmptyValue = displayText.length === 0;
@@ -21663,17 +21703,20 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21663
21703
  defaultValue: defaultValue,
21664
21704
  placeholder: isFocused || label === undefined ? nativeProps.placeholder : EMPTY_PLACEHOLDER_VALUE
21665
21705
  });
21706
+ var isPressable = state !== 'disabled' && state !== 'readonly' && !loading;
21666
21707
  return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
21667
21708
  style: styleWithoutBackgroundColor,
21668
- pointerEvents: state === 'disabled' || state === 'readonly' || loading ? 'none' : 'auto',
21669
21709
  testID: testID
21670
21710
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.Pressable, {
21671
- onPress: focusInnerTextInput,
21711
+ onPress: isPressable ? focusInnerTextInput : undefined,
21672
21712
  accessible: false,
21673
- importantForAccessibility: "no"
21713
+ importantForAccessibility: "no",
21714
+ disabled: !isPressable,
21715
+ pointerEvents: pointerEvents
21674
21716
  }, /*#__PURE__*/React__namespace.default.createElement(StyledTextInputContainer, {
21675
21717
  themeVariant: variant,
21676
- themeState: state
21718
+ themeState: state,
21719
+ pointerEvents: isPressable ? 'auto' : 'none'
21677
21720
  }, /*#__PURE__*/React__namespace.default.createElement(StyledBorderBackDrop, {
21678
21721
  themeFocused: isFocused,
21679
21722
  themeState: state,
@@ -21738,7 +21781,12 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21738
21781
  state: state,
21739
21782
  loading: loading,
21740
21783
  suffix: suffix
21741
- }))), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21784
+ }))), !!assistiveInfoConfig && /*#__PURE__*/React__namespace.default.createElement(AssistiveInfoTrigger, {
21785
+ onPress: assistiveInfoConfig.onPress,
21786
+ label: assistiveInfoConfig.label,
21787
+ testID: assistiveInfoConfig.testID,
21788
+ disabled: !isPressable
21789
+ }), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21742
21790
  error: error,
21743
21791
  helpText: helpText
21744
21792
  }), renderMaxLengthMessage({
@@ -27496,14 +27544,14 @@ var SectionHeading = function SectionHeading(_ref) {
27496
27544
  themeSize: size,
27497
27545
  style: style,
27498
27546
  testID: testID
27499
- }, /*#__PURE__*/React__namespace.default.createElement(StyledWrapper$4, null, /*#__PURE__*/React__namespace.default.createElement(StyledIconWrapper$2, null, icon !== undefined && (typeof icon === 'string' ? /*#__PURE__*/React__namespace.default.createElement(Icon, {
27547
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledWrapper$4, null, icon !== undefined && /*#__PURE__*/React__namespace.default.createElement(StyledIconWrapper$2, null, typeof icon === 'string' ? /*#__PURE__*/React__namespace.default.createElement(Icon, {
27500
27548
  icon: icon,
27501
27549
  size: ICON_SIZE_MAP[size],
27502
27550
  intent: ICON_INTENT_MAP[intent]
27503
27551
  }) : (/*#__PURE__*/React__namespace.default.cloneElement(icon, _objectSpread2({
27504
27552
  size: ICON_SIZE_MAP[size],
27505
27553
  intent: ICON_INTENT_MAP[intent]
27506
- }, icon.props))))), size === 'small' ? /*#__PURE__*/React__namespace.default.createElement(Typography.Caption, {
27554
+ }, icon.props)))), size === 'small' ? /*#__PURE__*/React__namespace.default.createElement(Typography.Caption, {
27507
27555
  intent: intent
27508
27556
  }, text) : /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
27509
27557
  variant: "small",
@@ -27550,10 +27598,8 @@ var StyledSectionSpacer = index$c(reactNative.View)(function (_ref3) {
27550
27598
  height: themeCompact ? theme.__hd__.sectionList.space.sectionSpacingCompact : theme.__hd__.sectionList.space.sectionSpacing
27551
27599
  };
27552
27600
  });
27553
- var StyledSectionHeading = index$c(SectionHeading)(function (_ref4) {
27554
- var theme = _ref4.theme;
27601
+ var StyledSectionHeading = index$c(SectionHeading)(function () {
27555
27602
  return {
27556
- paddingLeft: theme.__hd__.sectionList.space.headingPaddingLeft,
27557
27603
  marginBottom: 0
27558
27604
  };
27559
27605
  });
@@ -27876,7 +27922,8 @@ function MultiSelect(_ref) {
27876
27922
  _ref$supportedOrienta = _ref.supportedOrientations,
27877
27923
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
27878
27924
  _ref$bottomSheetConfi = _ref.bottomSheetConfig,
27879
- bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi;
27925
+ bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi,
27926
+ assistiveInfoConfig = _ref.assistiveInfoConfig;
27880
27927
  var _useKeyboard = useKeyboard(),
27881
27928
  isKeyboardVisible = _useKeyboard.isKeyboardVisible,
27882
27929
  keyboardHeight = _useKeyboard.keyboardHeight;
@@ -27914,9 +27961,7 @@ function MultiSelect(_ref) {
27914
27961
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
27915
27962
  onPress: onPress,
27916
27963
  testID: "multi-select-touchable-opacity"
27917
- }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
27918
- pointerEvents: "none"
27919
- }, /*#__PURE__*/React__namespace.default.createElement(TextInput, _extends$1({}, inputProps, {
27964
+ }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, /*#__PURE__*/React__namespace.default.createElement(TextInput, _extends$1({}, inputProps, {
27920
27965
  label: label,
27921
27966
  value: renderSelectedValue ? rawValue : displayedValue,
27922
27967
  suffix: selectSuffix,
@@ -27928,6 +27973,7 @@ function MultiSelect(_ref) {
27928
27973
  pointerEvents: "none",
27929
27974
  style: style,
27930
27975
  testID: testID,
27976
+ assistiveInfoConfig: assistiveInfoConfig,
27931
27977
  renderInputValue: renderSelectedValue !== undefined && (rawValue === null || rawValue === void 0 ? void 0 : rawValue.length) > 0 ? function (nativeInputProps) {
27932
27978
  return renderSelectedValue(value, nativeInputProps);
27933
27979
  } : undefined
@@ -28090,7 +28136,8 @@ var SingleSelect = function SingleSelect(_ref) {
28090
28136
  _ref$supportedOrienta = _ref.supportedOrientations,
28091
28137
  supportedOrientations = _ref$supportedOrienta === void 0 ? ['portrait'] : _ref$supportedOrienta,
28092
28138
  _ref$bottomSheetConfi = _ref.bottomSheetConfig,
28093
- bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi;
28139
+ bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi,
28140
+ assistiveInfoConfig = _ref.assistiveInfoConfig;
28094
28141
  var _useKeyboard = useKeyboard(),
28095
28142
  isKeyboardVisible = _useKeyboard.isKeyboardVisible,
28096
28143
  keyboardHeight = _useKeyboard.keyboardHeight;
@@ -28121,9 +28168,7 @@ var SingleSelect = function SingleSelect(_ref) {
28121
28168
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
28122
28169
  onPress: onPress,
28123
28170
  testID: "single-select-touchable-opacity"
28124
- }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
28125
- pointerEvents: "none"
28126
- }, /*#__PURE__*/React__namespace.default.createElement(TextInput, _extends$1({}, inputProps, {
28171
+ }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, /*#__PURE__*/React__namespace.default.createElement(TextInput, _extends$1({}, inputProps, {
28127
28172
  label: label,
28128
28173
  value: renderSelectedValue ? rawValue : displayedValue,
28129
28174
  suffix: selectSuffix,
@@ -28132,9 +28177,10 @@ var SingleSelect = function SingleSelect(_ref) {
28132
28177
  editable: editable,
28133
28178
  disabled: disabled,
28134
28179
  required: required,
28135
- pointerEvents: "none",
28136
28180
  style: style,
28137
28181
  testID: testID,
28182
+ pointerEvents: "none",
28183
+ assistiveInfoConfig: assistiveInfoConfig,
28138
28184
  renderInputValue: renderSelectedValue !== undefined && !!rawValue ? function (nativeInputProps) {
28139
28185
  return renderSelectedValue(value, nativeInputProps);
28140
28186
  } : undefined
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.136.2",
3
+ "version": "8.137.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -87,9 +87,9 @@ const SectionHeading = ({
87
87
  return (
88
88
  <StyledHeading themeSize={size} style={style} testID={testID}>
89
89
  <StyledWrapper>
90
- <StyledIconWrapper>
91
- {icon !== undefined &&
92
- (typeof icon === 'string' ? (
90
+ {icon !== undefined && (
91
+ <StyledIconWrapper>
92
+ {typeof icon === 'string' ? (
93
93
  <Icon
94
94
  icon={icon}
95
95
  size={ICON_SIZE_MAP[size]}
@@ -101,8 +101,9 @@ const SectionHeading = ({
101
101
  intent: ICON_INTENT_MAP[intent],
102
102
  ...icon.props,
103
103
  })
104
- ))}
105
- </StyledIconWrapper>
104
+ )}
105
+ </StyledIconWrapper>
106
+ )}
106
107
 
107
108
  {size === 'small' ? (
108
109
  <Typography.Caption intent={intent}>{text}</Typography.Caption>
@@ -52,8 +52,7 @@ const StyledSectionSpacer = styled(View)<{ themeCompact: boolean }>(
52
52
  })
53
53
  );
54
54
 
55
- const StyledSectionHeading = styled(SectionHeading)(({ theme }) => ({
56
- paddingLeft: theme.__hd__.sectionList.space.headingPaddingLeft,
55
+ const StyledSectionHeading = styled(SectionHeading)(() => ({
57
56
  marginBottom: 0,
58
57
  }));
59
58
 
@@ -75,6 +75,7 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
75
75
  value,
76
76
  supportedOrientations = ['portrait'],
77
77
  bottomSheetConfig = {},
78
+ assistiveInfoConfig,
78
79
  }: MultiSelectProps<V, T>) {
79
80
  const { isKeyboardVisible, keyboardHeight } = useKeyboard();
80
81
  const [open, setOpen] = useState(false);
@@ -116,7 +117,7 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
116
117
  {
117
118
  // prevent users from focusing TextInput
118
119
  }
119
- <View pointerEvents="none">
120
+ <View>
120
121
  <TextInput
121
122
  {...inputProps}
122
123
  label={label}
@@ -130,6 +131,7 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
130
131
  pointerEvents="none"
131
132
  style={style}
132
133
  testID={testID}
134
+ assistiveInfoConfig={assistiveInfoConfig}
133
135
  renderInputValue={
134
136
  renderSelectedValue !== undefined && rawValue?.length > 0
135
137
  ? (nativeInputProps) =>
@@ -59,6 +59,7 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
59
59
  value,
60
60
  supportedOrientations = ['portrait'],
61
61
  bottomSheetConfig = {},
62
+ assistiveInfoConfig,
62
63
  }: SingleSelectProps<V, T>) => {
63
64
  const { isKeyboardVisible, keyboardHeight } = useKeyboard();
64
65
  const [open, setOpen] = useState(false);
@@ -99,7 +100,7 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
99
100
  {
100
101
  // prevent users from focusing TextInput
101
102
  }
102
- <View pointerEvents="none">
103
+ <View>
103
104
  <TextInput
104
105
  {...inputProps}
105
106
  label={label}
@@ -110,9 +111,10 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
110
111
  editable={editable}
111
112
  disabled={disabled}
112
113
  required={required}
113
- pointerEvents="none"
114
114
  style={style}
115
115
  testID={testID}
116
+ pointerEvents="none"
117
+ assistiveInfoConfig={assistiveInfoConfig}
116
118
  renderInputValue={
117
119
  renderSelectedValue !== undefined && !!rawValue
118
120
  ? (nativeInputProps) =>
@@ -102,4 +102,13 @@ export interface SelectProps<V, T extends SelectOptionType<V>>
102
102
  variant?: BottomSheetProps['variant'];
103
103
  header?: BottomSheetProps['header'];
104
104
  };
105
+ /**
106
+ * Optional assistive info trigger config. When provided, an info icon is rendered
107
+ * below the field. `onPress` is called when the trigger is tapped.
108
+ */
109
+ assistiveInfoConfig?: {
110
+ onPress: () => void;
111
+ label?: string;
112
+ testID?: string;
113
+ };
105
114
  }
@@ -0,0 +1,13 @@
1
+ import { TouchableOpacity, View } from 'react-native';
2
+ import styled from '@emotion/native';
3
+
4
+ export const StyledTouchable = styled(TouchableOpacity)(() => ({
5
+ alignSelf: 'flex-start',
6
+ }));
7
+
8
+ export const StyledRow = styled(View)(({ theme }) => ({
9
+ flexDirection: 'row',
10
+ alignItems: 'center',
11
+ padding: theme.__hd__.textInput.space.assistiveInfoTriggerPadding,
12
+ gap: theme.__hd__.textInput.space.assistiveInfoTriggerGap,
13
+ }));
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import Icon from '../../Icon';
3
+ import Typography from '../../Typography';
4
+ import { StyledTouchable, StyledRow } from './StyledAssistiveInfoTrigger';
5
+
6
+ export interface AssistiveInfoTriggerProps {
7
+ onPress: () => void;
8
+ label?: string;
9
+ disabled?: boolean;
10
+ testID?: string;
11
+ accessibilityLabel?: string;
12
+ }
13
+
14
+ const AssistiveInfoTrigger = ({
15
+ accessibilityLabel,
16
+ disabled,
17
+ label,
18
+ onPress,
19
+ testID,
20
+ }: AssistiveInfoTriggerProps) => {
21
+ return (
22
+ <StyledTouchable
23
+ onPress={onPress}
24
+ disabled={disabled}
25
+ accessibilityLabel={accessibilityLabel ?? 'More information'}
26
+ accessibilityRole="button"
27
+ testID={testID}
28
+ >
29
+ <StyledRow>
30
+ <Icon
31
+ icon="circle-info-outlined"
32
+ size="xsmall"
33
+ intent={disabled ? 'disabled-text' : 'muted'}
34
+ />
35
+ {!!label && (
36
+ <Typography.Caption intent={disabled ? 'disabled' : 'muted'}>
37
+ {label}
38
+ </Typography.Caption>
39
+ )}
40
+ </StyledRow>
41
+ </StyledTouchable>
42
+ );
43
+ };
44
+
45
+ export default AssistiveInfoTrigger;
@@ -34,6 +34,7 @@ import {
34
34
  StyledHelperText,
35
35
  } from './StyledTextInput';
36
36
  import Icon from '../Icon';
37
+ import AssistiveInfoTrigger from './AssistiveInfoTrigger';
37
38
  import type { Theme } from '../../theme';
38
39
  import { useTheme } from '../../theme';
39
40
  import type { State } from './StyledTextInput';
@@ -141,6 +142,15 @@ export interface TextInputProps extends NativeTextInputProps {
141
142
  * Component variant.
142
143
  */
143
144
  variant?: TextInputVariant;
145
+ /**
146
+ * Optional assistive info trigger config. When provided, an info icon is rendered
147
+ * below the field. `onPress` is called when the trigger is tapped.
148
+ */
149
+ assistiveInfoConfig?: {
150
+ onPress: () => void;
151
+ label?: string;
152
+ testID?: string;
153
+ };
144
154
  }
145
155
 
146
156
  export const getState = ({
@@ -318,11 +328,13 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
318
328
  maxLength,
319
329
  hideCharacterCount = false,
320
330
  helpText,
331
+ assistiveInfoConfig,
321
332
  value,
322
333
  defaultValue,
323
334
  renderInputValue,
324
335
  allowFontScaling = false,
325
336
  variant = 'text',
337
+ pointerEvents,
326
338
  ...nativeProps
327
339
  }: TextInputProps,
328
340
  ref?: React.Ref<TextInputHandles>
@@ -464,22 +476,23 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
464
476
  : EMPTY_PLACEHOLDER_VALUE,
465
477
  };
466
478
 
479
+ const isPressable =
480
+ state !== 'disabled' && state !== 'readonly' && !loading;
481
+
467
482
  return (
468
- <StyledContainer
469
- style={styleWithoutBackgroundColor}
470
- pointerEvents={
471
- state === 'disabled' || state === 'readonly' || loading
472
- ? 'none'
473
- : 'auto'
474
- }
475
- testID={testID}
476
- >
483
+ <StyledContainer style={styleWithoutBackgroundColor} testID={testID}>
477
484
  <Pressable
478
- onPress={focusInnerTextInput}
485
+ onPress={isPressable ? focusInnerTextInput : undefined}
479
486
  accessible={false}
480
487
  importantForAccessibility="no"
488
+ disabled={!isPressable}
489
+ pointerEvents={pointerEvents}
481
490
  >
482
- <StyledTextInputContainer themeVariant={variant} themeState={state}>
491
+ <StyledTextInputContainer
492
+ themeVariant={variant}
493
+ themeState={state}
494
+ pointerEvents={isPressable ? 'auto' : 'none'}
495
+ >
483
496
  <StyledBorderBackDrop
484
497
  themeFocused={isFocused}
485
498
  themeState={state}
@@ -574,6 +587,14 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
574
587
  {renderSuffix({ state, loading, suffix })}
575
588
  </StyledTextInputContainer>
576
589
  </Pressable>
590
+ {!!assistiveInfoConfig && (
591
+ <AssistiveInfoTrigger
592
+ onPress={assistiveInfoConfig.onPress}
593
+ label={assistiveInfoConfig.label}
594
+ testID={assistiveInfoConfig.testID}
595
+ disabled={!isPressable}
596
+ />
597
+ )}
577
598
  <StyledErrorAndHelpTextContainer>
578
599
  <StyledErrorAndMaxLengthContainer>
579
600
  {renderErrorOrHelpText({ error, helpText })}
@@ -72,6 +72,8 @@ const getTextInputTheme = (theme: GlobalTheme) => {
72
72
  containerMarginTop: theme.space.small,
73
73
  labelInsideTextInputMarginTop: 0,
74
74
  errorAndHelpTextContainerPaddingTop: theme.space.xxsmall,
75
+ assistiveInfoTriggerPadding: theme.space.xsmall,
76
+ assistiveInfoTriggerGap: theme.space.xsmall,
75
77
  inputAndLabelContainerPaddingTop: theme.lineHeights.medium,
76
78
  labelFocusedTranslateY: theme.space.xsmall * 2,
77
79
  textareaLabelIdleTranslateY: theme.space.large,
@@ -26,5 +26,5 @@ export interface MultiSelectProps<V, T extends SelectOptionType<V> = SelectOptio
26
26
  */
27
27
  supportedOrientations?: ('portrait' | 'landscape')[];
28
28
  }
29
- declare function MultiSelect<V, T extends SelectOptionType<V>>({ footerLabel, label, loading, inputProps, onConfirm, onDismiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, required, style, testID, value, supportedOrientations, bottomSheetConfig, }: MultiSelectProps<V, T>): React.JSX.Element;
29
+ declare function MultiSelect<V, T extends SelectOptionType<V>>({ footerLabel, label, loading, inputProps, onConfirm, onDismiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, required, style, testID, value, supportedOrientations, bottomSheetConfig, assistiveInfoConfig, }: MultiSelectProps<V, T>): React.JSX.Element;
30
30
  export default MultiSelect;
@@ -19,5 +19,5 @@ export interface SingleSelectProps<V, T extends SelectOptionType<V> = SelectOpti
19
19
  */
20
20
  supportedOrientations?: ('portrait' | 'landscape')[];
21
21
  }
22
- declare const SingleSelect: <V, T extends SelectOptionType<V>>({ label, loading, inputProps, onConfirm, onDismiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, required, style, testID, value, supportedOrientations, bottomSheetConfig, }: SingleSelectProps<V, T>) => React.JSX.Element;
22
+ declare const SingleSelect: <V, T extends SelectOptionType<V>>({ label, loading, inputProps, onConfirm, onDismiss, onEndReached, onQueryChange, options, renderOption, renderSelectedValue, query, error, editable, disabled, required, style, testID, value, supportedOrientations, bottomSheetConfig, assistiveInfoConfig, }: SingleSelectProps<V, T>) => React.JSX.Element;
23
23
  export default SingleSelect;
@@ -81,4 +81,13 @@ export interface SelectProps<V, T extends SelectOptionType<V>> extends Pick<Text
81
81
  variant?: BottomSheetProps['variant'];
82
82
  header?: BottomSheetProps['header'];
83
83
  };
84
+ /**
85
+ * Optional assistive info trigger config. When provided, an info icon is rendered
86
+ * below the field. `onPress` is called when the trigger is tapped.
87
+ */
88
+ assistiveInfoConfig?: {
89
+ onPress: () => void;
90
+ label?: string;
91
+ testID?: string;
92
+ };
84
93
  }
@@ -0,0 +1,11 @@
1
+ import { View } from 'react-native';
2
+ export declare const StyledTouchable: import("@emotion/native").StyledComponent<import("react-native").TouchableOpacityProps & import("react").RefAttributes<View> & {
3
+ theme?: import("@emotion/react").Theme;
4
+ as?: React.ElementType;
5
+ }, {}, {}>;
6
+ export declare const StyledRow: import("@emotion/native").StyledComponent<import("react-native").ViewProps & {
7
+ theme?: import("@emotion/react").Theme;
8
+ as?: React.ElementType;
9
+ }, {}, {
10
+ ref?: import("react").Ref<View> | undefined;
11
+ }>;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ export interface AssistiveInfoTriggerProps {
3
+ onPress: () => void;
4
+ label?: string;
5
+ disabled?: boolean;
6
+ testID?: string;
7
+ accessibilityLabel?: string;
8
+ }
9
+ declare const AssistiveInfoTrigger: ({ accessibilityLabel, disabled, label, onPress, testID, }: AssistiveInfoTriggerProps) => React.JSX.Element;
10
+ export default AssistiveInfoTrigger;
@@ -94,6 +94,15 @@ export interface TextInputProps extends NativeTextInputProps {
94
94
  * Component variant.
95
95
  */
96
96
  variant?: TextInputVariant;
97
+ /**
98
+ * Optional assistive info trigger config. When provided, an info icon is rendered
99
+ * below the field. `onPress` is called when the trigger is tapped.
100
+ */
101
+ assistiveInfoConfig?: {
102
+ onPress: () => void;
103
+ label?: string;
104
+ testID?: string;
105
+ };
97
106
  }
98
107
  export declare const getState: ({ disabled, error, editable, loading, isEmptyValue, }: {
99
108
  disabled?: boolean;
@@ -69,6 +69,8 @@ declare const getTextInputTheme: (theme: GlobalTheme) => {
69
69
  containerMarginTop: number;
70
70
  labelInsideTextInputMarginTop: number;
71
71
  errorAndHelpTextContainerPaddingTop: number;
72
+ assistiveInfoTriggerPadding: number;
73
+ assistiveInfoTriggerGap: number;
72
74
  inputAndLabelContainerPaddingTop: number;
73
75
  labelFocusedTranslateY: number;
74
76
  textareaLabelIdleTranslateY: number;