@hero-design/rn-work-uikit 1.12.4 → 1.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/es/index.js +285 -34
- package/jest.config.js +7 -1
- package/lib/index.js +283 -31
- package/package.json +7 -3
- package/rollup.config.mjs +2 -0
- package/testUtils/mocks/expo-linear-gradient.js +7 -0
- package/testUtils/mocks/masked-view.js +7 -0
- package/testUtils/setup.tsx +34 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @hero-design/rn-work-uikit
|
|
2
2
|
|
|
3
|
+
## 1.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#4992](https://github.com/Thinkei/hero-design/pull/4992) [`87bd2b334180c9908328a7cdd2e686694dae1d7d`](https://github.com/Thinkei/hero-design/commit/87bd2b334180c9908328a7cdd2e686694dae1d7d) Thanks [@haudao-eh](https://github.com/haudao-eh)! - [Avatar] Add `neutral` intent to Avatar. `neutral` is now the default intent, replacing `primary`.
|
|
8
|
+
|
|
9
|
+
**Note:** Any Avatar rendered without an explicit `intent` prop will now
|
|
10
|
+
display a teal-grey background instead of dark purple. Add `intent="primary"`
|
|
11
|
+
to preserve the previous appearance.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [[`87bd2b334180c9908328a7cdd2e686694dae1d7d`](https://github.com/Thinkei/hero-design/commit/87bd2b334180c9908328a7cdd2e686694dae1d7d)]:
|
|
16
|
+
- @hero-design/rn@8.122.0
|
|
17
|
+
|
|
18
|
+
## 1.12.5
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#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
|
|
23
|
+
|
|
24
|
+
- 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)]:
|
|
25
|
+
- @hero-design/rn@8.121.0
|
|
26
|
+
|
|
3
27
|
## 1.12.4
|
|
4
28
|
|
|
5
29
|
### 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,
|
|
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$
|
|
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$
|
|
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,
|
|
@@ -5848,6 +5924,7 @@ var getAttachmentTheme = function getAttachmentTheme(theme) {
|
|
|
5848
5924
|
|
|
5849
5925
|
var getAvatarTheme = function getAvatarTheme(theme) {
|
|
5850
5926
|
var colors = {
|
|
5927
|
+
neutral: palette$8.maasstrichtBlueLight25,
|
|
5851
5928
|
primary: theme.colors.primary,
|
|
5852
5929
|
info: theme.colors.info,
|
|
5853
5930
|
danger: theme.colors.error,
|
|
@@ -8084,7 +8161,7 @@ var StyledLoadingDot = index$c(View)(function (_ref) {
|
|
|
8084
8161
|
}, themeStyling());
|
|
8085
8162
|
});
|
|
8086
8163
|
|
|
8087
|
-
var _excluded$
|
|
8164
|
+
var _excluded$S = ["count", "size", "testID", "themeVariant"];
|
|
8088
8165
|
var AnimatedLoadingIndicatorWrapper = Animated.createAnimatedComponent(StyledLoadingIndicatorWrapper);
|
|
8089
8166
|
var AnimatedLoadingDot = Animated.createAnimatedComponent(StyledLoadingDot);
|
|
8090
8167
|
var renderDotComponent = function renderDotComponent(_ref) {
|
|
@@ -8116,7 +8193,7 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
|
|
|
8116
8193
|
size = _ref2$size === void 0 ? 12 : _ref2$size,
|
|
8117
8194
|
testID = _ref2.testID,
|
|
8118
8195
|
themeVariant = _ref2.themeVariant,
|
|
8119
|
-
nativeProps = _objectWithoutProperties(_ref2, _excluded$
|
|
8196
|
+
nativeProps = _objectWithoutProperties(_ref2, _excluded$S);
|
|
8120
8197
|
var progressAnimation = useRef(new Animated.Value(0));
|
|
8121
8198
|
useEffect(function () {
|
|
8122
8199
|
var animation = Animated.loop(Animated.timing(progressAnimation.current, {
|
|
@@ -8746,10 +8823,10 @@ var StyledHeroIcon = index$c(HeroIcon)(function (_ref) {
|
|
|
8746
8823
|
};
|
|
8747
8824
|
});
|
|
8748
8825
|
|
|
8749
|
-
var
|
|
8750
|
-
var
|
|
8751
|
-
|
|
8752
|
-
|
|
8826
|
+
var SpinWrapper = function SpinWrapper(_ref) {
|
|
8827
|
+
var children = _ref.children,
|
|
8828
|
+
style = _ref.style,
|
|
8829
|
+
testID = _ref.testID;
|
|
8753
8830
|
var rotateAnimation = useRef(new Animated.Value(0));
|
|
8754
8831
|
useEffect(function () {
|
|
8755
8832
|
var animation = Animated.loop(Animated.timing(rotateAnimation.current, {
|
|
@@ -8760,22 +8837,74 @@ var AnimatedIcon = function AnimatedIcon(_ref) {
|
|
|
8760
8837
|
}));
|
|
8761
8838
|
animation.start();
|
|
8762
8839
|
return function () {
|
|
8763
|
-
animation.stop();
|
|
8840
|
+
return animation.stop();
|
|
8764
8841
|
};
|
|
8765
8842
|
}, []);
|
|
8766
|
-
var
|
|
8843
|
+
var rotate = rotateAnimation.current.interpolate({
|
|
8767
8844
|
inputRange: [0, 1],
|
|
8768
8845
|
outputRange: ['0deg', '360deg']
|
|
8769
8846
|
});
|
|
8770
8847
|
return /*#__PURE__*/React__default.createElement(Animated.View, {
|
|
8848
|
+
testID: testID,
|
|
8771
8849
|
style: [{
|
|
8772
8850
|
transform: [{
|
|
8773
|
-
rotate:
|
|
8851
|
+
rotate: rotate
|
|
8774
8852
|
}]
|
|
8775
8853
|
}, style]
|
|
8854
|
+
}, children);
|
|
8855
|
+
};
|
|
8856
|
+
|
|
8857
|
+
var _excluded$R = ["style"];
|
|
8858
|
+
var AnimatedIcon = function AnimatedIcon(_ref) {
|
|
8859
|
+
var style = _ref.style,
|
|
8860
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$R);
|
|
8861
|
+
return /*#__PURE__*/React__default.createElement(SpinWrapper, {
|
|
8862
|
+
style: style
|
|
8776
8863
|
}, /*#__PURE__*/React__default.createElement(StyledHeroIcon, otherProps));
|
|
8777
8864
|
};
|
|
8778
8865
|
|
|
8866
|
+
var _excluded$Q = ["name", "themeSize", "testID", "style"];
|
|
8867
|
+
var GradientIcon = function GradientIcon(_ref) {
|
|
8868
|
+
var name = _ref.name,
|
|
8869
|
+
themeSize = _ref.themeSize,
|
|
8870
|
+
testID = _ref.testID,
|
|
8871
|
+
style = _ref.style,
|
|
8872
|
+
accessibilityProps = _objectWithoutProperties(_ref, _excluded$Q);
|
|
8873
|
+
var theme = useTheme();
|
|
8874
|
+
var gradient = theme.colors.gradients.aiDiagonal;
|
|
8875
|
+
var size = theme.__hd__.icon.sizes[themeSize];
|
|
8876
|
+
return /*#__PURE__*/React__default.createElement(MaskedView, _extends$1({
|
|
8877
|
+
testID: testID,
|
|
8878
|
+
style: [{
|
|
8879
|
+
width: size,
|
|
8880
|
+
height: size
|
|
8881
|
+
}, style]
|
|
8882
|
+
}, accessibilityProps, {
|
|
8883
|
+
maskElement: /*#__PURE__*/React__default.createElement(View, {
|
|
8884
|
+
style: {
|
|
8885
|
+
backgroundColor: 'transparent',
|
|
8886
|
+
width: size,
|
|
8887
|
+
height: size,
|
|
8888
|
+
alignItems: 'center',
|
|
8889
|
+
justifyContent: 'center'
|
|
8890
|
+
}
|
|
8891
|
+
}, /*#__PURE__*/React__default.createElement(StyledHeroIcon, {
|
|
8892
|
+
name: name,
|
|
8893
|
+
themeIntent: "text",
|
|
8894
|
+
themeSize: themeSize
|
|
8895
|
+
}))
|
|
8896
|
+
}), /*#__PURE__*/React__default.createElement(LinearGradient, {
|
|
8897
|
+
start: gradient.start,
|
|
8898
|
+
end: gradient.end,
|
|
8899
|
+
colors: gradient.colors,
|
|
8900
|
+
locations: gradient.locations,
|
|
8901
|
+
style: {
|
|
8902
|
+
width: size,
|
|
8903
|
+
height: size
|
|
8904
|
+
}
|
|
8905
|
+
}));
|
|
8906
|
+
};
|
|
8907
|
+
|
|
8779
8908
|
var Icon = function Icon(_ref) {
|
|
8780
8909
|
var icon = _ref.icon,
|
|
8781
8910
|
style = _ref.style,
|
|
@@ -8811,6 +8940,20 @@ var Icon = function Icon(_ref) {
|
|
|
8811
8940
|
accessibilityViewIsModal: accessibilityViewIsModal,
|
|
8812
8941
|
accessibilityActions: accessibilityActions
|
|
8813
8942
|
};
|
|
8943
|
+
if (intent === 'ai') {
|
|
8944
|
+
var gradientIcon = /*#__PURE__*/React__default.createElement(GradientIcon, _extends$1({
|
|
8945
|
+
name: icon,
|
|
8946
|
+
themeSize: size,
|
|
8947
|
+
testID: testID,
|
|
8948
|
+
style: spin ? undefined : style
|
|
8949
|
+
}, accessibilityProps));
|
|
8950
|
+
if (spin) {
|
|
8951
|
+
return /*#__PURE__*/React__default.createElement(SpinWrapper, {
|
|
8952
|
+
style: style
|
|
8953
|
+
}, gradientIcon);
|
|
8954
|
+
}
|
|
8955
|
+
return gradientIcon;
|
|
8956
|
+
}
|
|
8814
8957
|
return spin ? /*#__PURE__*/React__default.createElement(AnimatedIcon, _extends$1({
|
|
8815
8958
|
name: icon,
|
|
8816
8959
|
themeIntent: intent,
|
|
@@ -8849,7 +8992,7 @@ var StyledText$4 = index$c(Text$1)(function (_ref) {
|
|
|
8849
8992
|
});
|
|
8850
8993
|
});
|
|
8851
8994
|
|
|
8852
|
-
var _excluded$
|
|
8995
|
+
var _excluded$P = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
|
|
8853
8996
|
/**
|
|
8854
8997
|
* @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
8998
|
*/
|
|
@@ -8865,7 +9008,7 @@ var Text = function Text(_ref) {
|
|
|
8865
9008
|
typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
|
|
8866
9009
|
_ref$allowFontScaling = _ref.allowFontScaling,
|
|
8867
9010
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
8868
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
9011
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$P);
|
|
8869
9012
|
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
9013
|
return /*#__PURE__*/React__default.createElement(StyledText$4, _extends$1({}, nativeProps, {
|
|
8871
9014
|
themeFontSize: fontSize,
|
|
@@ -8898,7 +9041,79 @@ var StyledCaption = index$c(Text$1)(function (_ref) {
|
|
|
8898
9041
|
};
|
|
8899
9042
|
});
|
|
8900
9043
|
|
|
8901
|
-
var
|
|
9044
|
+
var ACCESSIBILITY_KEYS = ['accessible', 'accessibilityActions', 'accessibilityLabel', 'accessibilityRole', 'accessibilityState', 'accessibilityHint', 'accessibilityValue', 'onAccessibilityAction',
|
|
9045
|
+
// Android
|
|
9046
|
+
'accessibilityLabelledBy', 'accessibilityLiveRegion', 'importantForAccessibility',
|
|
9047
|
+
// iOS
|
|
9048
|
+
'accessibilityElementsHidden', 'accessibilityLanguage', 'accessibilityIgnoresInvertColors', 'accessibilityViewIsModal', 'onAccessibilityEscape', 'onAccessibilityTap', 'onMagicTap', 'accessibilityIgnoresInvertColors'];
|
|
9049
|
+
var pickAccessibilityProps = function pickAccessibilityProps(props) {
|
|
9050
|
+
return ACCESSIBILITY_KEYS.filter(function (key) {
|
|
9051
|
+
return key in props;
|
|
9052
|
+
}).reduce(function (acc, key) {
|
|
9053
|
+
return Object.assign(acc, _defineProperty({}, key, props[key]));
|
|
9054
|
+
}, {});
|
|
9055
|
+
};
|
|
9056
|
+
|
|
9057
|
+
var _excluded$O = ["children"];
|
|
9058
|
+
var GradientText = function GradientText(_ref) {
|
|
9059
|
+
var children = _ref.children,
|
|
9060
|
+
accessibilityProps = _objectWithoutProperties(_ref, _excluded$O);
|
|
9061
|
+
var theme = useTheme();
|
|
9062
|
+
var gradient = theme.colors.gradients.aiDiagonal;
|
|
9063
|
+
var _useState = useState(null),
|
|
9064
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9065
|
+
size = _useState2[0],
|
|
9066
|
+
setSize = _useState2[1];
|
|
9067
|
+
var onLayout = useCallback(function (event) {
|
|
9068
|
+
var _event$nativeEvent$la = event.nativeEvent.layout,
|
|
9069
|
+
width = _event$nativeEvent$la.width,
|
|
9070
|
+
height = _event$nativeEvent$la.height;
|
|
9071
|
+
setSize(function (prevSize) {
|
|
9072
|
+
if (prevSize && prevSize.width === width && prevSize.height === height) {
|
|
9073
|
+
return prevSize;
|
|
9074
|
+
}
|
|
9075
|
+
return {
|
|
9076
|
+
width: width,
|
|
9077
|
+
height: height
|
|
9078
|
+
};
|
|
9079
|
+
});
|
|
9080
|
+
}, []);
|
|
9081
|
+
return /*#__PURE__*/React__default.createElement(View, accessibilityProps, /*#__PURE__*/React__default.createElement(MaskedView, {
|
|
9082
|
+
style: {
|
|
9083
|
+
alignSelf: 'stretch'
|
|
9084
|
+
},
|
|
9085
|
+
accessibilityElementsHidden: true,
|
|
9086
|
+
importantForAccessibility: "no-hide-descendants",
|
|
9087
|
+
maskElement: /*#__PURE__*/React__default.createElement(View, {
|
|
9088
|
+
onLayout: onLayout,
|
|
9089
|
+
style: {
|
|
9090
|
+
backgroundColor: 'transparent'
|
|
9091
|
+
},
|
|
9092
|
+
testID: "gradient-text-mask"
|
|
9093
|
+
}, children)
|
|
9094
|
+
}, size ? /*#__PURE__*/React__default.createElement(LinearGradient, {
|
|
9095
|
+
start: gradient.start,
|
|
9096
|
+
end: gradient.end,
|
|
9097
|
+
colors: gradient.colors,
|
|
9098
|
+
locations: gradient.locations,
|
|
9099
|
+
style: {
|
|
9100
|
+
width: size.width,
|
|
9101
|
+
height: size.height
|
|
9102
|
+
}
|
|
9103
|
+
}) :
|
|
9104
|
+
// Render children as fallback until layout is measured, so text
|
|
9105
|
+
// is visible immediately rather than blank on the first frame.
|
|
9106
|
+
children), /*#__PURE__*/React__default.createElement(View, {
|
|
9107
|
+
style: {
|
|
9108
|
+
position: 'absolute',
|
|
9109
|
+
opacity: 0
|
|
9110
|
+
},
|
|
9111
|
+
importantForAccessibility: "yes",
|
|
9112
|
+
accessibilityElementsHidden: false
|
|
9113
|
+
}, children));
|
|
9114
|
+
};
|
|
9115
|
+
|
|
9116
|
+
var _excluded$N = ["children", "fontWeight", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
|
|
8902
9117
|
var Caption = function Caption(_ref) {
|
|
8903
9118
|
var children = _ref.children,
|
|
8904
9119
|
_ref$fontWeight = _ref.fontWeight,
|
|
@@ -8909,13 +9124,22 @@ var Caption = function Caption(_ref) {
|
|
|
8909
9124
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
8910
9125
|
_ref$fontStyle = _ref.fontStyle,
|
|
8911
9126
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
9127
|
+
style = _ref.style,
|
|
9128
|
+
testID = _ref.testID,
|
|
8912
9129
|
nativeProps = _objectWithoutProperties(_ref, _excluded$N);
|
|
8913
|
-
|
|
9130
|
+
var isAi = intent === 'ai';
|
|
9131
|
+
var styledText = /*#__PURE__*/React__default.createElement(StyledCaption, _extends$1({}, nativeProps, {
|
|
8914
9132
|
themeFontWeight: fontWeight,
|
|
8915
|
-
themeIntent: intent,
|
|
9133
|
+
themeIntent: isAi ? 'body' : intent,
|
|
8916
9134
|
themeIsItalic: fontStyle === 'italic',
|
|
8917
|
-
allowFontScaling: allowFontScaling
|
|
9135
|
+
allowFontScaling: allowFontScaling,
|
|
9136
|
+
style: style,
|
|
9137
|
+
testID: testID
|
|
8918
9138
|
}), children);
|
|
9139
|
+
if (isAi) {
|
|
9140
|
+
return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
9141
|
+
}
|
|
9142
|
+
return styledText;
|
|
8919
9143
|
};
|
|
8920
9144
|
|
|
8921
9145
|
var StyledLabel$2 = index$c(Text$1)(function (_ref) {
|
|
@@ -8934,7 +9158,7 @@ var StyledLabel$2 = index$c(Text$1)(function (_ref) {
|
|
|
8934
9158
|
};
|
|
8935
9159
|
});
|
|
8936
9160
|
|
|
8937
|
-
var _excluded$M = ["children", "intent", "allowFontScaling", "fontStyle"];
|
|
9161
|
+
var _excluded$M = ["children", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
|
|
8938
9162
|
var Label = function Label(_ref) {
|
|
8939
9163
|
var children = _ref.children,
|
|
8940
9164
|
_ref$intent = _ref.intent,
|
|
@@ -8943,12 +9167,21 @@ var Label = function Label(_ref) {
|
|
|
8943
9167
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
8944
9168
|
_ref$fontStyle = _ref.fontStyle,
|
|
8945
9169
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
9170
|
+
style = _ref.style,
|
|
9171
|
+
testID = _ref.testID,
|
|
8946
9172
|
nativeProps = _objectWithoutProperties(_ref, _excluded$M);
|
|
8947
|
-
|
|
8948
|
-
|
|
9173
|
+
var isAi = intent === 'ai';
|
|
9174
|
+
var styledText = /*#__PURE__*/React__default.createElement(StyledLabel$2, _extends$1({}, nativeProps, {
|
|
9175
|
+
themeIntent: isAi ? 'body' : intent,
|
|
8949
9176
|
themeIsItalic: fontStyle === 'italic',
|
|
8950
|
-
allowFontScaling: allowFontScaling
|
|
9177
|
+
allowFontScaling: allowFontScaling,
|
|
9178
|
+
style: style,
|
|
9179
|
+
testID: testID
|
|
8951
9180
|
}), children);
|
|
9181
|
+
if (isAi) {
|
|
9182
|
+
return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
9183
|
+
}
|
|
9184
|
+
return styledText;
|
|
8952
9185
|
};
|
|
8953
9186
|
|
|
8954
9187
|
var StyledTitle$1 = index$c(Text$1)(function (_ref) {
|
|
@@ -8966,7 +9199,7 @@ var StyledTitle$1 = index$c(Text$1)(function (_ref) {
|
|
|
8966
9199
|
};
|
|
8967
9200
|
});
|
|
8968
9201
|
|
|
8969
|
-
var _excluded$L = ["children", "intent", "allowFontScaling", "level", "typeface", "fontStyle"];
|
|
9202
|
+
var _excluded$L = ["children", "intent", "allowFontScaling", "level", "typeface", "fontStyle", "style", "testID"];
|
|
8970
9203
|
var Title = function Title(_ref) {
|
|
8971
9204
|
var children = _ref.children,
|
|
8972
9205
|
_ref$intent = _ref.intent,
|
|
@@ -8979,14 +9212,23 @@ var Title = function Title(_ref) {
|
|
|
8979
9212
|
typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
|
|
8980
9213
|
_ref$fontStyle = _ref.fontStyle,
|
|
8981
9214
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
9215
|
+
style = _ref.style,
|
|
9216
|
+
testID = _ref.testID,
|
|
8982
9217
|
nativeProps = _objectWithoutProperties(_ref, _excluded$L);
|
|
8983
|
-
|
|
9218
|
+
var isAi = intent === 'ai';
|
|
9219
|
+
var styledText = /*#__PURE__*/React__default.createElement(StyledTitle$1, _extends$1({}, nativeProps, {
|
|
8984
9220
|
themeLevel: level,
|
|
8985
9221
|
themeTypeface: typeface,
|
|
8986
|
-
themeIntent: intent,
|
|
9222
|
+
themeIntent: isAi ? 'body' : intent,
|
|
8987
9223
|
themeIsItalic: fontStyle === 'italic',
|
|
8988
|
-
allowFontScaling: allowFontScaling
|
|
9224
|
+
allowFontScaling: allowFontScaling,
|
|
9225
|
+
style: style,
|
|
9226
|
+
testID: testID
|
|
8989
9227
|
}), children);
|
|
9228
|
+
if (isAi) {
|
|
9229
|
+
return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
9230
|
+
}
|
|
9231
|
+
return styledText;
|
|
8990
9232
|
};
|
|
8991
9233
|
|
|
8992
9234
|
var FONTWEIGHT_MAP = {
|
|
@@ -9018,7 +9260,7 @@ var StyledBody$2 = index$c(Text$1)(function (_ref) {
|
|
|
9018
9260
|
};
|
|
9019
9261
|
});
|
|
9020
9262
|
|
|
9021
|
-
var _excluded$K = ["children", "intent", "allowFontScaling", "typeface", "variant", "fontStyle"];
|
|
9263
|
+
var _excluded$K = ["children", "intent", "allowFontScaling", "typeface", "variant", "fontStyle", "style", "testID"];
|
|
9022
9264
|
var Body = function Body(_ref) {
|
|
9023
9265
|
var children = _ref.children,
|
|
9024
9266
|
_ref$intent = _ref.intent,
|
|
@@ -9031,14 +9273,23 @@ var Body = function Body(_ref) {
|
|
|
9031
9273
|
variant = _ref$variant === void 0 ? 'regular' : _ref$variant,
|
|
9032
9274
|
_ref$fontStyle = _ref.fontStyle,
|
|
9033
9275
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
9276
|
+
style = _ref.style,
|
|
9277
|
+
testID = _ref.testID,
|
|
9034
9278
|
nativeProps = _objectWithoutProperties(_ref, _excluded$K);
|
|
9035
|
-
|
|
9279
|
+
var isAi = intent === 'ai';
|
|
9280
|
+
var styledText = /*#__PURE__*/React__default.createElement(StyledBody$2, _extends$1({}, nativeProps, {
|
|
9036
9281
|
themeTypeface: typeface,
|
|
9037
|
-
themeIntent: intent,
|
|
9282
|
+
themeIntent: isAi ? 'body' : intent,
|
|
9038
9283
|
themeVariant: variant,
|
|
9039
9284
|
themeIsItalic: fontStyle === 'italic',
|
|
9040
|
-
allowFontScaling: allowFontScaling
|
|
9285
|
+
allowFontScaling: allowFontScaling,
|
|
9286
|
+
style: style,
|
|
9287
|
+
testID: testID
|
|
9041
9288
|
}), children);
|
|
9289
|
+
if (isAi) {
|
|
9290
|
+
return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
9291
|
+
}
|
|
9292
|
+
return styledText;
|
|
9042
9293
|
};
|
|
9043
9294
|
|
|
9044
9295
|
var Typography = {
|
|
@@ -16013,7 +16264,7 @@ var Avatar = function Avatar(_ref) {
|
|
|
16013
16264
|
_ref$size = _ref.size,
|
|
16014
16265
|
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
16015
16266
|
_ref$intent = _ref.intent,
|
|
16016
|
-
intent = _ref$intent === void 0 ? '
|
|
16267
|
+
intent = _ref$intent === void 0 ? 'neutral' : _ref$intent;
|
|
16017
16268
|
var _useState = useState(false),
|
|
16018
16269
|
_useState2 = _slicedToArray(_useState, 2),
|
|
16019
16270
|
hasImageError = _useState2[0],
|
|
@@ -27335,7 +27586,7 @@ var StyledGradientContainer = index$c(Box)(function (_ref2) {
|
|
|
27335
27586
|
});
|
|
27336
27587
|
|
|
27337
27588
|
var _excluded$e = ["intent", "variant", "style", "onLayout"];
|
|
27338
|
-
var AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient);
|
|
27589
|
+
var AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient$1);
|
|
27339
27590
|
var gradientPositions = {
|
|
27340
27591
|
start: {
|
|
27341
27592
|
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$
|
|
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$
|
|
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,
|
|
@@ -5877,6 +5954,7 @@ var getAttachmentTheme = function getAttachmentTheme(theme) {
|
|
|
5877
5954
|
|
|
5878
5955
|
var getAvatarTheme = function getAvatarTheme(theme) {
|
|
5879
5956
|
var colors = {
|
|
5957
|
+
neutral: palette$8.maasstrichtBlueLight25,
|
|
5880
5958
|
primary: theme.colors.primary,
|
|
5881
5959
|
info: theme.colors.info,
|
|
5882
5960
|
danger: theme.colors.error,
|
|
@@ -8113,7 +8191,7 @@ var StyledLoadingDot = index$c(reactNative.View)(function (_ref) {
|
|
|
8113
8191
|
}, themeStyling());
|
|
8114
8192
|
});
|
|
8115
8193
|
|
|
8116
|
-
var _excluded$
|
|
8194
|
+
var _excluded$S = ["count", "size", "testID", "themeVariant"];
|
|
8117
8195
|
var AnimatedLoadingIndicatorWrapper = reactNative.Animated.createAnimatedComponent(StyledLoadingIndicatorWrapper);
|
|
8118
8196
|
var AnimatedLoadingDot = reactNative.Animated.createAnimatedComponent(StyledLoadingDot);
|
|
8119
8197
|
var renderDotComponent = function renderDotComponent(_ref) {
|
|
@@ -8145,7 +8223,7 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
|
|
|
8145
8223
|
size = _ref2$size === void 0 ? 12 : _ref2$size,
|
|
8146
8224
|
testID = _ref2.testID,
|
|
8147
8225
|
themeVariant = _ref2.themeVariant,
|
|
8148
|
-
nativeProps = _objectWithoutProperties(_ref2, _excluded$
|
|
8226
|
+
nativeProps = _objectWithoutProperties(_ref2, _excluded$S);
|
|
8149
8227
|
var progressAnimation = React.useRef(new reactNative.Animated.Value(0));
|
|
8150
8228
|
React.useEffect(function () {
|
|
8151
8229
|
var animation = reactNative.Animated.loop(reactNative.Animated.timing(progressAnimation.current, {
|
|
@@ -8775,10 +8853,10 @@ var StyledHeroIcon = index$c(HeroIcon)(function (_ref) {
|
|
|
8775
8853
|
};
|
|
8776
8854
|
});
|
|
8777
8855
|
|
|
8778
|
-
var
|
|
8779
|
-
var
|
|
8780
|
-
|
|
8781
|
-
|
|
8856
|
+
var SpinWrapper = function SpinWrapper(_ref) {
|
|
8857
|
+
var children = _ref.children,
|
|
8858
|
+
style = _ref.style,
|
|
8859
|
+
testID = _ref.testID;
|
|
8782
8860
|
var rotateAnimation = React.useRef(new reactNative.Animated.Value(0));
|
|
8783
8861
|
React.useEffect(function () {
|
|
8784
8862
|
var animation = reactNative.Animated.loop(reactNative.Animated.timing(rotateAnimation.current, {
|
|
@@ -8789,22 +8867,74 @@ var AnimatedIcon = function AnimatedIcon(_ref) {
|
|
|
8789
8867
|
}));
|
|
8790
8868
|
animation.start();
|
|
8791
8869
|
return function () {
|
|
8792
|
-
animation.stop();
|
|
8870
|
+
return animation.stop();
|
|
8793
8871
|
};
|
|
8794
8872
|
}, []);
|
|
8795
|
-
var
|
|
8873
|
+
var rotate = rotateAnimation.current.interpolate({
|
|
8796
8874
|
inputRange: [0, 1],
|
|
8797
8875
|
outputRange: ['0deg', '360deg']
|
|
8798
8876
|
});
|
|
8799
8877
|
return /*#__PURE__*/React__namespace.default.createElement(reactNative.Animated.View, {
|
|
8878
|
+
testID: testID,
|
|
8800
8879
|
style: [{
|
|
8801
8880
|
transform: [{
|
|
8802
|
-
rotate:
|
|
8881
|
+
rotate: rotate
|
|
8803
8882
|
}]
|
|
8804
8883
|
}, style]
|
|
8884
|
+
}, children);
|
|
8885
|
+
};
|
|
8886
|
+
|
|
8887
|
+
var _excluded$R = ["style"];
|
|
8888
|
+
var AnimatedIcon = function AnimatedIcon(_ref) {
|
|
8889
|
+
var style = _ref.style,
|
|
8890
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$R);
|
|
8891
|
+
return /*#__PURE__*/React__namespace.default.createElement(SpinWrapper, {
|
|
8892
|
+
style: style
|
|
8805
8893
|
}, /*#__PURE__*/React__namespace.default.createElement(StyledHeroIcon, otherProps));
|
|
8806
8894
|
};
|
|
8807
8895
|
|
|
8896
|
+
var _excluded$Q = ["name", "themeSize", "testID", "style"];
|
|
8897
|
+
var GradientIcon = function GradientIcon(_ref) {
|
|
8898
|
+
var name = _ref.name,
|
|
8899
|
+
themeSize = _ref.themeSize,
|
|
8900
|
+
testID = _ref.testID,
|
|
8901
|
+
style = _ref.style,
|
|
8902
|
+
accessibilityProps = _objectWithoutProperties(_ref, _excluded$Q);
|
|
8903
|
+
var theme = useTheme();
|
|
8904
|
+
var gradient = theme.colors.gradients.aiDiagonal;
|
|
8905
|
+
var size = theme.__hd__.icon.sizes[themeSize];
|
|
8906
|
+
return /*#__PURE__*/React__namespace.default.createElement(MaskedView__default.default, _extends$1({
|
|
8907
|
+
testID: testID,
|
|
8908
|
+
style: [{
|
|
8909
|
+
width: size,
|
|
8910
|
+
height: size
|
|
8911
|
+
}, style]
|
|
8912
|
+
}, accessibilityProps, {
|
|
8913
|
+
maskElement: /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
8914
|
+
style: {
|
|
8915
|
+
backgroundColor: 'transparent',
|
|
8916
|
+
width: size,
|
|
8917
|
+
height: size,
|
|
8918
|
+
alignItems: 'center',
|
|
8919
|
+
justifyContent: 'center'
|
|
8920
|
+
}
|
|
8921
|
+
}, /*#__PURE__*/React__namespace.default.createElement(StyledHeroIcon, {
|
|
8922
|
+
name: name,
|
|
8923
|
+
themeIntent: "text",
|
|
8924
|
+
themeSize: themeSize
|
|
8925
|
+
}))
|
|
8926
|
+
}), /*#__PURE__*/React__namespace.default.createElement(expoLinearGradient.LinearGradient, {
|
|
8927
|
+
start: gradient.start,
|
|
8928
|
+
end: gradient.end,
|
|
8929
|
+
colors: gradient.colors,
|
|
8930
|
+
locations: gradient.locations,
|
|
8931
|
+
style: {
|
|
8932
|
+
width: size,
|
|
8933
|
+
height: size
|
|
8934
|
+
}
|
|
8935
|
+
}));
|
|
8936
|
+
};
|
|
8937
|
+
|
|
8808
8938
|
var Icon = function Icon(_ref) {
|
|
8809
8939
|
var icon = _ref.icon,
|
|
8810
8940
|
style = _ref.style,
|
|
@@ -8840,6 +8970,20 @@ var Icon = function Icon(_ref) {
|
|
|
8840
8970
|
accessibilityViewIsModal: accessibilityViewIsModal,
|
|
8841
8971
|
accessibilityActions: accessibilityActions
|
|
8842
8972
|
};
|
|
8973
|
+
if (intent === 'ai') {
|
|
8974
|
+
var gradientIcon = /*#__PURE__*/React__namespace.default.createElement(GradientIcon, _extends$1({
|
|
8975
|
+
name: icon,
|
|
8976
|
+
themeSize: size,
|
|
8977
|
+
testID: testID,
|
|
8978
|
+
style: spin ? undefined : style
|
|
8979
|
+
}, accessibilityProps));
|
|
8980
|
+
if (spin) {
|
|
8981
|
+
return /*#__PURE__*/React__namespace.default.createElement(SpinWrapper, {
|
|
8982
|
+
style: style
|
|
8983
|
+
}, gradientIcon);
|
|
8984
|
+
}
|
|
8985
|
+
return gradientIcon;
|
|
8986
|
+
}
|
|
8843
8987
|
return spin ? /*#__PURE__*/React__namespace.default.createElement(AnimatedIcon, _extends$1({
|
|
8844
8988
|
name: icon,
|
|
8845
8989
|
themeIntent: intent,
|
|
@@ -8878,7 +9022,7 @@ var StyledText$4 = index$c(reactNative.Text)(function (_ref) {
|
|
|
8878
9022
|
});
|
|
8879
9023
|
});
|
|
8880
9024
|
|
|
8881
|
-
var _excluded$
|
|
9025
|
+
var _excluded$P = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
|
|
8882
9026
|
/**
|
|
8883
9027
|
* @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
9028
|
*/
|
|
@@ -8894,7 +9038,7 @@ var Text = function Text(_ref) {
|
|
|
8894
9038
|
typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
|
|
8895
9039
|
_ref$allowFontScaling = _ref.allowFontScaling,
|
|
8896
9040
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
8897
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
9041
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$P);
|
|
8898
9042
|
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
9043
|
return /*#__PURE__*/React__namespace.default.createElement(StyledText$4, _extends$1({}, nativeProps, {
|
|
8900
9044
|
themeFontSize: fontSize,
|
|
@@ -8927,7 +9071,79 @@ var StyledCaption = index$c(reactNative.Text)(function (_ref) {
|
|
|
8927
9071
|
};
|
|
8928
9072
|
});
|
|
8929
9073
|
|
|
8930
|
-
var
|
|
9074
|
+
var ACCESSIBILITY_KEYS = ['accessible', 'accessibilityActions', 'accessibilityLabel', 'accessibilityRole', 'accessibilityState', 'accessibilityHint', 'accessibilityValue', 'onAccessibilityAction',
|
|
9075
|
+
// Android
|
|
9076
|
+
'accessibilityLabelledBy', 'accessibilityLiveRegion', 'importantForAccessibility',
|
|
9077
|
+
// iOS
|
|
9078
|
+
'accessibilityElementsHidden', 'accessibilityLanguage', 'accessibilityIgnoresInvertColors', 'accessibilityViewIsModal', 'onAccessibilityEscape', 'onAccessibilityTap', 'onMagicTap', 'accessibilityIgnoresInvertColors'];
|
|
9079
|
+
var pickAccessibilityProps = function pickAccessibilityProps(props) {
|
|
9080
|
+
return ACCESSIBILITY_KEYS.filter(function (key) {
|
|
9081
|
+
return key in props;
|
|
9082
|
+
}).reduce(function (acc, key) {
|
|
9083
|
+
return Object.assign(acc, _defineProperty({}, key, props[key]));
|
|
9084
|
+
}, {});
|
|
9085
|
+
};
|
|
9086
|
+
|
|
9087
|
+
var _excluded$O = ["children"];
|
|
9088
|
+
var GradientText = function GradientText(_ref) {
|
|
9089
|
+
var children = _ref.children,
|
|
9090
|
+
accessibilityProps = _objectWithoutProperties(_ref, _excluded$O);
|
|
9091
|
+
var theme = useTheme();
|
|
9092
|
+
var gradient = theme.colors.gradients.aiDiagonal;
|
|
9093
|
+
var _useState = React.useState(null),
|
|
9094
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9095
|
+
size = _useState2[0],
|
|
9096
|
+
setSize = _useState2[1];
|
|
9097
|
+
var onLayout = React.useCallback(function (event) {
|
|
9098
|
+
var _event$nativeEvent$la = event.nativeEvent.layout,
|
|
9099
|
+
width = _event$nativeEvent$la.width,
|
|
9100
|
+
height = _event$nativeEvent$la.height;
|
|
9101
|
+
setSize(function (prevSize) {
|
|
9102
|
+
if (prevSize && prevSize.width === width && prevSize.height === height) {
|
|
9103
|
+
return prevSize;
|
|
9104
|
+
}
|
|
9105
|
+
return {
|
|
9106
|
+
width: width,
|
|
9107
|
+
height: height
|
|
9108
|
+
};
|
|
9109
|
+
});
|
|
9110
|
+
}, []);
|
|
9111
|
+
return /*#__PURE__*/React__namespace.default.createElement(reactNative.View, accessibilityProps, /*#__PURE__*/React__namespace.default.createElement(MaskedView__default.default, {
|
|
9112
|
+
style: {
|
|
9113
|
+
alignSelf: 'stretch'
|
|
9114
|
+
},
|
|
9115
|
+
accessibilityElementsHidden: true,
|
|
9116
|
+
importantForAccessibility: "no-hide-descendants",
|
|
9117
|
+
maskElement: /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
9118
|
+
onLayout: onLayout,
|
|
9119
|
+
style: {
|
|
9120
|
+
backgroundColor: 'transparent'
|
|
9121
|
+
},
|
|
9122
|
+
testID: "gradient-text-mask"
|
|
9123
|
+
}, children)
|
|
9124
|
+
}, size ? /*#__PURE__*/React__namespace.default.createElement(expoLinearGradient.LinearGradient, {
|
|
9125
|
+
start: gradient.start,
|
|
9126
|
+
end: gradient.end,
|
|
9127
|
+
colors: gradient.colors,
|
|
9128
|
+
locations: gradient.locations,
|
|
9129
|
+
style: {
|
|
9130
|
+
width: size.width,
|
|
9131
|
+
height: size.height
|
|
9132
|
+
}
|
|
9133
|
+
}) :
|
|
9134
|
+
// Render children as fallback until layout is measured, so text
|
|
9135
|
+
// is visible immediately rather than blank on the first frame.
|
|
9136
|
+
children), /*#__PURE__*/React__namespace.default.createElement(reactNative.View, {
|
|
9137
|
+
style: {
|
|
9138
|
+
position: 'absolute',
|
|
9139
|
+
opacity: 0
|
|
9140
|
+
},
|
|
9141
|
+
importantForAccessibility: "yes",
|
|
9142
|
+
accessibilityElementsHidden: false
|
|
9143
|
+
}, children));
|
|
9144
|
+
};
|
|
9145
|
+
|
|
9146
|
+
var _excluded$N = ["children", "fontWeight", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
|
|
8931
9147
|
var Caption = function Caption(_ref) {
|
|
8932
9148
|
var children = _ref.children,
|
|
8933
9149
|
_ref$fontWeight = _ref.fontWeight,
|
|
@@ -8938,13 +9154,22 @@ var Caption = function Caption(_ref) {
|
|
|
8938
9154
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
8939
9155
|
_ref$fontStyle = _ref.fontStyle,
|
|
8940
9156
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
9157
|
+
style = _ref.style,
|
|
9158
|
+
testID = _ref.testID,
|
|
8941
9159
|
nativeProps = _objectWithoutProperties(_ref, _excluded$N);
|
|
8942
|
-
|
|
9160
|
+
var isAi = intent === 'ai';
|
|
9161
|
+
var styledText = /*#__PURE__*/React__namespace.default.createElement(StyledCaption, _extends$1({}, nativeProps, {
|
|
8943
9162
|
themeFontWeight: fontWeight,
|
|
8944
|
-
themeIntent: intent,
|
|
9163
|
+
themeIntent: isAi ? 'body' : intent,
|
|
8945
9164
|
themeIsItalic: fontStyle === 'italic',
|
|
8946
|
-
allowFontScaling: allowFontScaling
|
|
9165
|
+
allowFontScaling: allowFontScaling,
|
|
9166
|
+
style: style,
|
|
9167
|
+
testID: testID
|
|
8947
9168
|
}), children);
|
|
9169
|
+
if (isAi) {
|
|
9170
|
+
return /*#__PURE__*/React__namespace.default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
9171
|
+
}
|
|
9172
|
+
return styledText;
|
|
8948
9173
|
};
|
|
8949
9174
|
|
|
8950
9175
|
var StyledLabel$2 = index$c(reactNative.Text)(function (_ref) {
|
|
@@ -8963,7 +9188,7 @@ var StyledLabel$2 = index$c(reactNative.Text)(function (_ref) {
|
|
|
8963
9188
|
};
|
|
8964
9189
|
});
|
|
8965
9190
|
|
|
8966
|
-
var _excluded$M = ["children", "intent", "allowFontScaling", "fontStyle"];
|
|
9191
|
+
var _excluded$M = ["children", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
|
|
8967
9192
|
var Label = function Label(_ref) {
|
|
8968
9193
|
var children = _ref.children,
|
|
8969
9194
|
_ref$intent = _ref.intent,
|
|
@@ -8972,12 +9197,21 @@ var Label = function Label(_ref) {
|
|
|
8972
9197
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
8973
9198
|
_ref$fontStyle = _ref.fontStyle,
|
|
8974
9199
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
9200
|
+
style = _ref.style,
|
|
9201
|
+
testID = _ref.testID,
|
|
8975
9202
|
nativeProps = _objectWithoutProperties(_ref, _excluded$M);
|
|
8976
|
-
|
|
8977
|
-
|
|
9203
|
+
var isAi = intent === 'ai';
|
|
9204
|
+
var styledText = /*#__PURE__*/React__namespace.default.createElement(StyledLabel$2, _extends$1({}, nativeProps, {
|
|
9205
|
+
themeIntent: isAi ? 'body' : intent,
|
|
8978
9206
|
themeIsItalic: fontStyle === 'italic',
|
|
8979
|
-
allowFontScaling: allowFontScaling
|
|
9207
|
+
allowFontScaling: allowFontScaling,
|
|
9208
|
+
style: style,
|
|
9209
|
+
testID: testID
|
|
8980
9210
|
}), children);
|
|
9211
|
+
if (isAi) {
|
|
9212
|
+
return /*#__PURE__*/React__namespace.default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
9213
|
+
}
|
|
9214
|
+
return styledText;
|
|
8981
9215
|
};
|
|
8982
9216
|
|
|
8983
9217
|
var StyledTitle$1 = index$c(reactNative.Text)(function (_ref) {
|
|
@@ -8995,7 +9229,7 @@ var StyledTitle$1 = index$c(reactNative.Text)(function (_ref) {
|
|
|
8995
9229
|
};
|
|
8996
9230
|
});
|
|
8997
9231
|
|
|
8998
|
-
var _excluded$L = ["children", "intent", "allowFontScaling", "level", "typeface", "fontStyle"];
|
|
9232
|
+
var _excluded$L = ["children", "intent", "allowFontScaling", "level", "typeface", "fontStyle", "style", "testID"];
|
|
8999
9233
|
var Title = function Title(_ref) {
|
|
9000
9234
|
var children = _ref.children,
|
|
9001
9235
|
_ref$intent = _ref.intent,
|
|
@@ -9008,14 +9242,23 @@ var Title = function Title(_ref) {
|
|
|
9008
9242
|
typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
|
|
9009
9243
|
_ref$fontStyle = _ref.fontStyle,
|
|
9010
9244
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
9245
|
+
style = _ref.style,
|
|
9246
|
+
testID = _ref.testID,
|
|
9011
9247
|
nativeProps = _objectWithoutProperties(_ref, _excluded$L);
|
|
9012
|
-
|
|
9248
|
+
var isAi = intent === 'ai';
|
|
9249
|
+
var styledText = /*#__PURE__*/React__namespace.default.createElement(StyledTitle$1, _extends$1({}, nativeProps, {
|
|
9013
9250
|
themeLevel: level,
|
|
9014
9251
|
themeTypeface: typeface,
|
|
9015
|
-
themeIntent: intent,
|
|
9252
|
+
themeIntent: isAi ? 'body' : intent,
|
|
9016
9253
|
themeIsItalic: fontStyle === 'italic',
|
|
9017
|
-
allowFontScaling: allowFontScaling
|
|
9254
|
+
allowFontScaling: allowFontScaling,
|
|
9255
|
+
style: style,
|
|
9256
|
+
testID: testID
|
|
9018
9257
|
}), children);
|
|
9258
|
+
if (isAi) {
|
|
9259
|
+
return /*#__PURE__*/React__namespace.default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
9260
|
+
}
|
|
9261
|
+
return styledText;
|
|
9019
9262
|
};
|
|
9020
9263
|
|
|
9021
9264
|
var FONTWEIGHT_MAP = {
|
|
@@ -9047,7 +9290,7 @@ var StyledBody$2 = index$c(reactNative.Text)(function (_ref) {
|
|
|
9047
9290
|
};
|
|
9048
9291
|
});
|
|
9049
9292
|
|
|
9050
|
-
var _excluded$K = ["children", "intent", "allowFontScaling", "typeface", "variant", "fontStyle"];
|
|
9293
|
+
var _excluded$K = ["children", "intent", "allowFontScaling", "typeface", "variant", "fontStyle", "style", "testID"];
|
|
9051
9294
|
var Body = function Body(_ref) {
|
|
9052
9295
|
var children = _ref.children,
|
|
9053
9296
|
_ref$intent = _ref.intent,
|
|
@@ -9060,14 +9303,23 @@ var Body = function Body(_ref) {
|
|
|
9060
9303
|
variant = _ref$variant === void 0 ? 'regular' : _ref$variant,
|
|
9061
9304
|
_ref$fontStyle = _ref.fontStyle,
|
|
9062
9305
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
9306
|
+
style = _ref.style,
|
|
9307
|
+
testID = _ref.testID,
|
|
9063
9308
|
nativeProps = _objectWithoutProperties(_ref, _excluded$K);
|
|
9064
|
-
|
|
9309
|
+
var isAi = intent === 'ai';
|
|
9310
|
+
var styledText = /*#__PURE__*/React__namespace.default.createElement(StyledBody$2, _extends$1({}, nativeProps, {
|
|
9065
9311
|
themeTypeface: typeface,
|
|
9066
|
-
themeIntent: intent,
|
|
9312
|
+
themeIntent: isAi ? 'body' : intent,
|
|
9067
9313
|
themeVariant: variant,
|
|
9068
9314
|
themeIsItalic: fontStyle === 'italic',
|
|
9069
|
-
allowFontScaling: allowFontScaling
|
|
9315
|
+
allowFontScaling: allowFontScaling,
|
|
9316
|
+
style: style,
|
|
9317
|
+
testID: testID
|
|
9070
9318
|
}), children);
|
|
9319
|
+
if (isAi) {
|
|
9320
|
+
return /*#__PURE__*/React__namespace.default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
9321
|
+
}
|
|
9322
|
+
return styledText;
|
|
9071
9323
|
};
|
|
9072
9324
|
|
|
9073
9325
|
var Typography = {
|
|
@@ -16042,7 +16294,7 @@ var Avatar = function Avatar(_ref) {
|
|
|
16042
16294
|
_ref$size = _ref.size,
|
|
16043
16295
|
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
16044
16296
|
_ref$intent = _ref.intent,
|
|
16045
|
-
intent = _ref$intent === void 0 ? '
|
|
16297
|
+
intent = _ref$intent === void 0 ? 'neutral' : _ref$intent;
|
|
16046
16298
|
var _useState = React.useState(false),
|
|
16047
16299
|
_useState2 = _slicedToArray(_useState, 2),
|
|
16048
16300
|
hasImageError = _useState2[0],
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hero-design/rn-work-uikit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
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.
|
|
26
|
+
"@hero-design/rn": "8.122.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 MaskedView = ({ maskElement, children, style, testID }) =>
|
|
5
|
+
React.createElement(View, { style, testID }, maskElement, children);
|
|
6
|
+
|
|
7
|
+
module.exports = { __esModule: true, default: MaskedView };
|
package/testUtils/setup.tsx
CHANGED
|
@@ -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 {};
|