@hero-design/rn-work-uikit 1.12.4 → 1.12.5

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,14 @@
1
1
  # @hero-design/rn-work-uikit
2
2
 
3
+ ## 1.12.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4963](https://github.com/Thinkei/hero-design/pull/4963) [`8921509e3c0271abe2c0df377316fc5ded154a05`](https://github.com/Thinkei/hero-design/commit/8921509e3c0271abe2c0df377316fc5ded154a05) Thanks [@ttkien](https://github.com/ttkien)! - [Icon] add 'ai' intent
8
+
9
+ - Updated dependencies [[`4caa323ce232ef982bab8e3845aadc6b493a3804`](https://github.com/Thinkei/hero-design/commit/4caa323ce232ef982bab8e3845aadc6b493a3804), [`8921509e3c0271abe2c0df377316fc5ded154a05`](https://github.com/Thinkei/hero-design/commit/8921509e3c0271abe2c0df377316fc5ded154a05), [`654135e5178e2ab74dc6e9d80edb7bdab60275d7`](https://github.com/Thinkei/hero-design/commit/654135e5178e2ab74dc6e9d80edb7bdab60275d7)]:
10
+ - @hero-design/rn@8.121.0
11
+
3
12
  ## 1.12.4
4
13
 
5
14
  ### Patch Changes
package/es/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import * as React from 'react';
2
- import React__default, { useState, useEffect, createContext, useRef, useMemo, useCallback, forwardRef, useContext, useLayoutEffect, memo, useReducer, isValidElement, useImperativeHandle } from 'react';
2
+ import React__default, { useState, useEffect, createContext, useRef, useCallback, useMemo, forwardRef, useContext, useLayoutEffect, memo, useReducer, isValidElement, useImperativeHandle } from 'react';
3
3
  import * as reactNative from 'react-native';
4
4
  import { Platform, Keyboard, StyleSheet as StyleSheet$1, View, Animated, Pressable, SafeAreaView, KeyboardAvoidingView, TouchableOpacity, Dimensions, Easing, Text as Text$1, TouchableHighlight, ScrollView, Modal as Modal$1, TextInput as TextInput$2, SectionList, UIManager, LayoutAnimation, useWindowDimensions, TouchableWithoutFeedback, Image as Image$1, FlatList, PanResponder, BackHandler, InteractionManager, RefreshControl as RefreshControl$1 } from 'react-native';
5
5
  import { createIconSet } from 'react-native-vector-icons';
6
+ import MaskedView from '@react-native-masked-view/masked-view';
7
+ import { LinearGradient } from 'expo-linear-gradient';
6
8
  import DateTimePicker from '@react-native-community/datetimepicker';
7
9
  import { MonthYearPickerDialogueAndroid, MonthYearPickerViewIOS } from '@hero-design/react-native-month-year-picker';
8
10
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
@@ -10,7 +12,7 @@ import Svg, { G, ForeignObject, Line as Line$1, Path as Path$1, Rect, Mask, Circ
10
12
  import RnSlider from '@react-native-community/slider';
11
13
  import MultiSlider from '@ptomasroos/react-native-multi-slider';
12
14
  import { RectButton, GestureHandlerRootView, Swipeable as Swipeable$1 } from 'react-native-gesture-handler';
13
- import LinearGradient from 'react-native-linear-gradient';
15
+ import LinearGradient$1 from 'react-native-linear-gradient';
14
16
  import PagerView from 'react-native-pager-view';
15
17
  import { EventEmitter } from 'events';
16
18
  import { WebView } from 'react-native-webview';
@@ -3711,13 +3713,13 @@ var StyledDivider = index$c(View)(function (_ref) {
3711
3713
  }, horizontalMargin), verticalMargin);
3712
3714
  });
3713
3715
 
3714
- var _excluded$R = ["marginHorizontal", "marginVertical", "style", "testID"];
3716
+ var _excluded$T = ["marginHorizontal", "marginVertical", "style", "testID"];
3715
3717
  var Divider = function Divider(_ref) {
3716
3718
  var marginHorizontal = _ref.marginHorizontal,
3717
3719
  marginVertical = _ref.marginVertical,
3718
3720
  style = _ref.style,
3719
3721
  testID = _ref.testID,
3720
- nativeProps = _objectWithoutProperties(_ref, _excluded$R);
3722
+ nativeProps = _objectWithoutProperties(_ref, _excluded$T);
3721
3723
  return /*#__PURE__*/React__default.createElement(StyledDivider, _extends$1({}, nativeProps, {
3722
3724
  themeMarginHorizontal: marginHorizontal,
3723
3725
  themeMarginVertical: marginVertical,
@@ -5735,6 +5737,77 @@ var getShadows = function getShadows(palette) {
5735
5737
  }
5736
5738
  };
5737
5739
 
5740
+ var DIAGONAL_ANGLE = 282;
5741
+ var HORIZONTAL_ANGLE = 90;
5742
+ var DIAGONAL_LOCATIONS = [0, 0.2931, 0.993];
5743
+ var HORIZONTAL_LOCATIONS = [0, 0.25, 0.75];
5744
+
5745
+ // Convert CSS gradient angle (degrees) to expo-linear-gradient start/end points.
5746
+ // Follows CSS convention: 0° = bottom→top, 90° = left→right,
5747
+ // 180° = top→bottom, 270° = right→left.
5748
+ var angleToPoints = function angleToPoints(angleDeg) {
5749
+ var rad = (angleDeg - 90) * Math.PI / 180;
5750
+ var x = Math.cos(rad);
5751
+ var y = Math.sin(rad);
5752
+ // Normalize so both components are in [0, 1]
5753
+ var start = {
5754
+ x: Math.round((1 - x) / 2 * 100) / 100,
5755
+ y: Math.round((1 - y) / 2 * 100) / 100
5756
+ };
5757
+ var end = {
5758
+ x: Math.round((1 + x) / 2 * 100) / 100,
5759
+ y: Math.round((1 + y) / 2 * 100) / 100
5760
+ };
5761
+ return {
5762
+ start: start,
5763
+ end: end
5764
+ };
5765
+ };
5766
+ var getGradients = function getGradients(systemPalette) {
5767
+ var blueMedium = palette$9.blueMedium;
5768
+ var pinkMedium = palette$9.pinkMedium;
5769
+ var brandPrimary = systemPalette.primary;
5770
+ var backgroundFallback = systemPalette.defaultGlobalSurface;
5771
+ return {
5772
+ aiDiagonal: _objectSpread2(_objectSpread2({
5773
+ angle: DIAGONAL_ANGLE
5774
+ }, angleToPoints(DIAGONAL_ANGLE)), {}, {
5775
+ colors: [blueMedium, brandPrimary, pinkMedium],
5776
+ locations: DIAGONAL_LOCATIONS
5777
+ }),
5778
+ aiDiagonal8: _objectSpread2(_objectSpread2({
5779
+ angle: DIAGONAL_ANGLE
5780
+ }, angleToPoints(DIAGONAL_ANGLE)), {}, {
5781
+ colors: [blueMedium, brandPrimary, pinkMedium],
5782
+ locations: DIAGONAL_LOCATIONS,
5783
+ opacity: 0.08,
5784
+ backgroundFallback: backgroundFallback
5785
+ }),
5786
+ aiDiagonal16: _objectSpread2(_objectSpread2({
5787
+ angle: DIAGONAL_ANGLE
5788
+ }, angleToPoints(DIAGONAL_ANGLE)), {}, {
5789
+ colors: [blueMedium, brandPrimary, pinkMedium],
5790
+ locations: DIAGONAL_LOCATIONS,
5791
+ opacity: 0.16,
5792
+ backgroundFallback: backgroundFallback
5793
+ }),
5794
+ aiDiagonal24: _objectSpread2(_objectSpread2({
5795
+ angle: DIAGONAL_ANGLE
5796
+ }, angleToPoints(DIAGONAL_ANGLE)), {}, {
5797
+ colors: [blueMedium, brandPrimary, pinkMedium],
5798
+ locations: DIAGONAL_LOCATIONS,
5799
+ opacity: 0.24,
5800
+ backgroundFallback: backgroundFallback
5801
+ }),
5802
+ aiHorizontal: _objectSpread2(_objectSpread2({
5803
+ angle: HORIZONTAL_ANGLE
5804
+ }, angleToPoints(HORIZONTAL_ANGLE)), {}, {
5805
+ colors: [brandPrimary, pinkMedium, brandPrimary],
5806
+ locations: HORIZONTAL_LOCATIONS
5807
+ })
5808
+ };
5809
+ };
5810
+
5738
5811
  var getGlobalTheme = function getGlobalTheme(scale, systemPalette) {
5739
5812
  var fonts = getFonts(scale.font);
5740
5813
  var fontSizes = getFontSizes(scale.fontSize);
@@ -5744,8 +5817,11 @@ var getGlobalTheme = function getGlobalTheme(scale, systemPalette) {
5744
5817
  var sizes = getSizes(scale.size);
5745
5818
  var radii = getRadii(scale.radius);
5746
5819
  var shadows = getShadows(systemPalette);
5820
+ var gradients = getGradients(systemPalette);
5747
5821
  return {
5748
- colors: _objectSpread2({}, systemPalette),
5822
+ colors: _objectSpread2(_objectSpread2({}, systemPalette), {}, {
5823
+ gradients: gradients
5824
+ }),
5749
5825
  fonts: fonts,
5750
5826
  fontSizes: fontSizes,
5751
5827
  lineHeights: lineHeights,
@@ -8084,7 +8160,7 @@ var StyledLoadingDot = index$c(View)(function (_ref) {
8084
8160
  }, themeStyling());
8085
8161
  });
8086
8162
 
8087
- var _excluded$Q = ["count", "size", "testID", "themeVariant"];
8163
+ var _excluded$S = ["count", "size", "testID", "themeVariant"];
8088
8164
  var AnimatedLoadingIndicatorWrapper = Animated.createAnimatedComponent(StyledLoadingIndicatorWrapper);
8089
8165
  var AnimatedLoadingDot = Animated.createAnimatedComponent(StyledLoadingDot);
8090
8166
  var renderDotComponent = function renderDotComponent(_ref) {
@@ -8116,7 +8192,7 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
8116
8192
  size = _ref2$size === void 0 ? 12 : _ref2$size,
8117
8193
  testID = _ref2.testID,
8118
8194
  themeVariant = _ref2.themeVariant,
8119
- nativeProps = _objectWithoutProperties(_ref2, _excluded$Q);
8195
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$S);
8120
8196
  var progressAnimation = useRef(new Animated.Value(0));
8121
8197
  useEffect(function () {
8122
8198
  var animation = Animated.loop(Animated.timing(progressAnimation.current, {
@@ -8746,10 +8822,10 @@ var StyledHeroIcon = index$c(HeroIcon)(function (_ref) {
8746
8822
  };
8747
8823
  });
8748
8824
 
8749
- var _excluded$P = ["style"];
8750
- var AnimatedIcon = function AnimatedIcon(_ref) {
8751
- var style = _ref.style,
8752
- otherProps = _objectWithoutProperties(_ref, _excluded$P);
8825
+ var SpinWrapper = function SpinWrapper(_ref) {
8826
+ var children = _ref.children,
8827
+ style = _ref.style,
8828
+ testID = _ref.testID;
8753
8829
  var rotateAnimation = useRef(new Animated.Value(0));
8754
8830
  useEffect(function () {
8755
8831
  var animation = Animated.loop(Animated.timing(rotateAnimation.current, {
@@ -8760,22 +8836,74 @@ var AnimatedIcon = function AnimatedIcon(_ref) {
8760
8836
  }));
8761
8837
  animation.start();
8762
8838
  return function () {
8763
- animation.stop();
8839
+ return animation.stop();
8764
8840
  };
8765
8841
  }, []);
8766
- var interpolatedRotateAnimation = rotateAnimation.current.interpolate({
8842
+ var rotate = rotateAnimation.current.interpolate({
8767
8843
  inputRange: [0, 1],
8768
8844
  outputRange: ['0deg', '360deg']
8769
8845
  });
8770
8846
  return /*#__PURE__*/React__default.createElement(Animated.View, {
8847
+ testID: testID,
8771
8848
  style: [{
8772
8849
  transform: [{
8773
- rotate: interpolatedRotateAnimation
8850
+ rotate: rotate
8774
8851
  }]
8775
8852
  }, style]
8853
+ }, children);
8854
+ };
8855
+
8856
+ var _excluded$R = ["style"];
8857
+ var AnimatedIcon = function AnimatedIcon(_ref) {
8858
+ var style = _ref.style,
8859
+ otherProps = _objectWithoutProperties(_ref, _excluded$R);
8860
+ return /*#__PURE__*/React__default.createElement(SpinWrapper, {
8861
+ style: style
8776
8862
  }, /*#__PURE__*/React__default.createElement(StyledHeroIcon, otherProps));
8777
8863
  };
8778
8864
 
8865
+ var _excluded$Q = ["name", "themeSize", "testID", "style"];
8866
+ var GradientIcon = function GradientIcon(_ref) {
8867
+ var name = _ref.name,
8868
+ themeSize = _ref.themeSize,
8869
+ testID = _ref.testID,
8870
+ style = _ref.style,
8871
+ accessibilityProps = _objectWithoutProperties(_ref, _excluded$Q);
8872
+ var theme = useTheme();
8873
+ var gradient = theme.colors.gradients.aiDiagonal;
8874
+ var size = theme.__hd__.icon.sizes[themeSize];
8875
+ return /*#__PURE__*/React__default.createElement(MaskedView, _extends$1({
8876
+ testID: testID,
8877
+ style: [{
8878
+ width: size,
8879
+ height: size
8880
+ }, style]
8881
+ }, accessibilityProps, {
8882
+ maskElement: /*#__PURE__*/React__default.createElement(View, {
8883
+ style: {
8884
+ backgroundColor: 'transparent',
8885
+ width: size,
8886
+ height: size,
8887
+ alignItems: 'center',
8888
+ justifyContent: 'center'
8889
+ }
8890
+ }, /*#__PURE__*/React__default.createElement(StyledHeroIcon, {
8891
+ name: name,
8892
+ themeIntent: "text",
8893
+ themeSize: themeSize
8894
+ }))
8895
+ }), /*#__PURE__*/React__default.createElement(LinearGradient, {
8896
+ start: gradient.start,
8897
+ end: gradient.end,
8898
+ colors: gradient.colors,
8899
+ locations: gradient.locations,
8900
+ style: {
8901
+ width: size,
8902
+ height: size
8903
+ }
8904
+ }));
8905
+ };
8906
+
8779
8907
  var Icon = function Icon(_ref) {
8780
8908
  var icon = _ref.icon,
8781
8909
  style = _ref.style,
@@ -8811,6 +8939,20 @@ var Icon = function Icon(_ref) {
8811
8939
  accessibilityViewIsModal: accessibilityViewIsModal,
8812
8940
  accessibilityActions: accessibilityActions
8813
8941
  };
8942
+ if (intent === 'ai') {
8943
+ var gradientIcon = /*#__PURE__*/React__default.createElement(GradientIcon, _extends$1({
8944
+ name: icon,
8945
+ themeSize: size,
8946
+ testID: testID,
8947
+ style: spin ? undefined : style
8948
+ }, accessibilityProps));
8949
+ if (spin) {
8950
+ return /*#__PURE__*/React__default.createElement(SpinWrapper, {
8951
+ style: style
8952
+ }, gradientIcon);
8953
+ }
8954
+ return gradientIcon;
8955
+ }
8814
8956
  return spin ? /*#__PURE__*/React__default.createElement(AnimatedIcon, _extends$1({
8815
8957
  name: icon,
8816
8958
  themeIntent: intent,
@@ -8849,7 +8991,7 @@ var StyledText$4 = index$c(Text$1)(function (_ref) {
8849
8991
  });
8850
8992
  });
8851
8993
 
8852
- var _excluded$O = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
8994
+ var _excluded$P = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
8853
8995
  /**
8854
8996
  * @deprecated Typography.Text is deprecated and will be removed in the next major release, please refer to https://design.employmenthero.com/mobile/Components/typography for the appropriate alternatives.
8855
8997
  */
@@ -8865,7 +9007,7 @@ var Text = function Text(_ref) {
8865
9007
  typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
8866
9008
  _ref$allowFontScaling = _ref.allowFontScaling,
8867
9009
  allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
8868
- nativeProps = _objectWithoutProperties(_ref, _excluded$O);
9010
+ nativeProps = _objectWithoutProperties(_ref, _excluded$P);
8869
9011
  useDeprecation('Typography.Text is deprecated and will be removed in the next major release, please refer to https://design.employmenthero.com/mobile/Components/typography for the appropriate alternatives.');
8870
9012
  return /*#__PURE__*/React__default.createElement(StyledText$4, _extends$1({}, nativeProps, {
8871
9013
  themeFontSize: fontSize,
@@ -8898,7 +9040,79 @@ var StyledCaption = index$c(Text$1)(function (_ref) {
8898
9040
  };
8899
9041
  });
8900
9042
 
8901
- var _excluded$N = ["children", "fontWeight", "intent", "allowFontScaling", "fontStyle"];
9043
+ var ACCESSIBILITY_KEYS = ['accessible', 'accessibilityActions', 'accessibilityLabel', 'accessibilityRole', 'accessibilityState', 'accessibilityHint', 'accessibilityValue', 'onAccessibilityAction',
9044
+ // Android
9045
+ 'accessibilityLabelledBy', 'accessibilityLiveRegion', 'importantForAccessibility',
9046
+ // iOS
9047
+ 'accessibilityElementsHidden', 'accessibilityLanguage', 'accessibilityIgnoresInvertColors', 'accessibilityViewIsModal', 'onAccessibilityEscape', 'onAccessibilityTap', 'onMagicTap', 'accessibilityIgnoresInvertColors'];
9048
+ var pickAccessibilityProps = function pickAccessibilityProps(props) {
9049
+ return ACCESSIBILITY_KEYS.filter(function (key) {
9050
+ return key in props;
9051
+ }).reduce(function (acc, key) {
9052
+ return Object.assign(acc, _defineProperty({}, key, props[key]));
9053
+ }, {});
9054
+ };
9055
+
9056
+ var _excluded$O = ["children"];
9057
+ var GradientText = function GradientText(_ref) {
9058
+ var children = _ref.children,
9059
+ accessibilityProps = _objectWithoutProperties(_ref, _excluded$O);
9060
+ var theme = useTheme();
9061
+ var gradient = theme.colors.gradients.aiDiagonal;
9062
+ var _useState = useState(null),
9063
+ _useState2 = _slicedToArray(_useState, 2),
9064
+ size = _useState2[0],
9065
+ setSize = _useState2[1];
9066
+ var onLayout = useCallback(function (event) {
9067
+ var _event$nativeEvent$la = event.nativeEvent.layout,
9068
+ width = _event$nativeEvent$la.width,
9069
+ height = _event$nativeEvent$la.height;
9070
+ setSize(function (prevSize) {
9071
+ if (prevSize && prevSize.width === width && prevSize.height === height) {
9072
+ return prevSize;
9073
+ }
9074
+ return {
9075
+ width: width,
9076
+ height: height
9077
+ };
9078
+ });
9079
+ }, []);
9080
+ return /*#__PURE__*/React__default.createElement(View, accessibilityProps, /*#__PURE__*/React__default.createElement(MaskedView, {
9081
+ style: {
9082
+ alignSelf: 'stretch'
9083
+ },
9084
+ accessibilityElementsHidden: true,
9085
+ importantForAccessibility: "no-hide-descendants",
9086
+ maskElement: /*#__PURE__*/React__default.createElement(View, {
9087
+ onLayout: onLayout,
9088
+ style: {
9089
+ backgroundColor: 'transparent'
9090
+ },
9091
+ testID: "gradient-text-mask"
9092
+ }, children)
9093
+ }, size ? /*#__PURE__*/React__default.createElement(LinearGradient, {
9094
+ start: gradient.start,
9095
+ end: gradient.end,
9096
+ colors: gradient.colors,
9097
+ locations: gradient.locations,
9098
+ style: {
9099
+ width: size.width,
9100
+ height: size.height
9101
+ }
9102
+ }) :
9103
+ // Render children as fallback until layout is measured, so text
9104
+ // is visible immediately rather than blank on the first frame.
9105
+ children), /*#__PURE__*/React__default.createElement(View, {
9106
+ style: {
9107
+ position: 'absolute',
9108
+ opacity: 0
9109
+ },
9110
+ importantForAccessibility: "yes",
9111
+ accessibilityElementsHidden: false
9112
+ }, children));
9113
+ };
9114
+
9115
+ var _excluded$N = ["children", "fontWeight", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
8902
9116
  var Caption = function Caption(_ref) {
8903
9117
  var children = _ref.children,
8904
9118
  _ref$fontWeight = _ref.fontWeight,
@@ -8909,13 +9123,22 @@ var Caption = function Caption(_ref) {
8909
9123
  allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
8910
9124
  _ref$fontStyle = _ref.fontStyle,
8911
9125
  fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
9126
+ style = _ref.style,
9127
+ testID = _ref.testID,
8912
9128
  nativeProps = _objectWithoutProperties(_ref, _excluded$N);
8913
- return /*#__PURE__*/React__default.createElement(StyledCaption, _extends$1({}, nativeProps, {
9129
+ var isAi = intent === 'ai';
9130
+ var styledText = /*#__PURE__*/React__default.createElement(StyledCaption, _extends$1({}, nativeProps, {
8914
9131
  themeFontWeight: fontWeight,
8915
- themeIntent: intent,
9132
+ themeIntent: isAi ? 'body' : intent,
8916
9133
  themeIsItalic: fontStyle === 'italic',
8917
- allowFontScaling: allowFontScaling
9134
+ allowFontScaling: allowFontScaling,
9135
+ style: style,
9136
+ testID: testID
8918
9137
  }), children);
9138
+ if (isAi) {
9139
+ return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
9140
+ }
9141
+ return styledText;
8919
9142
  };
8920
9143
 
8921
9144
  var StyledLabel$2 = index$c(Text$1)(function (_ref) {
@@ -8934,7 +9157,7 @@ var StyledLabel$2 = index$c(Text$1)(function (_ref) {
8934
9157
  };
8935
9158
  });
8936
9159
 
8937
- var _excluded$M = ["children", "intent", "allowFontScaling", "fontStyle"];
9160
+ var _excluded$M = ["children", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
8938
9161
  var Label = function Label(_ref) {
8939
9162
  var children = _ref.children,
8940
9163
  _ref$intent = _ref.intent,
@@ -8943,12 +9166,21 @@ var Label = function Label(_ref) {
8943
9166
  allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
8944
9167
  _ref$fontStyle = _ref.fontStyle,
8945
9168
  fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
9169
+ style = _ref.style,
9170
+ testID = _ref.testID,
8946
9171
  nativeProps = _objectWithoutProperties(_ref, _excluded$M);
8947
- return /*#__PURE__*/React__default.createElement(StyledLabel$2, _extends$1({}, nativeProps, {
8948
- themeIntent: intent,
9172
+ var isAi = intent === 'ai';
9173
+ var styledText = /*#__PURE__*/React__default.createElement(StyledLabel$2, _extends$1({}, nativeProps, {
9174
+ themeIntent: isAi ? 'body' : intent,
8949
9175
  themeIsItalic: fontStyle === 'italic',
8950
- allowFontScaling: allowFontScaling
9176
+ allowFontScaling: allowFontScaling,
9177
+ style: style,
9178
+ testID: testID
8951
9179
  }), children);
9180
+ if (isAi) {
9181
+ return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
9182
+ }
9183
+ return styledText;
8952
9184
  };
8953
9185
 
8954
9186
  var StyledTitle$1 = index$c(Text$1)(function (_ref) {
@@ -8966,7 +9198,7 @@ var StyledTitle$1 = index$c(Text$1)(function (_ref) {
8966
9198
  };
8967
9199
  });
8968
9200
 
8969
- var _excluded$L = ["children", "intent", "allowFontScaling", "level", "typeface", "fontStyle"];
9201
+ var _excluded$L = ["children", "intent", "allowFontScaling", "level", "typeface", "fontStyle", "style", "testID"];
8970
9202
  var Title = function Title(_ref) {
8971
9203
  var children = _ref.children,
8972
9204
  _ref$intent = _ref.intent,
@@ -8979,14 +9211,23 @@ var Title = function Title(_ref) {
8979
9211
  typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
8980
9212
  _ref$fontStyle = _ref.fontStyle,
8981
9213
  fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
9214
+ style = _ref.style,
9215
+ testID = _ref.testID,
8982
9216
  nativeProps = _objectWithoutProperties(_ref, _excluded$L);
8983
- return /*#__PURE__*/React__default.createElement(StyledTitle$1, _extends$1({}, nativeProps, {
9217
+ var isAi = intent === 'ai';
9218
+ var styledText = /*#__PURE__*/React__default.createElement(StyledTitle$1, _extends$1({}, nativeProps, {
8984
9219
  themeLevel: level,
8985
9220
  themeTypeface: typeface,
8986
- themeIntent: intent,
9221
+ themeIntent: isAi ? 'body' : intent,
8987
9222
  themeIsItalic: fontStyle === 'italic',
8988
- allowFontScaling: allowFontScaling
9223
+ allowFontScaling: allowFontScaling,
9224
+ style: style,
9225
+ testID: testID
8989
9226
  }), children);
9227
+ if (isAi) {
9228
+ return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
9229
+ }
9230
+ return styledText;
8990
9231
  };
8991
9232
 
8992
9233
  var FONTWEIGHT_MAP = {
@@ -9018,7 +9259,7 @@ var StyledBody$2 = index$c(Text$1)(function (_ref) {
9018
9259
  };
9019
9260
  });
9020
9261
 
9021
- var _excluded$K = ["children", "intent", "allowFontScaling", "typeface", "variant", "fontStyle"];
9262
+ var _excluded$K = ["children", "intent", "allowFontScaling", "typeface", "variant", "fontStyle", "style", "testID"];
9022
9263
  var Body = function Body(_ref) {
9023
9264
  var children = _ref.children,
9024
9265
  _ref$intent = _ref.intent,
@@ -9031,14 +9272,23 @@ var Body = function Body(_ref) {
9031
9272
  variant = _ref$variant === void 0 ? 'regular' : _ref$variant,
9032
9273
  _ref$fontStyle = _ref.fontStyle,
9033
9274
  fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
9275
+ style = _ref.style,
9276
+ testID = _ref.testID,
9034
9277
  nativeProps = _objectWithoutProperties(_ref, _excluded$K);
9035
- return /*#__PURE__*/React__default.createElement(StyledBody$2, _extends$1({}, nativeProps, {
9278
+ var isAi = intent === 'ai';
9279
+ var styledText = /*#__PURE__*/React__default.createElement(StyledBody$2, _extends$1({}, nativeProps, {
9036
9280
  themeTypeface: typeface,
9037
- themeIntent: intent,
9281
+ themeIntent: isAi ? 'body' : intent,
9038
9282
  themeVariant: variant,
9039
9283
  themeIsItalic: fontStyle === 'italic',
9040
- allowFontScaling: allowFontScaling
9284
+ allowFontScaling: allowFontScaling,
9285
+ style: style,
9286
+ testID: testID
9041
9287
  }), children);
9288
+ if (isAi) {
9289
+ return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
9290
+ }
9291
+ return styledText;
9042
9292
  };
9043
9293
 
9044
9294
  var Typography = {
@@ -27335,7 +27585,7 @@ var StyledGradientContainer = index$c(Box)(function (_ref2) {
27335
27585
  });
27336
27586
 
27337
27587
  var _excluded$e = ["intent", "variant", "style", "onLayout"];
27338
- var AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient);
27588
+ var AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient$1);
27339
27589
  var gradientPositions = {
27340
27590
  start: {
27341
27591
  x: 0,
package/jest.config.js CHANGED
@@ -13,7 +13,7 @@ module.exports = {
13
13
  '^.+\\.(js|jsx|ts|tsx)$': 'babel-jest',
14
14
  },
15
15
  transformIgnorePatterns: [
16
- 'node_modules/(?!(react-native|@react-native|react-native-vector-icons|react-native-gesture-handler|react-native-webview|react-native-svg|react-native-linear-gradient|@react-native-community|@ptomasroos|react-native-pager-view|@hero-design|d3|d3-.*|internmap|delaunator|robust-predicates|nanoid)/)',
16
+ 'node_modules/(?!(react-native|@react-native|react-native-vector-icons|react-native-gesture-handler|react-native-webview|react-native-svg|@react-native-masked-view|expo-linear-gradient|react-native-linear-gradient|@react-native-community|@ptomasroos|react-native-pager-view|@hero-design|d3|d3-.*|internmap|delaunator|robust-predicates|nanoid)/)',
17
17
  ],
18
18
  testMatch: [
19
19
  '<rootDir>/src/**/__tests__/**/*.(ts|tsx|js)',
@@ -72,5 +72,11 @@ module.exports = {
72
72
  ),
73
73
 
74
74
  // All mocks are now handled in setup.tsx files
75
+
76
+ // Redirect native-only packages to stubs so they don't load requireNativeComponent
77
+ '^@react-native-masked-view/masked-view$':
78
+ '<rootDir>/testUtils/mocks/masked-view.js',
79
+ '^expo-linear-gradient$':
80
+ '<rootDir>/testUtils/mocks/expo-linear-gradient.js',
75
81
  },
76
82
  };
package/lib/index.js CHANGED
@@ -3,6 +3,8 @@
3
3
  var React = require('react');
4
4
  var reactNative = require('react-native');
5
5
  var reactNativeVectorIcons = require('react-native-vector-icons');
6
+ var MaskedView = require('@react-native-masked-view/masked-view');
7
+ var expoLinearGradient = require('expo-linear-gradient');
6
8
  var DateTimePicker = require('@react-native-community/datetimepicker');
7
9
  var reactNativeMonthYearPicker = require('@hero-design/react-native-month-year-picker');
8
10
  var reactNativeSafeAreaContext = require('react-native-safe-area-context');
@@ -37,6 +39,7 @@ function _interopNamespaceCompat(e) {
37
39
 
38
40
  var React__namespace = /*#__PURE__*/_interopNamespaceCompat(React);
39
41
  var reactNative__namespace = /*#__PURE__*/_interopNamespaceCompat(reactNative);
42
+ var MaskedView__default = /*#__PURE__*/_interopDefaultCompat(MaskedView);
40
43
  var DateTimePicker__default = /*#__PURE__*/_interopDefaultCompat(DateTimePicker);
41
44
  var Svg__default = /*#__PURE__*/_interopDefaultCompat(Svg);
42
45
  var RnSlider__default = /*#__PURE__*/_interopDefaultCompat(RnSlider);
@@ -3740,13 +3743,13 @@ var StyledDivider = index$c(reactNative.View)(function (_ref) {
3740
3743
  }, horizontalMargin), verticalMargin);
3741
3744
  });
3742
3745
 
3743
- var _excluded$R = ["marginHorizontal", "marginVertical", "style", "testID"];
3746
+ var _excluded$T = ["marginHorizontal", "marginVertical", "style", "testID"];
3744
3747
  var Divider = function Divider(_ref) {
3745
3748
  var marginHorizontal = _ref.marginHorizontal,
3746
3749
  marginVertical = _ref.marginVertical,
3747
3750
  style = _ref.style,
3748
3751
  testID = _ref.testID,
3749
- nativeProps = _objectWithoutProperties(_ref, _excluded$R);
3752
+ nativeProps = _objectWithoutProperties(_ref, _excluded$T);
3750
3753
  return /*#__PURE__*/React__namespace.default.createElement(StyledDivider, _extends$1({}, nativeProps, {
3751
3754
  themeMarginHorizontal: marginHorizontal,
3752
3755
  themeMarginVertical: marginVertical,
@@ -5764,6 +5767,77 @@ var getShadows = function getShadows(palette) {
5764
5767
  }
5765
5768
  };
5766
5769
 
5770
+ var DIAGONAL_ANGLE = 282;
5771
+ var HORIZONTAL_ANGLE = 90;
5772
+ var DIAGONAL_LOCATIONS = [0, 0.2931, 0.993];
5773
+ var HORIZONTAL_LOCATIONS = [0, 0.25, 0.75];
5774
+
5775
+ // Convert CSS gradient angle (degrees) to expo-linear-gradient start/end points.
5776
+ // Follows CSS convention: 0° = bottom→top, 90° = left→right,
5777
+ // 180° = top→bottom, 270° = right→left.
5778
+ var angleToPoints = function angleToPoints(angleDeg) {
5779
+ var rad = (angleDeg - 90) * Math.PI / 180;
5780
+ var x = Math.cos(rad);
5781
+ var y = Math.sin(rad);
5782
+ // Normalize so both components are in [0, 1]
5783
+ var start = {
5784
+ x: Math.round((1 - x) / 2 * 100) / 100,
5785
+ y: Math.round((1 - y) / 2 * 100) / 100
5786
+ };
5787
+ var end = {
5788
+ x: Math.round((1 + x) / 2 * 100) / 100,
5789
+ y: Math.round((1 + y) / 2 * 100) / 100
5790
+ };
5791
+ return {
5792
+ start: start,
5793
+ end: end
5794
+ };
5795
+ };
5796
+ var getGradients = function getGradients(systemPalette) {
5797
+ var blueMedium = palette$9.blueMedium;
5798
+ var pinkMedium = palette$9.pinkMedium;
5799
+ var brandPrimary = systemPalette.primary;
5800
+ var backgroundFallback = systemPalette.defaultGlobalSurface;
5801
+ return {
5802
+ aiDiagonal: _objectSpread2(_objectSpread2({
5803
+ angle: DIAGONAL_ANGLE
5804
+ }, angleToPoints(DIAGONAL_ANGLE)), {}, {
5805
+ colors: [blueMedium, brandPrimary, pinkMedium],
5806
+ locations: DIAGONAL_LOCATIONS
5807
+ }),
5808
+ aiDiagonal8: _objectSpread2(_objectSpread2({
5809
+ angle: DIAGONAL_ANGLE
5810
+ }, angleToPoints(DIAGONAL_ANGLE)), {}, {
5811
+ colors: [blueMedium, brandPrimary, pinkMedium],
5812
+ locations: DIAGONAL_LOCATIONS,
5813
+ opacity: 0.08,
5814
+ backgroundFallback: backgroundFallback
5815
+ }),
5816
+ aiDiagonal16: _objectSpread2(_objectSpread2({
5817
+ angle: DIAGONAL_ANGLE
5818
+ }, angleToPoints(DIAGONAL_ANGLE)), {}, {
5819
+ colors: [blueMedium, brandPrimary, pinkMedium],
5820
+ locations: DIAGONAL_LOCATIONS,
5821
+ opacity: 0.16,
5822
+ backgroundFallback: backgroundFallback
5823
+ }),
5824
+ aiDiagonal24: _objectSpread2(_objectSpread2({
5825
+ angle: DIAGONAL_ANGLE
5826
+ }, angleToPoints(DIAGONAL_ANGLE)), {}, {
5827
+ colors: [blueMedium, brandPrimary, pinkMedium],
5828
+ locations: DIAGONAL_LOCATIONS,
5829
+ opacity: 0.24,
5830
+ backgroundFallback: backgroundFallback
5831
+ }),
5832
+ aiHorizontal: _objectSpread2(_objectSpread2({
5833
+ angle: HORIZONTAL_ANGLE
5834
+ }, angleToPoints(HORIZONTAL_ANGLE)), {}, {
5835
+ colors: [brandPrimary, pinkMedium, brandPrimary],
5836
+ locations: HORIZONTAL_LOCATIONS
5837
+ })
5838
+ };
5839
+ };
5840
+
5767
5841
  var getGlobalTheme = function getGlobalTheme(scale, systemPalette) {
5768
5842
  var fonts = getFonts(scale.font);
5769
5843
  var fontSizes = getFontSizes(scale.fontSize);
@@ -5773,8 +5847,11 @@ var getGlobalTheme = function getGlobalTheme(scale, systemPalette) {
5773
5847
  var sizes = getSizes(scale.size);
5774
5848
  var radii = getRadii(scale.radius);
5775
5849
  var shadows = getShadows(systemPalette);
5850
+ var gradients = getGradients(systemPalette);
5776
5851
  return {
5777
- colors: _objectSpread2({}, systemPalette),
5852
+ colors: _objectSpread2(_objectSpread2({}, systemPalette), {}, {
5853
+ gradients: gradients
5854
+ }),
5778
5855
  fonts: fonts,
5779
5856
  fontSizes: fontSizes,
5780
5857
  lineHeights: lineHeights,
@@ -8113,7 +8190,7 @@ var StyledLoadingDot = index$c(reactNative.View)(function (_ref) {
8113
8190
  }, themeStyling());
8114
8191
  });
8115
8192
 
8116
- var _excluded$Q = ["count", "size", "testID", "themeVariant"];
8193
+ var _excluded$S = ["count", "size", "testID", "themeVariant"];
8117
8194
  var AnimatedLoadingIndicatorWrapper = reactNative.Animated.createAnimatedComponent(StyledLoadingIndicatorWrapper);
8118
8195
  var AnimatedLoadingDot = reactNative.Animated.createAnimatedComponent(StyledLoadingDot);
8119
8196
  var renderDotComponent = function renderDotComponent(_ref) {
@@ -8145,7 +8222,7 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
8145
8222
  size = _ref2$size === void 0 ? 12 : _ref2$size,
8146
8223
  testID = _ref2.testID,
8147
8224
  themeVariant = _ref2.themeVariant,
8148
- nativeProps = _objectWithoutProperties(_ref2, _excluded$Q);
8225
+ nativeProps = _objectWithoutProperties(_ref2, _excluded$S);
8149
8226
  var progressAnimation = React.useRef(new reactNative.Animated.Value(0));
8150
8227
  React.useEffect(function () {
8151
8228
  var animation = reactNative.Animated.loop(reactNative.Animated.timing(progressAnimation.current, {
@@ -8775,10 +8852,10 @@ var StyledHeroIcon = index$c(HeroIcon)(function (_ref) {
8775
8852
  };
8776
8853
  });
8777
8854
 
8778
- var _excluded$P = ["style"];
8779
- var AnimatedIcon = function AnimatedIcon(_ref) {
8780
- var style = _ref.style,
8781
- otherProps = _objectWithoutProperties(_ref, _excluded$P);
8855
+ var SpinWrapper = function SpinWrapper(_ref) {
8856
+ var children = _ref.children,
8857
+ style = _ref.style,
8858
+ testID = _ref.testID;
8782
8859
  var rotateAnimation = React.useRef(new reactNative.Animated.Value(0));
8783
8860
  React.useEffect(function () {
8784
8861
  var animation = reactNative.Animated.loop(reactNative.Animated.timing(rotateAnimation.current, {
@@ -8789,22 +8866,74 @@ var AnimatedIcon = function AnimatedIcon(_ref) {
8789
8866
  }));
8790
8867
  animation.start();
8791
8868
  return function () {
8792
- animation.stop();
8869
+ return animation.stop();
8793
8870
  };
8794
8871
  }, []);
8795
- var interpolatedRotateAnimation = rotateAnimation.current.interpolate({
8872
+ var rotate = rotateAnimation.current.interpolate({
8796
8873
  inputRange: [0, 1],
8797
8874
  outputRange: ['0deg', '360deg']
8798
8875
  });
8799
8876
  return /*#__PURE__*/React__namespace.default.createElement(reactNative.Animated.View, {
8877
+ testID: testID,
8800
8878
  style: [{
8801
8879
  transform: [{
8802
- rotate: interpolatedRotateAnimation
8880
+ rotate: rotate
8803
8881
  }]
8804
8882
  }, style]
8883
+ }, children);
8884
+ };
8885
+
8886
+ var _excluded$R = ["style"];
8887
+ var AnimatedIcon = function AnimatedIcon(_ref) {
8888
+ var style = _ref.style,
8889
+ otherProps = _objectWithoutProperties(_ref, _excluded$R);
8890
+ return /*#__PURE__*/React__namespace.default.createElement(SpinWrapper, {
8891
+ style: style
8805
8892
  }, /*#__PURE__*/React__namespace.default.createElement(StyledHeroIcon, otherProps));
8806
8893
  };
8807
8894
 
8895
+ var _excluded$Q = ["name", "themeSize", "testID", "style"];
8896
+ var GradientIcon = function GradientIcon(_ref) {
8897
+ var name = _ref.name,
8898
+ themeSize = _ref.themeSize,
8899
+ testID = _ref.testID,
8900
+ style = _ref.style,
8901
+ accessibilityProps = _objectWithoutProperties(_ref, _excluded$Q);
8902
+ var theme = useTheme();
8903
+ var gradient = theme.colors.gradients.aiDiagonal;
8904
+ var size = theme.__hd__.icon.sizes[themeSize];
8905
+ return /*#__PURE__*/React__namespace.default.createElement(MaskedView__default.default, _extends$1({
8906
+ testID: testID,
8907
+ style: [{
8908
+ width: size,
8909
+ height: size
8910
+ }, style]
8911
+ }, accessibilityProps, {
8912
+ maskElement: /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
8913
+ style: {
8914
+ backgroundColor: 'transparent',
8915
+ width: size,
8916
+ height: size,
8917
+ alignItems: 'center',
8918
+ justifyContent: 'center'
8919
+ }
8920
+ }, /*#__PURE__*/React__namespace.default.createElement(StyledHeroIcon, {
8921
+ name: name,
8922
+ themeIntent: "text",
8923
+ themeSize: themeSize
8924
+ }))
8925
+ }), /*#__PURE__*/React__namespace.default.createElement(expoLinearGradient.LinearGradient, {
8926
+ start: gradient.start,
8927
+ end: gradient.end,
8928
+ colors: gradient.colors,
8929
+ locations: gradient.locations,
8930
+ style: {
8931
+ width: size,
8932
+ height: size
8933
+ }
8934
+ }));
8935
+ };
8936
+
8808
8937
  var Icon = function Icon(_ref) {
8809
8938
  var icon = _ref.icon,
8810
8939
  style = _ref.style,
@@ -8840,6 +8969,20 @@ var Icon = function Icon(_ref) {
8840
8969
  accessibilityViewIsModal: accessibilityViewIsModal,
8841
8970
  accessibilityActions: accessibilityActions
8842
8971
  };
8972
+ if (intent === 'ai') {
8973
+ var gradientIcon = /*#__PURE__*/React__namespace.default.createElement(GradientIcon, _extends$1({
8974
+ name: icon,
8975
+ themeSize: size,
8976
+ testID: testID,
8977
+ style: spin ? undefined : style
8978
+ }, accessibilityProps));
8979
+ if (spin) {
8980
+ return /*#__PURE__*/React__namespace.default.createElement(SpinWrapper, {
8981
+ style: style
8982
+ }, gradientIcon);
8983
+ }
8984
+ return gradientIcon;
8985
+ }
8843
8986
  return spin ? /*#__PURE__*/React__namespace.default.createElement(AnimatedIcon, _extends$1({
8844
8987
  name: icon,
8845
8988
  themeIntent: intent,
@@ -8878,7 +9021,7 @@ var StyledText$4 = index$c(reactNative.Text)(function (_ref) {
8878
9021
  });
8879
9022
  });
8880
9023
 
8881
- var _excluded$O = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
9024
+ var _excluded$P = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
8882
9025
  /**
8883
9026
  * @deprecated Typography.Text is deprecated and will be removed in the next major release, please refer to https://design.employmenthero.com/mobile/Components/typography for the appropriate alternatives.
8884
9027
  */
@@ -8894,7 +9037,7 @@ var Text = function Text(_ref) {
8894
9037
  typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
8895
9038
  _ref$allowFontScaling = _ref.allowFontScaling,
8896
9039
  allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
8897
- nativeProps = _objectWithoutProperties(_ref, _excluded$O);
9040
+ nativeProps = _objectWithoutProperties(_ref, _excluded$P);
8898
9041
  useDeprecation('Typography.Text is deprecated and will be removed in the next major release, please refer to https://design.employmenthero.com/mobile/Components/typography for the appropriate alternatives.');
8899
9042
  return /*#__PURE__*/React__namespace.default.createElement(StyledText$4, _extends$1({}, nativeProps, {
8900
9043
  themeFontSize: fontSize,
@@ -8927,7 +9070,79 @@ var StyledCaption = index$c(reactNative.Text)(function (_ref) {
8927
9070
  };
8928
9071
  });
8929
9072
 
8930
- var _excluded$N = ["children", "fontWeight", "intent", "allowFontScaling", "fontStyle"];
9073
+ var ACCESSIBILITY_KEYS = ['accessible', 'accessibilityActions', 'accessibilityLabel', 'accessibilityRole', 'accessibilityState', 'accessibilityHint', 'accessibilityValue', 'onAccessibilityAction',
9074
+ // Android
9075
+ 'accessibilityLabelledBy', 'accessibilityLiveRegion', 'importantForAccessibility',
9076
+ // iOS
9077
+ 'accessibilityElementsHidden', 'accessibilityLanguage', 'accessibilityIgnoresInvertColors', 'accessibilityViewIsModal', 'onAccessibilityEscape', 'onAccessibilityTap', 'onMagicTap', 'accessibilityIgnoresInvertColors'];
9078
+ var pickAccessibilityProps = function pickAccessibilityProps(props) {
9079
+ return ACCESSIBILITY_KEYS.filter(function (key) {
9080
+ return key in props;
9081
+ }).reduce(function (acc, key) {
9082
+ return Object.assign(acc, _defineProperty({}, key, props[key]));
9083
+ }, {});
9084
+ };
9085
+
9086
+ var _excluded$O = ["children"];
9087
+ var GradientText = function GradientText(_ref) {
9088
+ var children = _ref.children,
9089
+ accessibilityProps = _objectWithoutProperties(_ref, _excluded$O);
9090
+ var theme = useTheme();
9091
+ var gradient = theme.colors.gradients.aiDiagonal;
9092
+ var _useState = React.useState(null),
9093
+ _useState2 = _slicedToArray(_useState, 2),
9094
+ size = _useState2[0],
9095
+ setSize = _useState2[1];
9096
+ var onLayout = React.useCallback(function (event) {
9097
+ var _event$nativeEvent$la = event.nativeEvent.layout,
9098
+ width = _event$nativeEvent$la.width,
9099
+ height = _event$nativeEvent$la.height;
9100
+ setSize(function (prevSize) {
9101
+ if (prevSize && prevSize.width === width && prevSize.height === height) {
9102
+ return prevSize;
9103
+ }
9104
+ return {
9105
+ width: width,
9106
+ height: height
9107
+ };
9108
+ });
9109
+ }, []);
9110
+ return /*#__PURE__*/React__namespace.default.createElement(reactNative.View, accessibilityProps, /*#__PURE__*/React__namespace.default.createElement(MaskedView__default.default, {
9111
+ style: {
9112
+ alignSelf: 'stretch'
9113
+ },
9114
+ accessibilityElementsHidden: true,
9115
+ importantForAccessibility: "no-hide-descendants",
9116
+ maskElement: /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
9117
+ onLayout: onLayout,
9118
+ style: {
9119
+ backgroundColor: 'transparent'
9120
+ },
9121
+ testID: "gradient-text-mask"
9122
+ }, children)
9123
+ }, size ? /*#__PURE__*/React__namespace.default.createElement(expoLinearGradient.LinearGradient, {
9124
+ start: gradient.start,
9125
+ end: gradient.end,
9126
+ colors: gradient.colors,
9127
+ locations: gradient.locations,
9128
+ style: {
9129
+ width: size.width,
9130
+ height: size.height
9131
+ }
9132
+ }) :
9133
+ // Render children as fallback until layout is measured, so text
9134
+ // is visible immediately rather than blank on the first frame.
9135
+ children), /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
9136
+ style: {
9137
+ position: 'absolute',
9138
+ opacity: 0
9139
+ },
9140
+ importantForAccessibility: "yes",
9141
+ accessibilityElementsHidden: false
9142
+ }, children));
9143
+ };
9144
+
9145
+ var _excluded$N = ["children", "fontWeight", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
8931
9146
  var Caption = function Caption(_ref) {
8932
9147
  var children = _ref.children,
8933
9148
  _ref$fontWeight = _ref.fontWeight,
@@ -8938,13 +9153,22 @@ var Caption = function Caption(_ref) {
8938
9153
  allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
8939
9154
  _ref$fontStyle = _ref.fontStyle,
8940
9155
  fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
9156
+ style = _ref.style,
9157
+ testID = _ref.testID,
8941
9158
  nativeProps = _objectWithoutProperties(_ref, _excluded$N);
8942
- return /*#__PURE__*/React__namespace.default.createElement(StyledCaption, _extends$1({}, nativeProps, {
9159
+ var isAi = intent === 'ai';
9160
+ var styledText = /*#__PURE__*/React__namespace.default.createElement(StyledCaption, _extends$1({}, nativeProps, {
8943
9161
  themeFontWeight: fontWeight,
8944
- themeIntent: intent,
9162
+ themeIntent: isAi ? 'body' : intent,
8945
9163
  themeIsItalic: fontStyle === 'italic',
8946
- allowFontScaling: allowFontScaling
9164
+ allowFontScaling: allowFontScaling,
9165
+ style: style,
9166
+ testID: testID
8947
9167
  }), children);
9168
+ if (isAi) {
9169
+ return /*#__PURE__*/React__namespace.default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
9170
+ }
9171
+ return styledText;
8948
9172
  };
8949
9173
 
8950
9174
  var StyledLabel$2 = index$c(reactNative.Text)(function (_ref) {
@@ -8963,7 +9187,7 @@ var StyledLabel$2 = index$c(reactNative.Text)(function (_ref) {
8963
9187
  };
8964
9188
  });
8965
9189
 
8966
- var _excluded$M = ["children", "intent", "allowFontScaling", "fontStyle"];
9190
+ var _excluded$M = ["children", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
8967
9191
  var Label = function Label(_ref) {
8968
9192
  var children = _ref.children,
8969
9193
  _ref$intent = _ref.intent,
@@ -8972,12 +9196,21 @@ var Label = function Label(_ref) {
8972
9196
  allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
8973
9197
  _ref$fontStyle = _ref.fontStyle,
8974
9198
  fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
9199
+ style = _ref.style,
9200
+ testID = _ref.testID,
8975
9201
  nativeProps = _objectWithoutProperties(_ref, _excluded$M);
8976
- return /*#__PURE__*/React__namespace.default.createElement(StyledLabel$2, _extends$1({}, nativeProps, {
8977
- themeIntent: intent,
9202
+ var isAi = intent === 'ai';
9203
+ var styledText = /*#__PURE__*/React__namespace.default.createElement(StyledLabel$2, _extends$1({}, nativeProps, {
9204
+ themeIntent: isAi ? 'body' : intent,
8978
9205
  themeIsItalic: fontStyle === 'italic',
8979
- allowFontScaling: allowFontScaling
9206
+ allowFontScaling: allowFontScaling,
9207
+ style: style,
9208
+ testID: testID
8980
9209
  }), children);
9210
+ if (isAi) {
9211
+ return /*#__PURE__*/React__namespace.default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
9212
+ }
9213
+ return styledText;
8981
9214
  };
8982
9215
 
8983
9216
  var StyledTitle$1 = index$c(reactNative.Text)(function (_ref) {
@@ -8995,7 +9228,7 @@ var StyledTitle$1 = index$c(reactNative.Text)(function (_ref) {
8995
9228
  };
8996
9229
  });
8997
9230
 
8998
- var _excluded$L = ["children", "intent", "allowFontScaling", "level", "typeface", "fontStyle"];
9231
+ var _excluded$L = ["children", "intent", "allowFontScaling", "level", "typeface", "fontStyle", "style", "testID"];
8999
9232
  var Title = function Title(_ref) {
9000
9233
  var children = _ref.children,
9001
9234
  _ref$intent = _ref.intent,
@@ -9008,14 +9241,23 @@ var Title = function Title(_ref) {
9008
9241
  typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
9009
9242
  _ref$fontStyle = _ref.fontStyle,
9010
9243
  fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
9244
+ style = _ref.style,
9245
+ testID = _ref.testID,
9011
9246
  nativeProps = _objectWithoutProperties(_ref, _excluded$L);
9012
- return /*#__PURE__*/React__namespace.default.createElement(StyledTitle$1, _extends$1({}, nativeProps, {
9247
+ var isAi = intent === 'ai';
9248
+ var styledText = /*#__PURE__*/React__namespace.default.createElement(StyledTitle$1, _extends$1({}, nativeProps, {
9013
9249
  themeLevel: level,
9014
9250
  themeTypeface: typeface,
9015
- themeIntent: intent,
9251
+ themeIntent: isAi ? 'body' : intent,
9016
9252
  themeIsItalic: fontStyle === 'italic',
9017
- allowFontScaling: allowFontScaling
9253
+ allowFontScaling: allowFontScaling,
9254
+ style: style,
9255
+ testID: testID
9018
9256
  }), children);
9257
+ if (isAi) {
9258
+ return /*#__PURE__*/React__namespace.default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
9259
+ }
9260
+ return styledText;
9019
9261
  };
9020
9262
 
9021
9263
  var FONTWEIGHT_MAP = {
@@ -9047,7 +9289,7 @@ var StyledBody$2 = index$c(reactNative.Text)(function (_ref) {
9047
9289
  };
9048
9290
  });
9049
9291
 
9050
- var _excluded$K = ["children", "intent", "allowFontScaling", "typeface", "variant", "fontStyle"];
9292
+ var _excluded$K = ["children", "intent", "allowFontScaling", "typeface", "variant", "fontStyle", "style", "testID"];
9051
9293
  var Body = function Body(_ref) {
9052
9294
  var children = _ref.children,
9053
9295
  _ref$intent = _ref.intent,
@@ -9060,14 +9302,23 @@ var Body = function Body(_ref) {
9060
9302
  variant = _ref$variant === void 0 ? 'regular' : _ref$variant,
9061
9303
  _ref$fontStyle = _ref.fontStyle,
9062
9304
  fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
9305
+ style = _ref.style,
9306
+ testID = _ref.testID,
9063
9307
  nativeProps = _objectWithoutProperties(_ref, _excluded$K);
9064
- return /*#__PURE__*/React__namespace.default.createElement(StyledBody$2, _extends$1({}, nativeProps, {
9308
+ var isAi = intent === 'ai';
9309
+ var styledText = /*#__PURE__*/React__namespace.default.createElement(StyledBody$2, _extends$1({}, nativeProps, {
9065
9310
  themeTypeface: typeface,
9066
- themeIntent: intent,
9311
+ themeIntent: isAi ? 'body' : intent,
9067
9312
  themeVariant: variant,
9068
9313
  themeIsItalic: fontStyle === 'italic',
9069
- allowFontScaling: allowFontScaling
9314
+ allowFontScaling: allowFontScaling,
9315
+ style: style,
9316
+ testID: testID
9070
9317
  }), children);
9318
+ if (isAi) {
9319
+ return /*#__PURE__*/React__namespace.default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
9320
+ }
9321
+ return styledText;
9071
9322
  };
9072
9323
 
9073
9324
  var Typography = {
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@hero-design/rn-work-uikit",
3
- "version": "1.12.4",
3
+ "version": "1.12.5",
4
4
  "license": "MIT",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
7
- "react-native": "src/index.ts",
8
7
  "types": "types/index.d.ts",
8
+ "react-native": "src/index.ts",
9
9
  "description": "EH Work specific UI components built on top of @hero-design/rn",
10
10
  "scripts": {
11
11
  "lint": "eslint src --quiet",
@@ -23,7 +23,7 @@
23
23
  "dependencies": {
24
24
  "@emotion/native": "^11.9.3",
25
25
  "@emotion/react": "^11.9.3",
26
- "@hero-design/rn": "8.120.2",
26
+ "@hero-design/rn": "8.121.0",
27
27
  "hero-editor": "^1.17.0"
28
28
  },
29
29
  "peerDependencies": {
@@ -31,6 +31,8 @@
31
31
  "@ptomasroos/react-native-multi-slider": "^2.2.2",
32
32
  "@react-native-community/datetimepicker": "^8.4.4",
33
33
  "@react-native-community/slider": " ^5.0.1",
34
+ "@react-native-masked-view/masked-view": "^0.3.2",
35
+ "expo-linear-gradient": ">=14.0.0",
34
36
  "react": "19.1.0",
35
37
  "react-native": "0.81.5",
36
38
  "react-native-gesture-handler": "~2.28.0",
@@ -58,6 +60,7 @@
58
60
  "@ptomasroos/react-native-multi-slider": "^2.2.2",
59
61
  "@react-native-community/datetimepicker": "8.4.4",
60
62
  "@react-native-community/slider": "^5.0.1",
63
+ "@react-native-masked-view/masked-view": "0.3.2",
61
64
  "@react-native/babel-preset": "0.81.5",
62
65
  "@rollup/plugin-alias": "^5.1.1",
63
66
  "@rollup/plugin-babel": "^6.0.4",
@@ -78,6 +81,7 @@
78
81
  "core-js": "^3.33.0",
79
82
  "eslint": "^8.56.0",
80
83
  "eslint-config-hd": "8.42.5",
84
+ "expo-linear-gradient": "55.0.9",
81
85
  "jest": "^29.2.1",
82
86
  "jest-environment-jsdom": "^29.2.1",
83
87
  "jest-junit": "^16.0.0",
package/rollup.config.mjs CHANGED
@@ -37,6 +37,7 @@ export default [
37
37
  external: [
38
38
  'react',
39
39
  'react-native',
40
+ 'expo-linear-gradient',
40
41
  'react-native-safe-area-context',
41
42
  'react-native-svg',
42
43
  '@react-native-community/datetimepicker',
@@ -48,6 +49,7 @@ export default [
48
49
  'react-native-linear-gradient',
49
50
  '@hero-design/react-native-month-year-picker',
50
51
  '@ptomasroos/react-native-multi-slider',
52
+ '@react-native-masked-view/masked-view'
51
53
  ],
52
54
  plugins: [
53
55
  alias({
@@ -0,0 +1,7 @@
1
+ const React = require('react');
2
+ const { View } = require('react-native');
3
+
4
+ const LinearGradient = ({ children, style }) =>
5
+ React.createElement(View, { style }, children);
6
+
7
+ module.exports = { LinearGradient };
@@ -0,0 +1,7 @@
1
+ const React = require('react');
2
+ const { View } = require('react-native');
3
+
4
+ const MaskedView = ({ maskElement, children, style, testID }) =>
5
+ React.createElement(View, { style, testID }, maskElement, children);
6
+
7
+ module.exports = { __esModule: true, default: MaskedView };
@@ -420,4 +420,38 @@ jest.mock(
420
420
  { virtual: true }
421
421
  );
422
422
 
423
+ jest.mock('@react-native-masked-view/masked-view', () => {
424
+ const React = jest.requireActual('react');
425
+ const { View } = jest.requireActual('react-native');
426
+
427
+ return {
428
+ default: ({
429
+ maskElement,
430
+ children,
431
+ style,
432
+ testID,
433
+ }: {
434
+ maskElement: React.ReactNode;
435
+ children: React.ReactNode;
436
+ style?: object;
437
+ testID?: string;
438
+ }) => React.createElement(View, { style, testID }, maskElement, children),
439
+ };
440
+ });
441
+
442
+ jest.mock('expo-linear-gradient', () => {
443
+ const React = jest.requireActual('react');
444
+ const { View } = jest.requireActual('react-native');
445
+
446
+ return {
447
+ LinearGradient: ({
448
+ children,
449
+ style,
450
+ }: {
451
+ children?: React.ReactNode;
452
+ style?: object;
453
+ }) => React.createElement(View, { style }, children),
454
+ };
455
+ });
456
+
423
457
  export {};