@hero-design/rn 8.109.0 → 8.109.2

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.
@@ -1,4 +1,4 @@
1
- (node:3326) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
1
+ (node:3312) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
2
2
  (Use `node --trace-warnings ...` to show where the warning was created)
3
3
  
4
4
  src/index.ts → lib/index.js, es/index.js...
@@ -9,9 +9,9 @@ node_modules/d3-selection/src/selection/index.js -> node_modules/d3-selection/sr
9
9
  ...and 12 more
10
10
  (!) [plugin replace] @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
11
11
  (!) [plugin node-resolve] preferring built-in module 'events' over local alternative at '/home/runner/work/hero-design/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.
12
- created lib/index.js, es/index.js in 1m 12.1s
12
+ created lib/index.js, es/index.js in 1m 11.5s
13
13
  
14
14
  /home/runner/work/hero-design/hero-design/packages/rn/src/locales/en_AU.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/en_CA.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/index.ts, /home/runner/work/hero-design/hero-design/packages/rn/src/locales/types.ts → ., ....
15
15
  (!) Generated empty chunks
16
16
  "locales/types" and "locales/types"
17
- created ., . in 20.9s
17
+ created ., . in 20.2s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.109.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4237](https://github.com/Thinkei/hero-design/pull/4237) [`746100e1369da6411eb771a0f153da6ac9a6dcf9`](https://github.com/Thinkei/hero-design/commit/746100e1369da6411eb771a0f153da6ac9a6dcf9) Thanks [@ngvuthanhnhan-eh-hi](https://github.com/ngvuthanhnhan-eh-hi)! - [Toolbar.Message] Fix the shrinkage issue on iPad
8
+
9
+ - [#4241](https://github.com/Thinkei/hero-design/pull/4241) [`c901f282aa0d46d38f03470c823696e87632d9ef`](https://github.com/Thinkei/hero-design/commit/c901f282aa0d46d38f03470c823696e87632d9ef) Thanks [@khoaddtran](https://github.com/khoaddtran)! - [RichTextEditor] Fix rich text editor is reset when height changed on Android
10
+
11
+ ## 8.109.1
12
+
13
+ ### Patch Changes
14
+
15
+ - [#4236](https://github.com/Thinkei/hero-design/pull/4236) [`a873d35cddd56b5302bd4d0f95a2dfa887be995e`](https://github.com/Thinkei/hero-design/commit/a873d35cddd56b5302bd4d0f95a2dfa887be995e) Thanks [@cuongnguyeneh](https://github.com/cuongnguyeneh)! - [Button] call onPress callback with no args
16
+
3
17
  ## 8.109.0
4
18
 
5
19
  ### Minor Changes
package/es/index.js CHANGED
@@ -7283,7 +7283,7 @@ var getToolbarTheme = function getToolbarTheme(theme) {
7283
7283
  var sizes = {
7284
7284
  itemWrapperHeight: scale(64),
7285
7285
  messageWrapperHeight: scale(64),
7286
- messageInputHeight: 40
7286
+ messageInputHeight: scale(40)
7287
7287
  };
7288
7288
  var radii = {
7289
7289
  iconButtonWrapperBorderRadius: theme.radii.xxxlarge,
@@ -10932,6 +10932,9 @@ var Button = function Button(_ref) {
10932
10932
  _useState2 = _slicedToArray(_useState, 2),
10933
10933
  isPressed = _useState2[0],
10934
10934
  setIsPressed = _useState2[1];
10935
+ var handlePress = useCallback(function () {
10936
+ return onPress();
10937
+ }, [onPress]);
10935
10938
  useDeprecation("Button variant ".concat(deprecatedVariants.join(', '), " are deprecated."), deprecatedVariants.includes(themeVariant));
10936
10939
  var isCompactVariant = ['filled-compact', 'outlined-compact', 'text-compact', 'inline-text-compact'].includes(variant);
10937
10940
  var isMediumVariant = ['filled-medium', 'outlined-medium', 'text-medium'].includes(variant);
@@ -10981,7 +10984,7 @@ var Button = function Button(_ref) {
10981
10984
  accessibilityLabel: accessibilityLabel,
10982
10985
  disabled: disabled || loading,
10983
10986
  loading: loading,
10984
- onPress: onPress,
10987
+ onPress: handlePress,
10985
10988
  testID: testID,
10986
10989
  themeButtonVariant: themeVariant,
10987
10990
  style: style,
@@ -47508,13 +47511,20 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
47508
47511
  break;
47509
47512
  }
47510
47513
  }, [onFocus, onBlur]);
47511
- return /*#__PURE__*/React__default.createElement(TouchableWithoutFeedback, {
47514
+ return /*#__PURE__*/React__default.createElement(View, {
47515
+ testID: "webViewWrapper",
47516
+ style: {
47517
+ height: webviewHeight,
47518
+ width: '100%'
47519
+ }
47520
+ }, /*#__PURE__*/React__default.createElement(TouchableWithoutFeedback, {
47512
47521
  onPress: function onPress(e) {
47513
47522
  return e.stopPropagation();
47514
47523
  }
47515
47524
  }, /*#__PURE__*/React__default.createElement(StyledWebView, {
47516
47525
  hideKeyboardAccessoryView: true,
47517
47526
  ref: webview,
47527
+ style: style,
47518
47528
  testID: testID,
47519
47529
  source: {
47520
47530
  html: html
@@ -47522,11 +47532,9 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
47522
47532
  onMessage: onMessage,
47523
47533
  scrollEnabled: false,
47524
47534
  originWhitelist: ['*'],
47525
- keyboardDisplayRequiresUserAction: false,
47526
- style: StyleSheet$1.flatten([style, {
47527
- height: webviewHeight
47528
- }])
47529
- }));
47535
+ showsVerticalScrollIndicator: false,
47536
+ keyboardDisplayRequiresUserAction: false
47537
+ })));
47530
47538
  };
47531
47539
 
47532
47540
  var defaultValue = [{
@@ -47648,9 +47656,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
47648
47656
  }, /*#__PURE__*/React__default.createElement(StyledBorderBackDrop, {
47649
47657
  themeState: state,
47650
47658
  themeFocused: isFocused
47651
- }), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, {
47652
- testID: "webViewWrapper"
47653
- }, /*#__PURE__*/React__default.createElement(BaseRichTextEditor, {
47659
+ }), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, null, /*#__PURE__*/React__default.createElement(BaseRichTextEditor, {
47654
47660
  name: name,
47655
47661
  value: value,
47656
47662
  style: [style, {
package/lib/index.js CHANGED
@@ -7312,7 +7312,7 @@ var getToolbarTheme = function getToolbarTheme(theme) {
7312
7312
  var sizes = {
7313
7313
  itemWrapperHeight: scale(64),
7314
7314
  messageWrapperHeight: scale(64),
7315
- messageInputHeight: 40
7315
+ messageInputHeight: scale(40)
7316
7316
  };
7317
7317
  var radii = {
7318
7318
  iconButtonWrapperBorderRadius: theme.radii.xxxlarge,
@@ -10961,6 +10961,9 @@ var Button = function Button(_ref) {
10961
10961
  _useState2 = _slicedToArray(_useState, 2),
10962
10962
  isPressed = _useState2[0],
10963
10963
  setIsPressed = _useState2[1];
10964
+ var handlePress = React.useCallback(function () {
10965
+ return onPress();
10966
+ }, [onPress]);
10964
10967
  useDeprecation("Button variant ".concat(deprecatedVariants.join(', '), " are deprecated."), deprecatedVariants.includes(themeVariant));
10965
10968
  var isCompactVariant = ['filled-compact', 'outlined-compact', 'text-compact', 'inline-text-compact'].includes(variant);
10966
10969
  var isMediumVariant = ['filled-medium', 'outlined-medium', 'text-medium'].includes(variant);
@@ -11010,7 +11013,7 @@ var Button = function Button(_ref) {
11010
11013
  accessibilityLabel: accessibilityLabel,
11011
11014
  disabled: disabled || loading,
11012
11015
  loading: loading,
11013
- onPress: onPress,
11016
+ onPress: handlePress,
11014
11017
  testID: testID,
11015
11018
  themeButtonVariant: themeVariant,
11016
11019
  style: style,
@@ -47537,13 +47540,20 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
47537
47540
  break;
47538
47541
  }
47539
47542
  }, [onFocus, onBlur]);
47540
- return /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableWithoutFeedback, {
47543
+ return /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
47544
+ testID: "webViewWrapper",
47545
+ style: {
47546
+ height: webviewHeight,
47547
+ width: '100%'
47548
+ }
47549
+ }, /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableWithoutFeedback, {
47541
47550
  onPress: function onPress(e) {
47542
47551
  return e.stopPropagation();
47543
47552
  }
47544
47553
  }, /*#__PURE__*/React__namespace.default.createElement(StyledWebView, {
47545
47554
  hideKeyboardAccessoryView: true,
47546
47555
  ref: webview,
47556
+ style: style,
47547
47557
  testID: testID,
47548
47558
  source: {
47549
47559
  html: html
@@ -47551,11 +47561,9 @@ var BaseRichTextEditor = function BaseRichTextEditor(_ref) {
47551
47561
  onMessage: onMessage,
47552
47562
  scrollEnabled: false,
47553
47563
  originWhitelist: ['*'],
47554
- keyboardDisplayRequiresUserAction: false,
47555
- style: reactNative.StyleSheet.flatten([style, {
47556
- height: webviewHeight
47557
- }])
47558
- }));
47564
+ showsVerticalScrollIndicator: false,
47565
+ keyboardDisplayRequiresUserAction: false
47566
+ })));
47559
47567
  };
47560
47568
 
47561
47569
  var defaultValue = [{
@@ -47677,9 +47685,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
47677
47685
  }, /*#__PURE__*/React__namespace.default.createElement(StyledBorderBackDrop, {
47678
47686
  themeState: state,
47679
47687
  themeFocused: isFocused
47680
- }), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputAndLabelContainer, {
47681
- testID: "webViewWrapper"
47682
- }, /*#__PURE__*/React__namespace.default.createElement(BaseRichTextEditor, {
47688
+ }), /*#__PURE__*/React__namespace.default.createElement(StyledTextInputAndLabelContainer, null, /*#__PURE__*/React__namespace.default.createElement(BaseRichTextEditor, {
47683
47689
  name: name,
47684
47690
  value: value,
47685
47691
  style: [style, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.109.0",
3
+ "version": "8.109.2",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1,5 +1,5 @@
1
1
  import type { ReactChild, ReactNode } from 'react';
2
- import React, { useMemo, useState } from 'react';
2
+ import React, { useCallback, useMemo, useState } from 'react';
3
3
  import type { StyleProp, ViewStyle } from 'react-native';
4
4
  import type { Theme } from '../../theme';
5
5
  import { useTheme } from '../../theme';
@@ -193,6 +193,7 @@ const Button = ({
193
193
  return isInlineText ? 'transparent' : getUnderlayColor(theme, themeVariant);
194
194
  }, [theme, themeVariant, isInlineText]);
195
195
  const [isPressed, setIsPressed] = useState(false);
196
+ const handlePress = useCallback(() => onPress(), [onPress]);
196
197
 
197
198
  useDeprecation(
198
199
  `Button variant ${deprecatedVariants.join(', ')} are deprecated.`,
@@ -282,7 +283,7 @@ const Button = ({
282
283
  accessibilityLabel={accessibilityLabel}
283
284
  disabled={disabled || loading}
284
285
  loading={loading}
285
- onPress={onPress}
286
+ onPress={handlePress}
286
287
  testID={testID}
287
288
  themeButtonVariant={themeVariant}
288
289
  style={style}
@@ -104,6 +104,15 @@ describe('Button', () => {
104
104
  fireEvent.press(getByText('A button'));
105
105
  expect(onPress).toHaveBeenCalledTimes(1);
106
106
  });
107
+
108
+ it('triggers onPress with no arguments', () => {
109
+ const onPress = jest.fn();
110
+ const { getByText } = renderWithTheme(
111
+ <Button text="A button" onPress={onPress} />
112
+ );
113
+ fireEvent.press(getByText('A button'));
114
+ expect(onPress).toHaveBeenCalledWith();
115
+ });
107
116
  });
108
117
  });
109
118
 
@@ -7,7 +7,7 @@ import React, {
7
7
  useState,
8
8
  } from 'react';
9
9
 
10
- import { TouchableWithoutFeedback, StyleSheet } from 'react-native';
10
+ import { TouchableWithoutFeedback, View } from 'react-native';
11
11
  import type { WebView } from 'react-native-webview';
12
12
  import type { ReactElement, Ref } from 'react';
13
13
  import type { StyleProp, ViewStyle } from 'react-native';
@@ -282,19 +282,25 @@ const BaseRichTextEditor = ({
282
282
  );
283
283
 
284
284
  return (
285
- <TouchableWithoutFeedback onPress={(e) => e.stopPropagation()}>
286
- <StyledWebView
287
- hideKeyboardAccessoryView
288
- ref={webview}
289
- testID={testID}
290
- source={{ html }}
291
- onMessage={onMessage}
292
- scrollEnabled={false}
293
- originWhitelist={['*']}
294
- keyboardDisplayRequiresUserAction={false}
295
- style={StyleSheet.flatten([style, { height: webviewHeight }])}
296
- />
297
- </TouchableWithoutFeedback>
285
+ <View
286
+ testID="webViewWrapper"
287
+ style={{ height: webviewHeight, width: '100%' }}
288
+ >
289
+ <TouchableWithoutFeedback onPress={(e) => e.stopPropagation()}>
290
+ <StyledWebView
291
+ hideKeyboardAccessoryView
292
+ ref={webview}
293
+ style={style}
294
+ testID={testID}
295
+ source={{ html }}
296
+ onMessage={onMessage}
297
+ scrollEnabled={false}
298
+ originWhitelist={['*']}
299
+ showsVerticalScrollIndicator={false}
300
+ keyboardDisplayRequiresUserAction={false}
301
+ />
302
+ </TouchableWithoutFeedback>
303
+ </View>
298
304
  );
299
305
  };
300
306
 
@@ -188,7 +188,7 @@ const RichTextEditor = ({
188
188
  <StyledTextInputContainer onLayout={onLayout}>
189
189
  <StyledBorderBackDrop themeState={state} themeFocused={isFocused} />
190
190
 
191
- <StyledTextInputAndLabelContainer testID="webViewWrapper">
191
+ <StyledTextInputAndLabelContainer>
192
192
  <BaseRichTextEditor
193
193
  name={name}
194
194
  value={value}
@@ -201,7 +201,7 @@ describe('RichTextEditor', () => {
201
201
  );
202
202
 
203
203
  expect(wrapper.toJSON()).toMatchSnapshot();
204
- expect(wrapper.getByTestId('webview')).toHaveStyle({
204
+ expect(wrapper.getByTestId('webViewWrapper')).toHaveStyle({
205
205
  height: 480,
206
206
  });
207
207
  });
@@ -135,38 +135,47 @@ exports[`RichTextEditor onMessage received event editor-layout should update hei
135
135
  undefined,
136
136
  ]
137
137
  }
138
- testID="webViewWrapper"
139
138
  >
140
- <WebView
141
- accessibilityState={
139
+ <View
140
+ style={
142
141
  {
143
- "busy": undefined,
144
- "checked": undefined,
145
- "disabled": undefined,
146
- "expanded": undefined,
147
- "selected": undefined,
142
+ "height": 480,
143
+ "width": "100%",
148
144
  }
149
145
  }
150
- accessible={true}
151
- focusable={true}
152
- hideKeyboardAccessoryView={true}
153
- keyboardDisplayRequiresUserAction={false}
154
- onClick={[Function]}
155
- onResponderGrant={[Function]}
156
- onResponderMove={[Function]}
157
- onResponderRelease={[Function]}
158
- onResponderTerminate={[Function]}
159
- onResponderTerminationRequest={[Function]}
160
- onStartShouldSetResponder={[Function]}
161
- originWhitelist={
162
- [
163
- "*",
164
- ]
165
- }
166
- scrollEnabled={false}
167
- source={
168
- {
169
- "html": "
146
+ testID="webViewWrapper"
147
+ >
148
+ <WebView
149
+ accessibilityState={
150
+ {
151
+ "busy": undefined,
152
+ "checked": undefined,
153
+ "disabled": undefined,
154
+ "expanded": undefined,
155
+ "selected": undefined,
156
+ }
157
+ }
158
+ accessible={true}
159
+ focusable={true}
160
+ hideKeyboardAccessoryView={true}
161
+ keyboardDisplayRequiresUserAction={false}
162
+ onClick={[Function]}
163
+ onResponderGrant={[Function]}
164
+ onResponderMove={[Function]}
165
+ onResponderRelease={[Function]}
166
+ onResponderTerminate={[Function]}
167
+ onResponderTerminationRequest={[Function]}
168
+ onStartShouldSetResponder={[Function]}
169
+ originWhitelist={
170
+ [
171
+ "*",
172
+ ]
173
+ }
174
+ scrollEnabled={false}
175
+ showsVerticalScrollIndicator={false}
176
+ source={
177
+ {
178
+ "html": "
170
179
  <!DOCTYPE html>
171
180
  <html>
172
181
  <head>
@@ -197,25 +206,29 @@ exports[`RichTextEditor onMessage received event editor-layout should update hei
197
206
  </body>
198
207
  </html>
199
208
  ",
209
+ }
200
210
  }
201
- }
202
- style={
203
- [
204
- {
205
- "backgroundColor": "transparent",
206
- "fontSize": 16,
207
- "minHeight": 24,
208
- "textAlignVertical": "center",
209
- },
210
- {
211
- "backgroundColor": "yellow",
212
- "height": 480,
213
- "marginHorizontal": 8,
214
- },
215
- ]
216
- }
217
- testID="webview"
218
- />
211
+ style={
212
+ [
213
+ {
214
+ "backgroundColor": "transparent",
215
+ "fontSize": 16,
216
+ "minHeight": 24,
217
+ "textAlignVertical": "center",
218
+ },
219
+ [
220
+ {
221
+ "backgroundColor": "yellow",
222
+ },
223
+ {
224
+ "marginHorizontal": 8,
225
+ },
226
+ ],
227
+ ]
228
+ }
229
+ testID="webview"
230
+ />
231
+ </View>
219
232
  </View>
220
233
  </View>
221
234
  <View
@@ -460,38 +473,47 @@ exports[`RichTextEditor should render correctly 1`] = `
460
473
  undefined,
461
474
  ]
462
475
  }
463
- testID="webViewWrapper"
464
476
  >
465
- <WebView
466
- accessibilityState={
477
+ <View
478
+ style={
467
479
  {
468
- "busy": undefined,
469
- "checked": undefined,
470
- "disabled": undefined,
471
- "expanded": undefined,
472
- "selected": undefined,
480
+ "height": undefined,
481
+ "width": "100%",
473
482
  }
474
483
  }
475
- accessible={true}
476
- focusable={true}
477
- hideKeyboardAccessoryView={true}
478
- keyboardDisplayRequiresUserAction={false}
479
- onClick={[Function]}
480
- onResponderGrant={[Function]}
481
- onResponderMove={[Function]}
482
- onResponderRelease={[Function]}
483
- onResponderTerminate={[Function]}
484
- onResponderTerminationRequest={[Function]}
485
- onStartShouldSetResponder={[Function]}
486
- originWhitelist={
487
- [
488
- "*",
489
- ]
490
- }
491
- scrollEnabled={false}
492
- source={
493
- {
494
- "html": "
484
+ testID="webViewWrapper"
485
+ >
486
+ <WebView
487
+ accessibilityState={
488
+ {
489
+ "busy": undefined,
490
+ "checked": undefined,
491
+ "disabled": undefined,
492
+ "expanded": undefined,
493
+ "selected": undefined,
494
+ }
495
+ }
496
+ accessible={true}
497
+ focusable={true}
498
+ hideKeyboardAccessoryView={true}
499
+ keyboardDisplayRequiresUserAction={false}
500
+ onClick={[Function]}
501
+ onResponderGrant={[Function]}
502
+ onResponderMove={[Function]}
503
+ onResponderRelease={[Function]}
504
+ onResponderTerminate={[Function]}
505
+ onResponderTerminationRequest={[Function]}
506
+ onStartShouldSetResponder={[Function]}
507
+ originWhitelist={
508
+ [
509
+ "*",
510
+ ]
511
+ }
512
+ scrollEnabled={false}
513
+ showsVerticalScrollIndicator={false}
514
+ source={
515
+ {
516
+ "html": "
495
517
  <!DOCTYPE html>
496
518
  <html>
497
519
  <head>
@@ -522,25 +544,29 @@ exports[`RichTextEditor should render correctly 1`] = `
522
544
  </body>
523
545
  </html>
524
546
  ",
547
+ }
525
548
  }
526
- }
527
- style={
528
- [
529
- {
530
- "backgroundColor": "transparent",
531
- "fontSize": 16,
532
- "minHeight": 24,
533
- "textAlignVertical": "center",
534
- },
535
- {
536
- "backgroundColor": "yellow",
537
- "height": undefined,
538
- "marginHorizontal": 8,
539
- },
540
- ]
541
- }
542
- testID="webview"
543
- />
549
+ style={
550
+ [
551
+ {
552
+ "backgroundColor": "transparent",
553
+ "fontSize": 16,
554
+ "minHeight": 24,
555
+ "textAlignVertical": "center",
556
+ },
557
+ [
558
+ {
559
+ "backgroundColor": "yellow",
560
+ },
561
+ {
562
+ "marginHorizontal": 8,
563
+ },
564
+ ],
565
+ ]
566
+ }
567
+ testID="webview"
568
+ />
569
+ </View>
544
570
  </View>
545
571
  </View>
546
572
  <View
@@ -37,7 +37,7 @@ const getToolbarTheme = (theme: GlobalTheme) => {
37
37
  const sizes = {
38
38
  itemWrapperHeight: scale(64),
39
39
  messageWrapperHeight: scale(64),
40
- messageInputHeight: 40,
40
+ messageInputHeight: scale(40),
41
41
  };
42
42
 
43
43
  const radii = {