@hero-design/rn 8.122.0 → 8.123.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/lib/index.js CHANGED
@@ -7916,6 +7916,23 @@ var getSegmentedControlTheme = function getSegmentedControlTheme(theme) {
7916
7916
  };
7917
7917
  };
7918
7918
 
7919
+ var getInlineLoaderTheme = function getInlineLoaderTheme(theme) {
7920
+ return {
7921
+ space: {
7922
+ gap: theme.space.small
7923
+ },
7924
+ icon: {
7925
+ lineHeights: {
7926
+ xsmall: theme.lineHeights.xsmall,
7927
+ small: theme.lineHeights.small,
7928
+ medium: theme.lineHeights.medium,
7929
+ large: theme.lineHeights.large,
7930
+ xlarge: theme.lineHeights.xlarge
7931
+ }
7932
+ }
7933
+ };
7934
+ };
7935
+
7919
7936
  var getTheme = function getTheme() {
7920
7937
  var scale = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : scale$1;
7921
7938
  var systemPallete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : swagSystemPalette$2;
@@ -7977,6 +7994,7 @@ var getTheme = function getTheme() {
7977
7994
  toolbar: getToolbarTheme(globalTheme),
7978
7995
  typography: getTypographyTheme(globalTheme),
7979
7996
  floatingIsland: getFloatingIslandTheme(globalTheme),
7997
+ inlineLoader: getInlineLoaderTheme(globalTheme),
7980
7998
  segmentedControl: getSegmentedControlTheme(globalTheme)
7981
7999
  }
7982
8000
  });
@@ -9427,7 +9445,7 @@ var StyledContent$1 = index$c(reactNative.View)(function (_ref) {
9427
9445
  alignSelf: 'center'
9428
9446
  };
9429
9447
  });
9430
- var StyledContainer$9 = index$c(reactNative.View)(function (_ref2) {
9448
+ var StyledContainer$a = index$c(reactNative.View)(function (_ref2) {
9431
9449
  var theme = _ref2.theme;
9432
9450
  return {
9433
9451
  width: '100%',
@@ -9435,7 +9453,7 @@ var StyledContainer$9 = index$c(reactNative.View)(function (_ref2) {
9435
9453
  backgroundColor: theme.__hd__.appCue.colors.backdropColor
9436
9454
  };
9437
9455
  });
9438
- var StyledIconContainer$1 = index$c(reactNative.Animated.View)(function (_ref3) {
9456
+ var StyledIconContainer$2 = index$c(reactNative.Animated.View)(function (_ref3) {
9439
9457
  var theme = _ref3.theme,
9440
9458
  themePlacement = _ref3.themePlacement;
9441
9459
  return _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
@@ -9750,7 +9768,7 @@ var AppCue = function AppCue(_ref) {
9750
9768
  onPress: function onPress() {
9751
9769
  return setVisible(false);
9752
9770
  }
9753
- }, /*#__PURE__*/React__namespace.default.createElement(StyledContainer$9, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
9771
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledContainer$a, null, /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
9754
9772
  style: reactNative.StyleSheet.flatten([{
9755
9773
  position: 'absolute',
9756
9774
  top: pos.top,
@@ -9765,7 +9783,7 @@ var AppCue = function AppCue(_ref) {
9765
9783
  maxWidth: maxWidth
9766
9784
  },
9767
9785
  testID: testID && "".concat(testID, "-content")
9768
- }, renderContent()), /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer$1, {
9786
+ }, renderContent()), /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer$2, {
9769
9787
  themePlacement: placement,
9770
9788
  testID: testID && "".concat(testID, "-arrow")
9771
9789
  }, /*#__PURE__*/React__namespace.default.createElement(Icon, {
@@ -9774,7 +9792,7 @@ var AppCue = function AppCue(_ref) {
9774
9792
  })))))));
9775
9793
  };
9776
9794
 
9777
- var StyledContainer$8 = index$c(reactNative.View)({
9795
+ var StyledContainer$9 = index$c(reactNative.View)({
9778
9796
  alignItems: 'center',
9779
9797
  flexDirection: 'row'
9780
9798
  });
@@ -9816,7 +9834,7 @@ var Attachment = function Attachment(_ref) {
9816
9834
  backgroundHighlighted = _ref$backgroundHighli === void 0 ? false : _ref$backgroundHighli,
9817
9835
  style = _ref.style,
9818
9836
  testID = _ref.testID;
9819
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$8, {
9837
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$9, {
9820
9838
  testID: testID,
9821
9839
  style: style
9822
9840
  }, /*#__PURE__*/React__namespace.default.createElement(StyledContentContainer$1, {
@@ -13938,7 +13956,7 @@ function ContentNavigator(_ref) {
13938
13956
  }));
13939
13957
  }
13940
13958
 
13941
- var StyledContainer$7 = index$c(reactNative.View)(function (_ref) {
13959
+ var StyledContainer$8 = index$c(reactNative.View)(function (_ref) {
13942
13960
  var theme = _ref.theme;
13943
13961
  return {
13944
13962
  backgroundColor: theme.__hd__.calendar.colors.background
@@ -14373,7 +14391,7 @@ var CalendarRange = function CalendarRange(_ref) {
14373
14391
  textIntent: isCurrentMonth ? undefined : 'subdued'
14374
14392
  });
14375
14393
  };
14376
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
14394
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$8, {
14377
14395
  testID: testID
14378
14396
  }, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
14379
14397
  value: !shouldShowMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
@@ -14507,7 +14525,7 @@ var Calendar = function Calendar(_ref) {
14507
14525
  monthPickerVisible = _useState2[0],
14508
14526
  setMonthPickerVisible = _useState2[1];
14509
14527
  var now = new Date();
14510
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
14528
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$8, {
14511
14529
  testID: testID
14512
14530
  }, /*#__PURE__*/React__namespace.default.createElement(StyledCalendarHeader, null, /*#__PURE__*/React__namespace.default.createElement(ContentNavigator, {
14513
14531
  value: !shouldShowMonthPicker ? formatTime('MMMM yyyy', visibleDate) : /*#__PURE__*/React__namespace.default.createElement(reactNative.TouchableOpacity, {
@@ -20655,7 +20673,7 @@ var index$9 = Object.assign(DefaultCheckbox, {
20655
20673
  Inline: InlineCheckbox
20656
20674
  });
20657
20675
 
20658
- var StyledContainer$6 = index$c(reactNative.View)(function (_ref) {
20676
+ var StyledContainer$7 = index$c(reactNative.View)(function (_ref) {
20659
20677
  var theme = _ref.theme;
20660
20678
  return {
20661
20679
  width: '100%',
@@ -21043,7 +21061,7 @@ var TextInput = /*#__PURE__*/React.forwardRef(function (_ref8, ref) {
21043
21061
  defaultValue: defaultValue,
21044
21062
  placeholder: isFocused || label === undefined ? nativeProps.placeholder : EMPTY_PLACEHOLDER_VALUE
21045
21063
  });
21046
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$6, {
21064
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
21047
21065
  style: styleWithoutBackgroundColor,
21048
21066
  pointerEvents: state === 'disabled' || state === 'readonly' ? 'none' : 'auto',
21049
21067
  testID: testID
@@ -21723,7 +21741,7 @@ var index$8 = Object.assign(PublicDatePicker, {
21723
21741
  });
21724
21742
 
21725
21743
  var AnimatedPressable = reactNative.Animated.createAnimatedComponent(reactNative.Pressable);
21726
- var StyledContainer$5 = index$c(reactNative.View)(function (_ref) {
21744
+ var StyledContainer$6 = index$c(reactNative.View)(function (_ref) {
21727
21745
  var theme = _ref.theme,
21728
21746
  enableShadow = _ref.enableShadow;
21729
21747
  return _objectSpread2(_objectSpread2({}, reactNative.StyleSheet.absoluteFillObject), {}, {
@@ -21983,7 +22001,7 @@ var Drawer = function Drawer(_ref) {
21983
22001
  return animation.stop();
21984
22002
  };
21985
22003
  }, [visible]);
21986
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$5, {
22004
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$6, {
21987
22005
  testID: testID,
21988
22006
  enableShadow: enableShadow,
21989
22007
  pointerEvents: "box-none"
@@ -23974,7 +23992,7 @@ var StyledFABText = index$c(Typography.Body)(function (_ref3) {
23974
23992
  marginHorizontal: theme.__hd__.fab.space.titleMarginHorizontal
23975
23993
  };
23976
23994
  });
23977
- var StyledIconContainer = index$c(Box)(function (_ref4) {
23995
+ var StyledIconContainer$1 = index$c(Box)(function (_ref4) {
23978
23996
  var theme = _ref4.theme;
23979
23997
  return {
23980
23998
  width: theme.__hd__.fab.sizes.iconContainerWidth,
@@ -24018,7 +24036,7 @@ var ActionItem = function ActionItem(_ref) {
24018
24036
  style: style,
24019
24037
  onPress: onPress,
24020
24038
  testID: testID
24021
- }, /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledIcon$3, {
24039
+ }, /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer$1, null, /*#__PURE__*/React__namespace.default.createElement(StyledIcon$3, {
24022
24040
  size: "xsmall",
24023
24041
  icon: icon
24024
24042
  })), /*#__PURE__*/React__namespace.default.createElement(StyledActionItemText, null, title))));
@@ -24067,14 +24085,14 @@ var IconOnlyContent = function IconOnlyContent(_ref) {
24067
24085
  animated = _ref.animated,
24068
24086
  active = _ref.active;
24069
24087
  if (animated) {
24070
- return /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer, null, /*#__PURE__*/React__namespace.default.createElement(AnimatedFABIcon, {
24088
+ return /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer$1, null, /*#__PURE__*/React__namespace.default.createElement(AnimatedFABIcon, {
24071
24089
  active: active,
24072
24090
  icon: icon,
24073
24091
  testID: "animated-fab-icon",
24074
24092
  size: "xsmall"
24075
24093
  }));
24076
24094
  }
24077
- return /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledFABIcon, {
24095
+ return /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer$1, null, /*#__PURE__*/React__namespace.default.createElement(StyledFABIcon, {
24078
24096
  size: "xsmall",
24079
24097
  icon: icon,
24080
24098
  testID: "styled-fab-icon"
@@ -24083,7 +24101,7 @@ var IconOnlyContent = function IconOnlyContent(_ref) {
24083
24101
  var IconWithTextContent = function IconWithTextContent(_ref2) {
24084
24102
  var icon = _ref2.icon,
24085
24103
  title = _ref2.title;
24086
- return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer, null, /*#__PURE__*/React__namespace.default.createElement(StyledFABIcon, {
24104
+ return /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer$1, null, /*#__PURE__*/React__namespace.default.createElement(StyledFABIcon, {
24087
24105
  size: "xsmall",
24088
24106
  icon: icon,
24089
24107
  testID: "styled-fab-icon"
@@ -24241,7 +24259,7 @@ var FAB$1 = /*#__PURE__*/React.forwardRef(function (_ref3, ref) {
24241
24259
  });
24242
24260
  FAB$1.displayName = 'FAB';
24243
24261
 
24244
- var StyledContainer$4 = index$c(reactNative.View)({
24262
+ var StyledContainer$5 = index$c(reactNative.View)({
24245
24263
  position: 'absolute',
24246
24264
  left: 0,
24247
24265
  right: 0,
@@ -24348,7 +24366,7 @@ var ActionGroup = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
24348
24366
  inputRange: [0, 1],
24349
24367
  outputRange: [0, 1]
24350
24368
  });
24351
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$4, {
24369
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$5, {
24352
24370
  testID: testID,
24353
24371
  pointerEvents: "box-none",
24354
24372
  style: style
@@ -25079,7 +25097,7 @@ var HeroDesignProvider = function HeroDesignProvider(_ref) {
25079
25097
  }, /*#__PURE__*/React__namespace.default.createElement(Toast.Provider, null, /*#__PURE__*/React__namespace.default.createElement(Portal$1.Provider, null, children))));
25080
25098
  };
25081
25099
 
25082
- var StyledContainer$3 = index$c(reactNative.View)(function (_ref) {
25100
+ var StyledContainer$4 = index$c(reactNative.View)(function (_ref) {
25083
25101
  var theme = _ref.theme;
25084
25102
  return {
25085
25103
  width: theme.__hd__.mapPin.sizes["default"],
@@ -25159,7 +25177,7 @@ var MapPinFocussed = function MapPinFocussed(_ref) {
25159
25177
  var style = _ref.style,
25160
25178
  testID = _ref.testID,
25161
25179
  nativeProps = _objectWithoutProperties(_ref, _excluded$o);
25162
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$3, _extends$1({}, nativeProps, {
25180
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$4, _extends$1({}, nativeProps, {
25163
25181
  style: style,
25164
25182
  testID: testID
25165
25183
  }), /*#__PURE__*/React__namespace.default.createElement(StyledFocusIcon, {
@@ -25186,7 +25204,7 @@ var MapPin = function MapPin(_ref) {
25186
25204
  icon = _ref.icon,
25187
25205
  nativeProps = _objectWithoutProperties(_ref, _excluded$n);
25188
25206
  var badgeIcon = getBadgeIconName(state);
25189
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$3, _extends$1({}, nativeProps, {
25207
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$4, _extends$1({}, nativeProps, {
25190
25208
  style: style,
25191
25209
  testID: testID
25192
25210
  }), /*#__PURE__*/React__namespace.default.createElement(StyledContent, {
@@ -25468,7 +25486,7 @@ var PinInput = /*#__PURE__*/React.forwardRef(function (_ref2, ref) {
25468
25486
  });
25469
25487
  PinInput.displayName = 'PinInput';
25470
25488
 
25471
- var StyledContainer$2 = index$c(reactNative.View)(function (_ref) {
25489
+ var StyledContainer$3 = index$c(reactNative.View)(function (_ref) {
25472
25490
  var theme = _ref.theme;
25473
25491
  return {
25474
25492
  flexDirection: 'row',
@@ -25540,7 +25558,7 @@ var ProgressCircle = function ProgressCircle(_ref) {
25540
25558
  return /*#__PURE__*/React__namespace.default.createElement(reactNative.View, _extends$1({}, nativeProps, {
25541
25559
  testID: testID,
25542
25560
  style: style
25543
- }), /*#__PURE__*/React__namespace.default.createElement(StyledContainer$2, null, /*#__PURE__*/React__namespace.default.createElement(Svg__default.default, {
25561
+ }), /*#__PURE__*/React__namespace.default.createElement(StyledContainer$3, null, /*#__PURE__*/React__namespace.default.createElement(Svg__default.default, {
25544
25562
  width: size,
25545
25563
  height: size,
25546
25564
  viewBox: "0 0 ".concat(size, " ").concat(size)
@@ -27274,7 +27292,7 @@ var index$4 = Object.assign(SingleSelect, {
27274
27292
  Multi: MultiSelect
27275
27293
  });
27276
27294
 
27277
- var StyledContainer$1 = index$c(Box)(function (_ref) {
27295
+ var StyledContainer$2 = index$c(Box)(function (_ref) {
27278
27296
  var theme = _ref.theme,
27279
27297
  themeIntent = _ref.themeIntent,
27280
27298
  themeVariant = _ref.themeVariant;
@@ -27360,7 +27378,7 @@ var Skeleton = function Skeleton(_ref) {
27360
27378
  }
27361
27379
  onLayout === null || onLayout === void 0 || onLayout(e);
27362
27380
  }, []);
27363
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$1, _extends$1({
27381
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$2, _extends$1({
27364
27382
  style: style,
27365
27383
  themeVariant: variant,
27366
27384
  themeIntent: intent,
@@ -41335,7 +41353,7 @@ var RichTextEditor = function RichTextEditor(_ref) {
41335
41353
  onBlur === null || onBlur === void 0 || onBlur();
41336
41354
  setIsFocused(false);
41337
41355
  }, [onBlur]);
41338
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$6, {
41356
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$7, {
41339
41357
  testID: testID
41340
41358
  }, /*#__PURE__*/React__namespace.default.createElement(StyledLabelContainerInsideTextInput, {
41341
41359
  themeHasPrefix: false,
@@ -41589,7 +41607,7 @@ function SectionListWithFAB(_ref) {
41589
41607
  });
41590
41608
  }
41591
41609
 
41592
- var StyledContainer = index$c(reactNative.View)(function () {
41610
+ var StyledContainer$1 = index$c(reactNative.View)(function () {
41593
41611
  return {
41594
41612
  width: '100%'
41595
41613
  };
@@ -41694,7 +41712,7 @@ var SearchTwoLine = function SearchTwoLine(props) {
41694
41712
  _props$variant = props.variant,
41695
41713
  variant = _props$variant === void 0 ? 'basic' : _props$variant,
41696
41714
  accessible = props.accessible;
41697
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer, {
41715
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$1, {
41698
41716
  style: style,
41699
41717
  testID: testID,
41700
41718
  accessible: accessible
@@ -41811,7 +41829,7 @@ var SearchOneLine = /*#__PURE__*/React.forwardRef(function (props, ref) {
41811
41829
  }));
41812
41830
  };
41813
41831
  var shouldShowClearButton = clearable && (state === 'filled' || isFocused) && !isEmptyValue;
41814
- return /*#__PURE__*/React__namespace.default.createElement(StyledContainer, {
41832
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer$1, {
41815
41833
  pointerEvents: state === 'disabled' || state === 'readonly' ? 'none' : 'auto',
41816
41834
  testID: testID,
41817
41835
  style: style,
@@ -42268,6 +42286,237 @@ var FilterTrigger = function FilterTrigger(_ref) {
42268
42286
  })));
42269
42287
  };
42270
42288
 
42289
+ var ANIMATION_DURATION_MS = 2000;
42290
+ var AnimatedGradientText = function AnimatedGradientText(_ref) {
42291
+ var children = _ref.children,
42292
+ fontSize = _ref.fontSize,
42293
+ lineHeight = _ref.lineHeight;
42294
+ var theme = useTheme();
42295
+ var gradient = theme.colors.gradients.aiHorizontal;
42296
+ var _useState = React.useState(null),
42297
+ _useState2 = _slicedToArray(_useState, 2),
42298
+ size = _useState2[0],
42299
+ setSize = _useState2[1];
42300
+ var animatedValue = React.useRef(new reactNative.Animated.Value(0));
42301
+ var onLayout = React.useCallback(function (event) {
42302
+ var _event$nativeEvent$la = event.nativeEvent.layout,
42303
+ width = _event$nativeEvent$la.width,
42304
+ height = _event$nativeEvent$la.height;
42305
+ setSize(function (prev) {
42306
+ if ((prev === null || prev === void 0 ? void 0 : prev.width) === width && (prev === null || prev === void 0 ? void 0 : prev.height) === height) return prev;
42307
+ return {
42308
+ width: width,
42309
+ height: height
42310
+ };
42311
+ });
42312
+ }, []);
42313
+ React.useEffect(function () {
42314
+ if (!size) return;
42315
+ animatedValue.current.setValue(0);
42316
+ var animation = reactNative.Animated.loop(reactNative.Animated.timing(animatedValue.current, {
42317
+ toValue: 1,
42318
+ duration: ANIMATION_DURATION_MS,
42319
+ easing: reactNative.Easing.linear,
42320
+ useNativeDriver: reactNative.Platform.OS !== 'web'
42321
+ }));
42322
+ animation.start();
42323
+ return function () {
42324
+ return animation.stop();
42325
+ };
42326
+ }, [size]);
42327
+ // Slide left by one full text-width per loop cycle.
42328
+ // Starting at 0 keeps the gradient visible from the first frame.
42329
+ var translateX = size ? animatedValue.current.interpolate({
42330
+ inputRange: [0, 1],
42331
+ outputRange: [0, -size.width]
42332
+ }) : animatedValue.current;
42333
+ return /*#__PURE__*/React__namespace.default.createElement(reactNative.View, null, /*#__PURE__*/React__namespace.default.createElement(MaskedView__default.default, {
42334
+ accessibilityElementsHidden: true,
42335
+ importantForAccessibility: "no-hide-descendants",
42336
+ maskElement: /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
42337
+ onLayout: onLayout,
42338
+ style: {
42339
+ backgroundColor: 'transparent'
42340
+ },
42341
+ testID: "animated-gradient-text-mask"
42342
+ }, /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
42343
+ intent: "body",
42344
+ style: {
42345
+ fontSize: fontSize,
42346
+ lineHeight: lineHeight
42347
+ }
42348
+ }, children))
42349
+ }, size ? /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
42350
+ style: {
42351
+ width: size.width,
42352
+ height: size.height,
42353
+ overflow: 'hidden'
42354
+ }
42355
+ }, /*#__PURE__*/React__namespace.default.createElement(reactNative.Animated.View, {
42356
+ style: {
42357
+ width: size.width * 2,
42358
+ height: size.height,
42359
+ transform: [{
42360
+ translateX: translateX
42361
+ }]
42362
+ }
42363
+ }, /*#__PURE__*/React__namespace.default.createElement(expoLinearGradient.LinearGradient, {
42364
+ start: gradient.start,
42365
+ end: gradient.end,
42366
+ colors: [gradient.colors[0], gradient.colors[1], gradient.colors[2], gradient.colors[1], gradient.colors[0]],
42367
+ locations: [0, 0.25, 0.5, 0.75, 1.0],
42368
+ style: {
42369
+ width: '100%',
42370
+ height: '100%'
42371
+ }
42372
+ }))) : /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
42373
+ intent: "body",
42374
+ style: {
42375
+ fontSize: fontSize,
42376
+ lineHeight: lineHeight
42377
+ }
42378
+ }, children)), /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
42379
+ style: {
42380
+ position: 'absolute',
42381
+ opacity: 0
42382
+ },
42383
+ importantForAccessibility: "yes",
42384
+ accessibilityElementsHidden: false
42385
+ }, /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
42386
+ intent: "body",
42387
+ style: {
42388
+ fontSize: fontSize,
42389
+ lineHeight: lineHeight
42390
+ }
42391
+ }, children)));
42392
+ };
42393
+
42394
+ var TEXT_SIZE_NAMES = {
42395
+ 10: 'xsmall',
42396
+ 12: 'small',
42397
+ 14: 'medium',
42398
+ 16: 'large',
42399
+ 18: 'xlarge'
42400
+ };
42401
+ var getTextSizeName = function getTextSizeName(size) {
42402
+ return TEXT_SIZE_NAMES[size];
42403
+ };
42404
+ var getIconName = function getIconName(state) {
42405
+ switch (state) {
42406
+ case 'idle':
42407
+ return 'circle-ok-outlined';
42408
+ case 'loading':
42409
+ return 'loading';
42410
+ case 'success':
42411
+ return 'circle-check';
42412
+ case 'error':
42413
+ return 'circle-cancel-outlined';
42414
+ }
42415
+ };
42416
+ var getIconIntent = function getIconIntent(state, intent) {
42417
+ switch (state) {
42418
+ case 'idle':
42419
+ return 'inactive';
42420
+ case 'loading':
42421
+ return intent === 'ai' ? 'ai' : 'primary';
42422
+ case 'success':
42423
+ return 'success';
42424
+ case 'error':
42425
+ return 'danger';
42426
+ }
42427
+ };
42428
+ var getIconSize = function getIconSize(textSize) {
42429
+ switch (textSize) {
42430
+ case 10:
42431
+ return {
42432
+ size: 'xxxsmall'
42433
+ };
42434
+ case 12:
42435
+ return {
42436
+ size: 'xxxsmall',
42437
+ styleFontSize: 14
42438
+ };
42439
+ case 14:
42440
+ return {
42441
+ size: 'xxxsmall',
42442
+ styleFontSize: 14
42443
+ };
42444
+ case 16:
42445
+ return {
42446
+ size: 'xsmall'
42447
+ };
42448
+ case 18:
42449
+ return {
42450
+ size: 'small'
42451
+ };
42452
+ }
42453
+ };
42454
+
42455
+ var StyledContainer = index$c(reactNative.View)(function (_ref) {
42456
+ var theme = _ref.theme;
42457
+ return {
42458
+ flexDirection: 'row',
42459
+ alignItems: 'flex-start',
42460
+ gap: theme.__hd__.inlineLoader.space.gap
42461
+ };
42462
+ });
42463
+ var StyledIconContainer = index$c(reactNative.View)(function (_ref2) {
42464
+ var themeSize = _ref2.themeSize,
42465
+ theme = _ref2.theme;
42466
+ return {
42467
+ height: theme.__hd__.inlineLoader.icon.lineHeights[themeSize],
42468
+ justifyContent: 'center'
42469
+ };
42470
+ });
42471
+
42472
+ var InlineLoader = function InlineLoader(_ref) {
42473
+ var text = _ref.text,
42474
+ _ref$state = _ref.state,
42475
+ state = _ref$state === void 0 ? 'idle' : _ref$state,
42476
+ _ref$intent = _ref.intent,
42477
+ intent = _ref$intent === void 0 ? 'neutral' : _ref$intent,
42478
+ _ref$size = _ref.size,
42479
+ size = _ref$size === void 0 ? 14 : _ref$size,
42480
+ style = _ref.style,
42481
+ testID = _ref.testID;
42482
+ var theme = useTheme();
42483
+ var textSizeName = getTextSizeName(size);
42484
+ var lineHeight = theme.__hd__.inlineLoader.icon.lineHeights[textSizeName];
42485
+ var iconName = getIconName(state);
42486
+ var iconIntent = getIconIntent(state, intent);
42487
+ var _getIconSize = getIconSize(size),
42488
+ iconSize = _getIconSize.size,
42489
+ styleFontSize = _getIconSize.styleFontSize;
42490
+ var iconStyle = styleFontSize ? {
42491
+ fontSize: styleFontSize
42492
+ } : undefined;
42493
+ var isAiLoading = state === 'loading' && intent === 'ai';
42494
+ return /*#__PURE__*/React__namespace.default.createElement(StyledContainer, {
42495
+ testID: testID,
42496
+ style: style
42497
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledIconContainer, {
42498
+ themeSize: textSizeName
42499
+ }, /*#__PURE__*/React__namespace.default.createElement(Icon, {
42500
+ icon: iconName,
42501
+ intent: iconIntent,
42502
+ size: iconSize,
42503
+ spin: state === 'loading',
42504
+ style: iconStyle,
42505
+ accessible: false,
42506
+ accessibilityElementsHidden: true,
42507
+ importantForAccessibility: "no-hide-descendants"
42508
+ })), isAiLoading ? /*#__PURE__*/React__namespace.default.createElement(AnimatedGradientText, {
42509
+ fontSize: size,
42510
+ lineHeight: lineHeight
42511
+ }, text) : /*#__PURE__*/React__namespace.default.createElement(Typography.Body, {
42512
+ intent: "body",
42513
+ style: {
42514
+ fontSize: size,
42515
+ lineHeight: lineHeight
42516
+ }
42517
+ }, text));
42518
+ };
42519
+
42271
42520
  exports.Accordion = Accordion;
42272
42521
  exports.Alert = Alert;
42273
42522
  exports.AppCue = AppCue;
@@ -42300,6 +42549,7 @@ exports.Icon = Icon;
42300
42549
  exports.Illustration = Illustration;
42301
42550
  exports.IllustrationList = IllustrationList;
42302
42551
  exports.Image = Image;
42552
+ exports.InlineLoader = InlineLoader;
42303
42553
  exports.List = List$1;
42304
42554
  exports.LocaleProvider = LocaleProvider;
42305
42555
  exports.MapPin = index$6;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hero-design/rn",
3
- "version": "8.122.0",
3
+ "version": "8.123.0",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -0,0 +1,135 @@
1
+ import MaskedView from '@react-native-masked-view/masked-view';
2
+ import { LinearGradient } from 'expo-linear-gradient';
3
+ import React, { useCallback, useEffect, useRef, useState } from 'react';
4
+ import type { LayoutChangeEvent } from 'react-native';
5
+ import { Animated, Easing, Platform, View } from 'react-native';
6
+ import { useTheme } from '../../theme';
7
+ import Typography from '../Typography';
8
+
9
+ interface AnimatedGradientTextProps {
10
+ children: string;
11
+ fontSize: number;
12
+ lineHeight: number;
13
+ }
14
+
15
+ const ANIMATION_DURATION_MS = 2000;
16
+
17
+ const AnimatedGradientText = ({
18
+ children,
19
+ fontSize,
20
+ lineHeight,
21
+ }: AnimatedGradientTextProps) => {
22
+ const theme = useTheme();
23
+ const gradient = theme.colors.gradients.aiHorizontal;
24
+
25
+ const [size, setSize] = useState<{ width: number; height: number } | null>(
26
+ null
27
+ );
28
+ const animatedValue = useRef(new Animated.Value(0));
29
+
30
+ const onLayout = useCallback((event: LayoutChangeEvent) => {
31
+ const { width, height } = event.nativeEvent.layout;
32
+ setSize((prev) => {
33
+ if (prev?.width === width && prev?.height === height) return prev;
34
+ return { width, height };
35
+ });
36
+ }, []);
37
+
38
+ useEffect(() => {
39
+ if (!size) return;
40
+ animatedValue.current.setValue(0);
41
+ const animation = Animated.loop(
42
+ Animated.timing(animatedValue.current, {
43
+ toValue: 1,
44
+ duration: ANIMATION_DURATION_MS,
45
+ easing: Easing.linear,
46
+ useNativeDriver: Platform.OS !== 'web',
47
+ })
48
+ );
49
+ animation.start();
50
+ return () => animation.stop();
51
+ }, [size]);
52
+
53
+ // Slide left by one full text-width per loop cycle.
54
+ // Starting at 0 keeps the gradient visible from the first frame.
55
+ const translateX = size
56
+ ? animatedValue.current.interpolate({
57
+ inputRange: [0, 1],
58
+ outputRange: [0, -size.width],
59
+ })
60
+ : animatedValue.current;
61
+
62
+ return (
63
+ <View>
64
+ <MaskedView
65
+ accessibilityElementsHidden
66
+ importantForAccessibility="no-hide-descendants"
67
+ maskElement={
68
+ <View
69
+ onLayout={onLayout}
70
+ style={{ backgroundColor: 'transparent' }}
71
+ testID="animated-gradient-text-mask"
72
+ >
73
+ <Typography.Body intent="body" style={{ fontSize, lineHeight }}>
74
+ {children}
75
+ </Typography.Body>
76
+ </View>
77
+ }
78
+ >
79
+ {size ? (
80
+ <View
81
+ style={{
82
+ width: size.width,
83
+ height: size.height,
84
+ overflow: 'hidden',
85
+ }}
86
+ >
87
+ {/*
88
+ * Double the colour pattern so the gradient tiles seamlessly:
89
+ * [A, B, A, B, A] at equal spacing means the slice at
90
+ * translateX=0 looks identical to the slice at translateX=-width,
91
+ * eliminating the jump when the loop restarts.
92
+ */}
93
+ <Animated.View
94
+ style={{
95
+ width: size.width * 2,
96
+ height: size.height,
97
+ transform: [{ translateX }],
98
+ }}
99
+ >
100
+ <LinearGradient
101
+ start={gradient.start}
102
+ end={gradient.end}
103
+ colors={[
104
+ gradient.colors[0],
105
+ gradient.colors[1],
106
+ gradient.colors[2],
107
+ gradient.colors[1],
108
+ gradient.colors[0],
109
+ ]}
110
+ locations={[0, 0.25, 0.5, 0.75, 1.0]}
111
+ style={{ width: '100%', height: '100%' }}
112
+ />
113
+ </Animated.View>
114
+ </View>
115
+ ) : (
116
+ <Typography.Body intent="body" style={{ fontSize, lineHeight }}>
117
+ {children}
118
+ </Typography.Body>
119
+ )}
120
+ </MaskedView>
121
+ {/* Visually hidden but accessible text for screen readers */}
122
+ <View
123
+ style={{ position: 'absolute', opacity: 0 }}
124
+ importantForAccessibility="yes"
125
+ accessibilityElementsHidden={false}
126
+ >
127
+ <Typography.Body intent="body" style={{ fontSize, lineHeight }}>
128
+ {children}
129
+ </Typography.Body>
130
+ </View>
131
+ </View>
132
+ );
133
+ };
134
+
135
+ export default AnimatedGradientText;