@hero-design/rn 8.87.1 → 8.88.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.
Files changed (32) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/CHANGELOG.md +18 -0
  3. package/es/index.js +119 -59
  4. package/lib/index.js +119 -59
  5. package/package.json +2 -2
  6. package/src/components/AppCue/StyledAppCue.tsx +27 -1
  7. package/src/components/AppCue/__tests__/StyledAppCue.tsx +4 -0
  8. package/src/components/AppCue/__tests__/__snapshots__/StyledAppCue.tsx.snap +194 -0
  9. package/src/components/AppCue/__tests__/__snapshots__/index.spec.tsx.snap +260 -0
  10. package/src/components/AppCue/__tests__/index.spec.tsx +4 -0
  11. package/src/components/AppCue/__tests__/utils.spec.ts +57 -4
  12. package/src/components/AppCue/index.tsx +7 -4
  13. package/src/components/AppCue/utils.ts +60 -9
  14. package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +18 -15
  15. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +6 -5
  16. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +6 -5
  17. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +12 -10
  18. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
  19. package/src/components/Empty/index.tsx +1 -1
  20. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +8 -0
  21. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +42 -35
  22. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +36 -30
  23. package/src/components/TextInput/StyledTextInput.tsx +4 -0
  24. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +20 -0
  25. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +446 -432
  26. package/src/components/TextInput/index.tsx +13 -32
  27. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +12 -10
  28. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +12 -10
  29. package/stats/8.87.2/rn-stats.html +4844 -0
  30. package/stats/8.88.0/rn-stats.html +4844 -0
  31. package/types/components/AppCue/StyledAppCue.d.ts +1 -1
  32. package/types/components/AppCue/utils.d.ts +6 -3
@@ -1,4 +1,4 @@
1
- (node:2961) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
1
+ (node:3003) 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...
@@ -10,4 +10,4 @@
10
10
     ~~~~~~~~~~~~~~~~~~~
11
11
  
12
12
  (!) [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.
13
- created lib/index.js, es/index.js in 52.6s
13
+ created lib/index.js, es/index.js in 52.4s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @hero-design/rn
2
2
 
3
+ ## 8.88.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#3630](https://github.com/Thinkei/hero-design/pull/3630) [`b4ae9bf3fe00b4a7a27d2919eb7ef83a7d391e59`](https://github.com/Thinkei/hero-design/commit/b4ae9bf3fe00b4a7a27d2919eb7ef83a7d391e59) Thanks [@phucdph](https://github.com/phucdph)! - [AppCue] Support top-left, top-right, bottom-left, bottom-right placement
8
+
9
+ ### Patch Changes
10
+
11
+ - [#3633](https://github.com/Thinkei/hero-design/pull/3633) [`040aa3235d512304df0dc00c4aa3c26766f1fc1c`](https://github.com/Thinkei/hero-design/commit/040aa3235d512304df0dc00c4aa3c26766f1fc1c) Thanks [@luanlai2201](https://github.com/luanlai2201)! - [TextInput] Fix label when has value do not align with another TextInput
12
+
13
+ - [#3638](https://github.com/Thinkei/hero-design/pull/3638) [`4a5628d321f2c6b9dcb96c62b1ceed999a6ec7b7`](https://github.com/Thinkei/hero-design/commit/4a5628d321f2c6b9dcb96c62b1ceed999a6ec7b7) Thanks [@ttkien](https://github.com/ttkien)! - [Empty] Update descrption typeface and font size
14
+
15
+ ## 8.87.2
16
+
17
+ ### Patch Changes
18
+
19
+ - [#3623](https://github.com/Thinkei/hero-design/pull/3623) [`4898fef1ef1a0c8b4c809188471ba487474bbb28`](https://github.com/Thinkei/hero-design/commit/4898fef1ef1a0c8b4c809188471ba487474bbb28) Thanks [@khoaddtran](https://github.com/khoaddtran)! - Bump hero-editor to 1.15.5
20
+
3
21
  ## 8.87.1
4
22
 
5
23
  ### Patch Changes
package/es/index.js CHANGED
@@ -5856,10 +5856,10 @@ function requireUnit() {
5856
5856
  return unit;
5857
5857
  }
5858
5858
 
5859
- var lib$1;
5859
+ var lib$2;
5860
5860
  var hasRequiredLib$1;
5861
5861
  function requireLib$1() {
5862
- if (hasRequiredLib$1) return lib$1;
5862
+ if (hasRequiredLib$1) return lib$2;
5863
5863
  hasRequiredLib$1 = 1;
5864
5864
  var parse = requireParse();
5865
5865
  var walk = requireWalk();
@@ -5881,8 +5881,8 @@ function requireLib$1() {
5881
5881
  ValueParser.unit = requireUnit();
5882
5882
  ValueParser.walk = walk;
5883
5883
  ValueParser.stringify = stringify;
5884
- lib$1 = ValueParser;
5885
- return lib$1;
5884
+ lib$2 = ValueParser;
5885
+ return lib$2;
5886
5886
  }
5887
5887
 
5888
5888
  var camelize;
@@ -8358,7 +8358,7 @@ var StyledContainer$9 = index$a(View)(function (_ref2) {
8358
8358
  var StyledIconContainer$1 = index$a(Animated.View)(function (_ref3) {
8359
8359
  var theme = _ref3.theme,
8360
8360
  themePlacement = _ref3.themePlacement;
8361
- return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
8361
+ return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
8362
8362
  position: 'absolute',
8363
8363
  color: theme.__hd__.appCue.colors.background,
8364
8364
  display: 'flex',
@@ -8385,6 +8385,24 @@ var StyledIconContainer$1 = index$a(Animated.View)(function (_ref3) {
8385
8385
  rotate: '-90deg'
8386
8386
  }],
8387
8387
  height: '100%'
8388
+ }), themePlacement === 'top-left' && {
8389
+ bottom: -theme.__hd__.appCue.space.arrowOffset,
8390
+ right: theme.__hd__.appCue.space.arrowOffset
8391
+ }), themePlacement === 'top-right' && {
8392
+ bottom: -theme.__hd__.appCue.space.arrowOffset,
8393
+ left: theme.__hd__.appCue.space.arrowOffset
8394
+ }), themePlacement === 'bottom-left' && {
8395
+ top: -theme.__hd__.appCue.space.arrowOffset,
8396
+ right: theme.__hd__.appCue.space.arrowOffset,
8397
+ transform: [{
8398
+ rotate: '180deg'
8399
+ }]
8400
+ }), themePlacement === 'bottom-right' && {
8401
+ top: -theme.__hd__.appCue.space.arrowOffset,
8402
+ left: theme.__hd__.appCue.space.arrowOffset,
8403
+ transform: [{
8404
+ rotate: '180deg'
8405
+ }]
8388
8406
  });
8389
8407
  });
8390
8408
 
@@ -8411,42 +8429,79 @@ var calculatePosition = function calculatePosition(_ref) {
8411
8429
  var placement = _ref.placement,
8412
8430
  position = _ref.position,
8413
8431
  contentSize = _ref.contentSize,
8414
- offset = _ref.offset;
8432
+ offset = _ref.offset,
8433
+ windowWidth = _ref.windowWidth;
8415
8434
  switch (placement) {
8416
8435
  case 'top':
8417
8436
  {
8418
8437
  return {
8419
8438
  // The X coordinate is calculated by adding the half of the width of the target element to the X coordinate of the target element.
8420
- x: position.pageX + (position.width - contentSize.width) / 2,
8439
+ left: position.pageX + (position.width - contentSize.width) / 2,
8421
8440
  // The Y coordinate is calculated by subtracting the height of the content and the offset from the Y coordinate of the target element
8422
- y: position.pageY - contentSize.height - offset
8441
+ top: position.pageY - contentSize.height - offset
8423
8442
  };
8424
8443
  }
8425
8444
  case 'bottom':
8426
8445
  {
8427
8446
  return {
8428
8447
  // The X coordinate is calculated by adding the half of the width of the target element to the X coordinate of the target element.
8429
- x: position.pageX + (position.width - contentSize.width) / 2,
8448
+ left: position.pageX + (position.width - contentSize.width) / 2,
8430
8449
  // The Y coordinate is calculated by adding the height of the target element and the offset to the Y coordinate of the target element.
8431
- y: position.pageY + position.height + offset
8450
+ top: position.pageY + position.height + offset
8432
8451
  };
8433
8452
  }
8434
8453
  case 'right':
8435
8454
  {
8436
8455
  return {
8437
8456
  // The X coordinate is calculated by adding the width of the target element and the offset to the X coordinate of the target element.
8438
- x: position.pageX + position.width + offset,
8457
+ left: position.pageX + position.width + offset,
8439
8458
  // The Y coordinate is calculated by adding half of the height of the target element to the Y coordinate of the target element.
8440
- y: position.pageY + (position.height - contentSize.height) / 2
8459
+ top: position.pageY + (position.height - contentSize.height) / 2
8441
8460
  };
8442
8461
  }
8443
8462
  case 'left':
8444
8463
  {
8445
8464
  return {
8446
8465
  // The X coordinate is calculated by subtracting the width of the content and the offset from the X coordinate of the target element.
8447
- x: position.pageX - contentSize.width - offset,
8466
+ left: position.pageX - contentSize.width - offset,
8448
8467
  // The Y coordinate is calculated by adding half of the height of the target element to the Y coordinate of the target element.
8449
- y: position.pageY + (position.height - contentSize.height) / 2
8468
+ top: position.pageY + (position.height - contentSize.height) / 2
8469
+ };
8470
+ }
8471
+ case 'top-left':
8472
+ {
8473
+ return {
8474
+ // The X coordinate is calculated by subtracting the width of the content from the X coordinate of the target element.
8475
+ right: windowWidth - position.pageX - position.width,
8476
+ // The Y coordinate is calculated by subtracting the height of the content and the offset from the Y coordinate of the target element
8477
+ top: position.pageY - contentSize.height - offset
8478
+ };
8479
+ }
8480
+ case 'top-right':
8481
+ {
8482
+ return {
8483
+ // The X coordinate is calculated by adding the width of the target element to the X coordinate of the target element.
8484
+ left: position.pageX,
8485
+ // The Y coordinate is calculated by subtracting the height of the content and the offset from the Y coordinate of the target element.
8486
+ top: position.pageY - contentSize.height - offset
8487
+ };
8488
+ }
8489
+ case 'bottom-left':
8490
+ {
8491
+ return {
8492
+ // The X coordinate is calculated by subtracting the width of the content from the X coordinate of the target element.
8493
+ right: windowWidth - position.pageX - position.width,
8494
+ // The Y coordinate is calculated by adding the height of the target element and the offset to the Y coordinate of the target element.
8495
+ top: position.pageY + position.height + offset
8496
+ };
8497
+ }
8498
+ case 'bottom-right':
8499
+ {
8500
+ return {
8501
+ // The X coordinate is calculated by adding the width of the target element to the X coordinate of the target element.
8502
+ left: position.pageX,
8503
+ // The Y coordinate is calculated by adding the height of the target element and the offset to the Y coordinate of the target element.
8504
+ top: position.pageY + position.height + offset
8450
8505
  };
8451
8506
  }
8452
8507
  }
@@ -8488,6 +8543,22 @@ var calulateContentMaxWidth = function calulateContentMaxWidth(_ref2) {
8488
8543
  {
8489
8544
  return position.pageX - offset;
8490
8545
  }
8546
+ case 'top-left':
8547
+ {
8548
+ return position.pageX + position.width;
8549
+ }
8550
+ case 'top-right':
8551
+ {
8552
+ return windowWidth - position.pageX;
8553
+ }
8554
+ case 'bottom-left':
8555
+ {
8556
+ return position.pageX + position.width;
8557
+ }
8558
+ case 'bottom-right':
8559
+ {
8560
+ return windowWidth - position.pageX;
8561
+ }
8491
8562
  }
8492
8563
  };
8493
8564
 
@@ -8554,14 +8625,15 @@ var AppCue = function AppCue(_ref) {
8554
8625
  height: event.nativeEvent.layout.height
8555
8626
  });
8556
8627
  };
8628
+ var _useWindowDimensions = useWindowDimensions(),
8629
+ windowWidth = _useWindowDimensions.width;
8557
8630
  var pos = calculatePosition({
8558
8631
  position: position,
8559
8632
  contentSize: contentSize,
8560
8633
  placement: placement,
8561
- offset: offset
8634
+ offset: offset,
8635
+ windowWidth: windowWidth
8562
8636
  });
8563
- var _useWindowDimensions = useWindowDimensions(),
8564
- windowWidth = _useWindowDimensions.width;
8565
8637
  var maxWidth = calulateContentMaxWidth({
8566
8638
  position: position,
8567
8639
  offset: offset,
@@ -8601,8 +8673,10 @@ var AppCue = function AppCue(_ref) {
8601
8673
  }, /*#__PURE__*/React__default.createElement(StyledContainer$9, null, /*#__PURE__*/React__default.createElement(View, {
8602
8674
  style: StyleSheet$1.flatten([{
8603
8675
  position: 'absolute',
8604
- top: pos.y,
8605
- left: pos.x
8676
+ top: pos.top,
8677
+ left: pos.left,
8678
+ bottom: pos.bottom,
8679
+ right: pos.right
8606
8680
  }, style]),
8607
8681
  onLayout: measureContent,
8608
8682
  testID: testID
@@ -13970,7 +14044,11 @@ var StyledLabelInsideTextInput = index$a(Typography.Body)(function (_ref3) {
13970
14044
  alignContent: 'center',
13971
14045
  alignItems: 'center',
13972
14046
  color: theme.__hd__.textInput.colors.labelsInsideTextInput[themeState],
13973
- marginTop: theme.__hd__.textInput.space.labelInsideTextInputMarginTop
14047
+ marginTop: theme.__hd__.textInput.space.labelInsideTextInputMarginTop,
14048
+ position: 'absolute',
14049
+ zIndex: 1,
14050
+ left: 0,
14051
+ top: '50%'
13974
14052
  };
13975
14053
  });
13976
14054
  var StyledAsteriskLabelInsideTextInput = index$a(Typography.Body)(function (_ref4) {
@@ -14191,18 +14269,10 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
14191
14269
  _React$useState2 = _slicedToArray(_React$useState, 2),
14192
14270
  inputSize = _React$useState2[0],
14193
14271
  setInputSize = _React$useState2[1];
14194
- var _React$useState3 = React__default.useState(0),
14272
+ var _React$useState3 = React__default.useState(false),
14195
14273
  _React$useState4 = _slicedToArray(_React$useState3, 2),
14196
- labelWidth = _React$useState4[0],
14197
- setLabelWidth = _React$useState4[1];
14198
- var _React$useState5 = React__default.useState(0),
14199
- _React$useState6 = _slicedToArray(_React$useState5, 2),
14200
- prefixWidth = _React$useState6[0],
14201
- setPrefixWidth = _React$useState6[1];
14202
- var _React$useState7 = React__default.useState(false),
14203
- _React$useState8 = _slicedToArray(_React$useState7, 2),
14204
- isFocused = _React$useState8[0],
14205
- setIsFocused = _React$useState8[1];
14274
+ isFocused = _React$useState4[0],
14275
+ setIsFocused = _React$useState4[1];
14206
14276
  var state = getState$3({
14207
14277
  disabled: disabled,
14208
14278
  error: error,
@@ -14232,14 +14302,6 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
14232
14302
  });
14233
14303
  });
14234
14304
  }, []);
14235
- var onPrefixLayout = useCallback(function (event) {
14236
- var width = event.nativeEvent.layout.width;
14237
- setPrefixWidth(width);
14238
- }, []);
14239
- var onLabelLayout = useCallback(function (event) {
14240
- var width = event.nativeEvent.layout.width;
14241
- setLabelWidth(width);
14242
- }, []);
14243
14305
  var innerTextInput = React__default.useRef();
14244
14306
  React__default.useImperativeHandle(ref, function () {
14245
14307
  return {
@@ -14346,9 +14408,7 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
14346
14408
  style: [{
14347
14409
  backgroundColor: backgroundColor
14348
14410
  }, borderStyle]
14349
- }), /*#__PURE__*/React__default.createElement(View, {
14350
- onLayout: onPrefixLayout
14351
- }, renderPrefix$1({
14411
+ }), /*#__PURE__*/React__default.createElement(View, null, renderPrefix$1({
14352
14412
  state: state,
14353
14413
  prefix: prefix
14354
14414
  })), /*#__PURE__*/React__default.createElement(StyledLabelContainerInsideTextInput, {
@@ -14360,12 +14420,12 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
14360
14420
  transform: [{
14361
14421
  translateY: focusAnimation.interpolate({
14362
14422
  inputRange: [0, 1],
14363
- outputRange: [variant !== 'textarea' ? inputSize.height / 2 : theme.space.large, 0]
14423
+ outputRange: [variant !== 'textarea' ? inputSize.height / 2 : theme.space.large, theme.space.xsmall]
14364
14424
  })
14365
14425
  }, {
14366
14426
  translateX: focusAnimation.interpolate({
14367
14427
  inputRange: [0, 1],
14368
- outputRange: [-inputSize.width / 2 + labelWidth / 2 + prefixWidth + theme.space.large, -inputSize.width / 2 + labelWidth / 2 + theme.space.small]
14428
+ outputRange: [prefix ? theme.space.xxlarge : theme.space.medium, -theme.space.xlarge + theme.space.xsmall]
14369
14429
  })
14370
14430
  }, {
14371
14431
  scale: focusAnimation.interpolate({
@@ -14374,21 +14434,20 @@ var TextInput = /*#__PURE__*/forwardRef(function (_ref8, ref) {
14374
14434
  })
14375
14435
  }]
14376
14436
  }]
14377
- }, required && /*#__PURE__*/React__default.createElement(StyledAsteriskLabelInsideTextInput, {
14437
+ }, !!label && /*#__PURE__*/React__default.createElement(StyledLabelInsideTextInput, {
14378
14438
  style: {
14379
14439
  backgroundColor: backgroundColor
14380
14440
  },
14381
- themeState: state,
14382
- testID: "input-label-asterisk"
14383
- }, "*"), !!label && /*#__PURE__*/React__default.createElement(StyledLabelInsideTextInput, {
14441
+ nativeID: accessibilityLabelledBy,
14442
+ testID: "input-label",
14443
+ themeState: state
14444
+ }, required && /*#__PURE__*/React__default.createElement(StyledAsteriskLabelInsideTextInput, {
14384
14445
  style: {
14385
14446
  backgroundColor: backgroundColor
14386
14447
  },
14387
- nativeID: accessibilityLabelledBy,
14388
- testID: "input-label",
14389
14448
  themeState: state,
14390
- onLayout: onLabelLayout
14391
- }, label)), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, null, renderInput$1({
14449
+ testID: "input-label-asterisk"
14450
+ }, "*"), label)), /*#__PURE__*/React__default.createElement(StyledTextInputAndLabelContainer, null, renderInput$1({
14392
14451
  variant: variant,
14393
14452
  nativeInputProps: nativeInputProps,
14394
14453
  renderInputValue: renderInputValue,
@@ -15111,8 +15170,8 @@ var Empty = function Empty(_ref) {
15111
15170
  level: "h4",
15112
15171
  typeface: "playful"
15113
15172
  }, title), !!description && /*#__PURE__*/React__default.createElement(StyledDescription, {
15114
- themeVariant: variant,
15115
- typeface: "playful"
15173
+ variant: "small",
15174
+ themeVariant: variant
15116
15175
  }, description));
15117
15176
  };
15118
15177
 
@@ -20612,7 +20671,7 @@ var MentionList = function MentionList(_ref) {
20612
20671
  }));
20613
20672
  };
20614
20673
 
20615
- var lib = {exports: {}};
20674
+ var lib$1 = {exports: {}};
20616
20675
 
20617
20676
  var reactDom = {exports: {}};
20618
20677
 
@@ -28040,14 +28099,15 @@ function requireReactDom() {
28040
28099
  return reactDom.exports;
28041
28100
  }
28042
28101
 
28102
+ var lib = lib$1.exports;
28043
28103
  var hasRequiredLib;
28044
28104
  function requireLib() {
28045
- if (hasRequiredLib) return lib.exports;
28105
+ if (hasRequiredLib) return lib$1.exports;
28046
28106
  hasRequiredLib = 1;
28047
28107
  (function (module, exports) {
28048
28108
  !function (e, t) {
28049
28109
  module.exports = t(React__default, requireReactDom());
28050
- }(self, function (e, t) {
28110
+ }("undefined" != typeof self ? self : lib, function (e, t) {
28051
28111
  return function () {
28052
28112
  var r = {
28053
28113
  394: function _(e) {
@@ -39086,8 +39146,8 @@ function requireLib() {
39086
39146
  }(), o;
39087
39147
  }();
39088
39148
  });
39089
- })(lib);
39090
- return lib.exports;
39149
+ })(lib$1);
39150
+ return lib$1.exports;
39091
39151
  }
39092
39152
 
39093
39153
  var libExports = requireLib();