@hero-design/rn 8.138.1 → 8.139.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.139.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#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
8
+
9
+ - [#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
10
+
11
+ ## 8.138.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [#5551](https://github.com/Thinkei/hero-design/pull/5551) [`ddfb78e`](https://github.com/Thinkei/hero-design/commit/ddfb78e02e1a5098b0170271e21254e0bb2aa8fe) Thanks [@ttkien](https://github.com/ttkien)! - [List.Group] Fix missing divider between rows wrapped in a Fragment
16
+
3
17
  ## 8.138.1
4
18
 
5
19
  ### Patch Changes
package/es/index.js CHANGED
@@ -15935,6 +15935,14 @@ var StyledListGroupContainer = index$c(View)(function (_ref) {
15935
15935
  };
15936
15936
  });
15937
15937
 
15938
+ var _flattenFragments = function flattenFragments(children) {
15939
+ return React__default.Children.toArray(children).flatMap(function (child) {
15940
+ if (/*#__PURE__*/React__default.isValidElement(child) && child.type === React__default.Fragment) {
15941
+ return _flattenFragments(child.props.children);
15942
+ }
15943
+ return [child];
15944
+ });
15945
+ };
15938
15946
  var ERROR_CARD_VARIANT_UNSUPPORTED = 'List.Item with variant="card" is not supported inside List.Group. Use the default full-width variant instead.';
15939
15947
  // Typed `<T,>` rather than `ReactNode` so flatMap's inferred element type
15940
15948
  // stays narrow instead of widening to plain ReactNode, which broke type-check.
@@ -15951,7 +15959,7 @@ var ListGroup = function ListGroup(_ref) {
15951
15959
  style = _ref.style,
15952
15960
  marginHorizontal = _ref.marginHorizontal,
15953
15961
  testID = _ref.testID;
15954
- var rows = React__default.Children.toArray(children);
15962
+ var rows = _flattenFragments(children);
15955
15963
  var lastIndex = rows.length - 1;
15956
15964
  var content = rows.flatMap(function (row, index) {
15957
15965
  if (/*#__PURE__*/React__default.isValidElement(row) && row.type === ListItem && row.props.variant === 'card') {
@@ -21761,7 +21769,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
21761
21769
  onPress: assistiveInfoConfig.onPress,
21762
21770
  label: assistiveInfoConfig.label,
21763
21771
  testID: assistiveInfoConfig.testID,
21764
- disabled: !isPressable
21772
+ disabled: assistiveInfoConfig.disabled
21765
21773
  }), /*#__PURE__*/React__default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21766
21774
  error: error,
21767
21775
  helpText: helpText
@@ -27932,11 +27940,10 @@ function MultiSelect(_ref) {
27932
27940
  useEffect(function () {
27933
27941
  setSelectingValue(value);
27934
27942
  }, [open, value]);
27935
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(View, {
27936
- pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
27937
- }, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
27943
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(View, null, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
27938
27944
  onPress: onPress,
27939
- testID: "multi-select-touchable-opacity"
27945
+ testID: "multi-select-touchable-opacity",
27946
+ disabled: !editable || disabled || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.loading)
27940
27947
  }, /*#__PURE__*/React__default.createElement(View, null, /*#__PURE__*/React__default.createElement(TextInput, _extends$1({}, inputProps, {
27941
27948
  label: label,
27942
27949
  value: renderSelectedValue ? rawValue : displayedValue,
@@ -28139,11 +28146,10 @@ var SingleSelect = function SingleSelect(_ref) {
28139
28146
  }
28140
28147
  return undefined;
28141
28148
  }, [editable, disabled, open]);
28142
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(View, {
28143
- pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
28144
- }, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
28149
+ return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(View, null, /*#__PURE__*/React__default.createElement(TouchableOpacity, {
28145
28150
  onPress: onPress,
28146
- testID: "single-select-touchable-opacity"
28151
+ testID: "single-select-touchable-opacity",
28152
+ disabled: !editable || disabled || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.loading)
28147
28153
  }, /*#__PURE__*/React__default.createElement(View, null, /*#__PURE__*/React__default.createElement(TextInput, _extends$1({}, inputProps, {
28148
28154
  label: label,
28149
28155
  value: renderSelectedValue ? rawValue : displayedValue,
package/lib/index.js CHANGED
@@ -15964,6 +15964,14 @@ var StyledListGroupContainer = index$c(reactNative.View)(function (_ref) {
15964
15964
  };
15965
15965
  });
15966
15966
 
15967
+ var _flattenFragments = function flattenFragments(children) {
15968
+ return React__namespace.default.Children.toArray(children).flatMap(function (child) {
15969
+ if (/*#__PURE__*/React__namespace.default.isValidElement(child) && child.type === React__namespace.default.Fragment) {
15970
+ return _flattenFragments(child.props.children);
15971
+ }
15972
+ return [child];
15973
+ });
15974
+ };
15967
15975
  var ERROR_CARD_VARIANT_UNSUPPORTED = 'List.Item with variant="card" is not supported inside List.Group. Use the default full-width variant instead.';
15968
15976
  // Typed `<T,>` rather than `ReactNode` so flatMap's inferred element type
15969
15977
  // stays narrow instead of widening to plain ReactNode, which broke type-check.
@@ -15980,7 +15988,7 @@ var ListGroup = function ListGroup(_ref) {
15980
15988
  style = _ref.style,
15981
15989
  marginHorizontal = _ref.marginHorizontal,
15982
15990
  testID = _ref.testID;
15983
- var rows = React__namespace.default.Children.toArray(children);
15991
+ var rows = _flattenFragments(children);
15984
15992
  var lastIndex = rows.length - 1;
15985
15993
  var content = rows.flatMap(function (row, index) {
15986
15994
  if (/*#__PURE__*/React__namespace.default.isValidElement(row) && row.type === ListItem && row.props.variant === 'card') {
@@ -21790,7 +21798,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21790
21798
  onPress: assistiveInfoConfig.onPress,
21791
21799
  label: assistiveInfoConfig.label,
21792
21800
  testID: assistiveInfoConfig.testID,
21793
- disabled: !isPressable
21801
+ disabled: assistiveInfoConfig.disabled
21794
21802
  }), /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndHelpTextContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledErrorAndMaxLengthContainer, null, renderErrorOrHelpText({
21795
21803
  error: error,
21796
21804
  helpText: helpText
@@ -27961,11 +27969,10 @@ function MultiSelect(_ref) {
27961
27969
  React.useEffect(function () {
27962
27970
  setSelectingValue(value);
27963
27971
  }, [open, value]);
27964
- return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
27965
- pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
27966
- }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
27972
+ 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, {
27967
27973
  onPress: onPress,
27968
- testID: "multi-select-touchable-opacity"
27974
+ testID: "multi-select-touchable-opacity",
27975
+ disabled: !editable || disabled || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.loading)
27969
27976
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, /*#__PURE__*/React__namespace.default.createElement(TextInput, _extends$1({}, inputProps, {
27970
27977
  label: label,
27971
27978
  value: renderSelectedValue ? rawValue : displayedValue,
@@ -28168,11 +28175,10 @@ var SingleSelect = function SingleSelect(_ref) {
28168
28175
  }
28169
28176
  return undefined;
28170
28177
  }, [editable, disabled, open]);
28171
- return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
28172
- pointerEvents: !editable || disabled || inputProps !== null && inputProps !== void 0 && inputProps.loading ? 'none' : 'auto'
28173
- }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
28178
+ 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, {
28174
28179
  onPress: onPress,
28175
- testID: "single-select-touchable-opacity"
28180
+ testID: "single-select-touchable-opacity",
28181
+ disabled: !editable || disabled || (inputProps === null || inputProps === void 0 ? void 0 : inputProps.loading)
28176
28182
  }, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, /*#__PURE__*/React__namespace.default.createElement(TextInput, _extends$1({}, inputProps, {
28177
28183
  label: label,
28178
28184
  value: renderSelectedValue ? rawValue : displayedValue,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.138.1",
3
+ "version": "8.139.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -7,6 +7,18 @@ import type { ListItemProps } from './ListItem';
7
7
  import { StyledListGroupContainer } from './StyledListGroup';
8
8
  import type { MarginHorizontal } from './StyledListGroup';
9
9
 
10
+ const flattenFragments = (children: ReactNode): ReactNode[] => {
11
+ return React.Children.toArray(children).flatMap((child) => {
12
+ if (
13
+ React.isValidElement<{ children?: ReactNode }>(child) &&
14
+ child.type === React.Fragment
15
+ ) {
16
+ return flattenFragments(child.props.children);
17
+ }
18
+ return [child];
19
+ });
20
+ };
21
+
10
22
  export const ERROR_CARD_VARIANT_UNSUPPORTED =
11
23
  'List.Item with variant="card" is not supported inside List.Group. Use the default full-width variant instead.';
12
24
 
@@ -49,7 +61,7 @@ const ListGroup = ({
49
61
  marginHorizontal,
50
62
  testID,
51
63
  }: ListGroupProps): ReactElement => {
52
- const rows = React.Children.toArray(children);
64
+ const rows = flattenFragments(children);
53
65
  const lastIndex = rows.length - 1;
54
66
 
55
67
  const content: ReactNode[] = rows.flatMap((row, index) => {
@@ -105,14 +105,11 @@ function MultiSelect<V, T extends SelectOptionType<V>>({
105
105
  }, [open, value]);
106
106
  return (
107
107
  <>
108
- <View
109
- pointerEvents={
110
- !editable || disabled || inputProps?.loading ? 'none' : 'auto'
111
- }
112
- >
108
+ <View>
113
109
  <TouchableOpacity
114
110
  onPress={onPress}
115
111
  testID="multi-select-touchable-opacity"
112
+ disabled={!editable || disabled || inputProps?.loading}
116
113
  >
117
114
  {
118
115
  // prevent users from focusing TextInput
@@ -88,14 +88,11 @@ const SingleSelect = <V, T extends SelectOptionType<V>>({
88
88
 
89
89
  return (
90
90
  <>
91
- <View
92
- pointerEvents={
93
- !editable || disabled || inputProps?.loading ? 'none' : 'auto'
94
- }
95
- >
91
+ <View>
96
92
  <TouchableOpacity
97
93
  onPress={onPress}
98
94
  testID="single-select-touchable-opacity"
95
+ disabled={!editable || disabled || inputProps?.loading}
99
96
  >
100
97
  {
101
98
  // prevent users from focusing TextInput
@@ -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, }: {