@hero-design/rn 8.138.2 → 8.139.1

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.139.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#5558](https://github.com/Thinkei/hero-design/pull/5558) [`5367a2d`](https://github.com/Thinkei/hero-design/commit/5367a2dfeefae084e70f5da9a35fa48fd007cb7a) Thanks [@vinhphan-eh](https://github.com/vinhphan-eh)! - [Select] Fix options list collapsing behind keyboard in nested BottomSheet
8
+
9
+ ## 8.139.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#5555](https://github.com/Thinkei/hero-design/pull/5555) [`aca4be8`](https://github.com/Thinkei/hero-design/commit/aca4be85efca246d0ff27d27fe694bed5950fd7c) Thanks [@ttkien](https://github.com/ttkien)! - [Select] Add `disabled` option to `assistiveInfoConfig` so the assistive info trigger no longer follows the select's disabled state by default
14
+
15
+ - [#5555](https://github.com/Thinkei/hero-design/pull/5555) [`aca4be8`](https://github.com/Thinkei/hero-design/commit/aca4be85efca246d0ff27d27fe694bed5950fd7c) Thanks [@ttkien](https://github.com/ttkien)! - [TextInput] Add `disabled` option to `assistiveInfoConfig` so the assistive info trigger no longer follows the field's disabled/readonly/loading state by default
16
+
3
17
  ## 8.138.2
4
18
 
5
19
  ### Patch Changes
package/es/index.js CHANGED
@@ -21769,7 +21769,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
21769
21769
  onPress: assistiveInfoConfig.onPress,
21770
21770
  label: assistiveInfoConfig.label,
21771
21771
  testID: assistiveInfoConfig.testID,
21772
- disabled: !isPressable
21772
+ disabled: assistiveInfoConfig.disabled
21773
21773
  }), /*#__PURE__*/React__default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21774
21774
  error: error,
21775
21775
  helpText: helpText
@@ -27908,9 +27908,6 @@ function MultiSelect(_ref) {
27908
27908
  _ref$bottomSheetConfi = _ref.bottomSheetConfig,
27909
27909
  bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi,
27910
27910
  assistiveInfoConfig = _ref.assistiveInfoConfig;
27911
- var _useKeyboard = useKeyboard(),
27912
- isKeyboardVisible = _useKeyboard.isKeyboardVisible,
27913
- keyboardHeight = _useKeyboard.keyboardHeight;
27914
27911
  var _useState = useState(false),
27915
27912
  _useState2 = _slicedToArray(_useState, 2),
27916
27913
  open = _useState2[0],
@@ -27940,11 +27937,10 @@ function MultiSelect(_ref) {
27940
27937
  useEffect(function () {
27941
27938
  setSelectingValue(value);
27942
27939
  }, [open, value]);
27943
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(View, {
27944
- pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
27945
- }, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
27940
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(View, null, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
27946
27941
  onPress: onPress,
27947
- testID: "multi-select-touchable-opacity"
27942
+ testID: "multi-select-touchable-opacity",
27943
+ disabled: !editable || disabled || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.loading)
27948
27944
  }, /*#__PURE__*/React__default.createElement(View, null, /*#__PURE__*/React__default.createElement(TextInput, _extends$1({}, inputProps, {
27949
27945
  label: label,
27950
27946
  value: renderSelectedValue ? rawValue : displayedValue,
@@ -27969,9 +27965,6 @@ function MultiSelect(_ref) {
27969
27965
  setOpen(false);
27970
27966
  },
27971
27967
  header: bottomSheetHeader || label,
27972
- style: {
27973
- paddingBottom: isKeyboardVisible ? keyboardHeight : 0
27974
- },
27975
27968
  footer: typeof footerLabel === 'string' ? /*#__PURE__*/React__default.createElement(Footer, {
27976
27969
  label: footerLabel,
27977
27970
  onPress: function onPress() {
@@ -28122,9 +28115,6 @@ var SingleSelect = function SingleSelect(_ref) {
28122
28115
  _ref$bottomSheetConfi = _ref.bottomSheetConfig,
28123
28116
  bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi,
28124
28117
  assistiveInfoConfig = _ref.assistiveInfoConfig;
28125
- var _useKeyboard = useKeyboard(),
28126
- isKeyboardVisible = _useKeyboard.isKeyboardVisible,
28127
- keyboardHeight = _useKeyboard.keyboardHeight;
28128
28118
  var _useState = useState(false),
28129
28119
  _useState2 = _slicedToArray(_useState, 2),
28130
28120
  open = _useState2[0],
@@ -28147,11 +28137,10 @@ var SingleSelect = function SingleSelect(_ref) {
28147
28137
  }
28148
28138
  return undefined;
28149
28139
  }, [editable, disabled, open]);
28150
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(View, {
28151
- pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
28152
- }, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
28140
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(View, null, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
28153
28141
  onPress: onPress,
28154
- testID: "single-select-touchable-opacity"
28142
+ testID: "single-select-touchable-opacity",
28143
+ disabled: !editable || disabled || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.loading)
28155
28144
  }, /*#__PURE__*/React__default.createElement(View, null, /*#__PURE__*/React__default.createElement(TextInput, _extends$1({}, inputProps, {
28156
28145
  label: label,
28157
28146
  value: renderSelectedValue ? rawValue : displayedValue,
@@ -28176,9 +28165,6 @@ var SingleSelect = function SingleSelect(_ref) {
28176
28165
  setOpen(false);
28177
28166
  },
28178
28167
  header: bottomSheetHeader || label,
28179
- style: {
28180
- paddingBottom: isKeyboardVisible ? keyboardHeight : 0
28181
- },
28182
28168
  onAnimationEnd: function onAnimationEnd() {
28183
28169
  if (open === true) {
28184
28170
  var _sectionListRef$curre;
package/lib/index.js CHANGED
@@ -21798,7 +21798,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21798
21798
  onPress: assistiveInfoConfig.onPress,
21799
21799
  label: assistiveInfoConfig.label,
21800
21800
  testID: assistiveInfoConfig.testID,
21801
- disabled: !isPressable
21801
+ disabled: assistiveInfoConfig.disabled
21802
21802
  }), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21803
21803
  error: error,
21804
21804
  helpText: helpText
@@ -27937,9 +27937,6 @@ function MultiSelect(_ref) {
27937
27937
  _ref$bottomSheetConfi = _ref.bottomSheetConfig,
27938
27938
  bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi,
27939
27939
  assistiveInfoConfig = _ref.assistiveInfoConfig;
27940
- var _useKeyboard = useKeyboard(),
27941
- isKeyboardVisible = _useKeyboard.isKeyboardVisible,
27942
- keyboardHeight = _useKeyboard.keyboardHeight;
27943
27940
  var _useState = React.useState(false),
27944
27941
  _useState2 = _slicedToArray(_useState, 2),
27945
27942
  open = _useState2[0],
@@ -27969,11 +27966,10 @@ function MultiSelect(_ref) {
27969
27966
  React.useEffect(function () {
27970
27967
  setSelectingValue(value);
27971
27968
  }, [open, value]);
27972
- return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
27973
- pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
27974
- }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
27969
+ return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
27975
27970
  onPress: onPress,
27976
- testID: "multi-select-touchable-opacity"
27971
+ testID: "multi-select-touchable-opacity",
27972
+ disabled: !editable || disabled || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.loading)
27977
27973
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, /*#__PURE__*/React__namespace.default.createElement(TextInput, _extends$1({}, inputProps, {
27978
27974
  label: label,
27979
27975
  value: renderSelectedValue ? rawValue : displayedValue,
@@ -27998,9 +27994,6 @@ function MultiSelect(_ref) {
27998
27994
  setOpen(false);
27999
27995
  },
28000
27996
  header: bottomSheetHeader || label,
28001
- style: {
28002
- paddingBottom: isKeyboardVisible ? keyboardHeight : 0
28003
- },
28004
27997
  footer: typeof footerLabel === 'string' ? /*#__PURE__*/React__namespace.default.createElement(Footer, {
28005
27998
  label: footerLabel,
28006
27999
  onPress: function onPress() {
@@ -28151,9 +28144,6 @@ var SingleSelect = function SingleSelect(_ref) {
28151
28144
  _ref$bottomSheetConfi = _ref.bottomSheetConfig,
28152
28145
  bottomSheetConfig = _ref$bottomSheetConfi === void 0 ? {} : _ref$bottomSheetConfi,
28153
28146
  assistiveInfoConfig = _ref.assistiveInfoConfig;
28154
- var _useKeyboard = useKeyboard(),
28155
- isKeyboardVisible = _useKeyboard.isKeyboardVisible,
28156
- keyboardHeight = _useKeyboard.keyboardHeight;
28157
28147
  var _useState = React.useState(false),
28158
28148
  _useState2 = _slicedToArray(_useState, 2),
28159
28149
  open = _useState2[0],
@@ -28176,11 +28166,10 @@ var SingleSelect = function SingleSelect(_ref) {
28176
28166
  }
28177
28167
  return undefined;
28178
28168
  }, [editable, disabled, open]);
28179
- return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
28180
- pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
28181
- }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
28169
+ return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
28182
28170
  onPress: onPress,
28183
- testID: "single-select-touchable-opacity"
28171
+ testID: "single-select-touchable-opacity",
28172
+ disabled: !editable || disabled || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.loading)
28184
28173
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, /*#__PURE__*/React__namespace.default.createElement(TextInput, _extends$1({}, inputProps, {
28185
28174
  label: label,
28186
28175
  value: renderSelectedValue ? rawValue : displayedValue,
@@ -28205,9 +28194,6 @@ var SingleSelect = function SingleSelect(_ref) {
28205
28194
  setOpen(false);
28206
28195
  },
28207
28196
  header: bottomSheetHeader || label,
28208
- style: {
28209
- paddingBottom: isKeyboardVisible ? keyboardHeight : 0
28210
- },
28211
28197
  onAnimationEnd: function onAnimationEnd() {
28212
28198
  if (open === true) {
28213
28199
  var _sectionListRef$curre;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.138.2",
3
+ "version": "8.139.1",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -4,7 +4,6 @@ import type {
4
4
  SectionList,
5
5
  } from 'react-native';
6
6
  import { TouchableOpacity, View } from 'react-native';
7
- import { useKeyboard } from '../../../utils/helpers';
8
7
  import BottomSheet from '../../BottomSheet';
9
8
  import Box from '../../Box';
10
9
  import type { TextInputProps } from '../../TextInput';
@@ -77,7 +76,6 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
77
76
  bottomSheetConfig = {},
78
77
  assistiveInfoConfig,
79
78
  }: MultiSelectProps<V, T>) {
80
- const { isKeyboardVisible, keyboardHeight } = useKeyboard();
81
79
  const [open, setOpen] = useState(false);
82
80
  const [selectingValue, setSelectingValue] = useState(value);
83
81
  const sectionListRef = useRef<SectionList<T, SectionType>>(null);
@@ -105,14 +103,11 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
105
103
  }, [open, value]);
106
104
  return (
107
105
  <>
108
- <View
109
- pointerEvents={
110
- !editable || disabled || inputProps?.loading ? 'none' : 'auto'
111
- }
112
- >
106
+ <View>
113
107
  <TouchableOpacity
114
108
  onPress={onPress}
115
109
  testID="multi-select-touchable-opacity"
110
+ disabled={!editable || disabled || inputProps?.loading}
116
111
  >
117
112
  {
118
113
  // prevent users from focusing TextInput
@@ -150,9 +145,6 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
150
145
  setOpen(false);
151
146
  }}
152
147
  header={bottomSheetHeader || label}
153
- style={{
154
- paddingBottom: isKeyboardVisible ? keyboardHeight : 0,
155
- }}
156
148
  footer={
157
149
  typeof footerLabel === 'string' ? (
158
150
  <Footer
@@ -4,7 +4,7 @@ import type {
4
4
  SectionList,
5
5
  } from 'react-native';
6
6
  import { TouchableOpacity, View } from 'react-native';
7
- import { deepCompareValue, useKeyboard } from '../../../utils/helpers';
7
+ import { deepCompareValue } from '../../../utils/helpers';
8
8
  import BottomSheet from '../../BottomSheet';
9
9
  import type { TextInputProps } from '../../TextInput';
10
10
  import TextInput from '../../TextInput';
@@ -61,7 +61,6 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
61
61
  bottomSheetConfig = {},
62
62
  assistiveInfoConfig,
63
63
  }: SingleSelectProps<V, T>) => {
64
- const { isKeyboardVisible, keyboardHeight } = useKeyboard();
65
64
  const [open, setOpen] = useState(false);
66
65
  const sectionListRef = useRef<SectionList<T, SectionType>>(null);
67
66
  const sections = toSections(options);
@@ -88,14 +87,11 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
88
87
 
89
88
  return (
90
89
  <>
91
- <View
92
- pointerEvents={
93
- !editable || disabled || inputProps?.loading ? 'none' : 'auto'
94
- }
95
- >
90
+ <View>
96
91
  <TouchableOpacity
97
92
  onPress={onPress}
98
93
  testID="single-select-touchable-opacity"
94
+ disabled={!editable || disabled || inputProps?.loading}
99
95
  >
100
96
  {
101
97
  // prevent users from focusing TextInput
@@ -133,9 +129,6 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
133
129
  setOpen(false);
134
130
  }}
135
131
  header={bottomSheetHeader || label}
136
- style={{
137
- paddingBottom: isKeyboardVisible ? keyboardHeight : 0,
138
- }}
139
132
  onAnimationEnd={() => {
140
133
  if (open === true) {
141
134
  const scrollParams = getScrollParams(value, sections);
@@ -105,10 +105,14 @@ export interface SelectProps<V, T extends SelectOptionType<V>>
105
105
  /**
106
106
  * Optional assistive info trigger config. When provided, an info icon is rendered
107
107
  * below the field. `onPress` is called when the trigger is tapped.
108
+ * The trigger is always enabled regardless of the field's state (disabled, readonly,
109
+ * loading) so users can still access contextual help. Set `disabled: true` to
110
+ * explicitly suppress the trigger.
108
111
  */
109
112
  assistiveInfoConfig?: {
110
113
  onPress: () => void;
111
114
  label?: string;
112
115
  testID?: string;
116
+ disabled?: boolean;
113
117
  };
114
118
  }
@@ -145,11 +145,15 @@ export interface TextInputProps extends NativeTextInputProps {
145
145
  /**
146
146
  * Optional assistive info trigger config. When provided, an info icon is rendered
147
147
  * below the field. `onPress` is called when the trigger is tapped.
148
+ * The trigger is always enabled regardless of the field's state (disabled, readonly,
149
+ * loading) so users can still access contextual help. Set `disabled: true` to
150
+ * explicitly suppress the trigger.
148
151
  */
149
152
  assistiveInfoConfig?: {
150
153
  onPress: () => void;
151
154
  label?: string;
152
155
  testID?: string;
156
+ disabled?: boolean;
153
157
  };
154
158
  }
155
159
 
@@ -592,7 +596,7 @@ const TextInput = forwardRef<TextInputHandles, TextInputProps>(
592
596
  onPress={assistiveInfoConfig.onPress}
593
597
  label={assistiveInfoConfig.label}
594
598
  testID={assistiveInfoConfig.testID}
595
- disabled={!isPressable}
599
+ disabled={assistiveInfoConfig.disabled}
596
600
  />
597
601
  )}
598
602
  <StyledErrorAndHelpTextContainer>
@@ -84,10 +84,14 @@ export interface SelectProps<V, T extends SelectOptionType<V>> extends Pick<Text
84
84
  /**
85
85
  * Optional assistive info trigger config. When provided, an info icon is rendered
86
86
  * below the field. `onPress` is called when the trigger is tapped.
87
+ * The trigger is always enabled regardless of the field's state (disabled, readonly,
88
+ * loading) so users can still access contextual help. Set `disabled: true` to
89
+ * explicitly suppress the trigger.
87
90
  */
88
91
  assistiveInfoConfig?: {
89
92
  onPress: () => void;
90
93
  label?: string;
91
94
  testID?: string;
95
+ disabled?: boolean;
92
96
  };
93
97
  }
@@ -97,11 +97,15 @@ export interface TextInputProps extends NativeTextInputProps {
97
97
  /**
98
98
  * Optional assistive info trigger config. When provided, an info icon is rendered
99
99
  * below the field. `onPress` is called when the trigger is tapped.
100
+ * The trigger is always enabled regardless of the field's state (disabled, readonly,
101
+ * loading) so users can still access contextual help. Set `disabled: true` to
102
+ * explicitly suppress the trigger.
100
103
  */
101
104
  assistiveInfoConfig?: {
102
105
  onPress: () => void;
103
106
  label?: string;
104
107
  testID?: string;
108
+ disabled?: boolean;
105
109
  };
106
110
  }
107
111
  export declare const getState: ({ disabled, error, editable, loading, isEmptyValue, }: {