@hero-design/rn 8.120.2 → 8.122.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 +22 -0
- package/es/index.js +283 -33
- package/jest.config.js +1 -1
- package/lib/index.js +282 -31
- package/package.json +5 -1
- package/rollup.config.mjs +2 -0
- package/src/components/Avatar/Avatar.tsx +3 -3
- package/src/components/Avatar/StyledAvatar.tsx +7 -1
- package/src/components/Icon/AnimatedIcon.tsx +7 -40
- package/src/components/Icon/GradientIcon/index.tsx +71 -0
- package/src/components/Icon/SpinWrapper.tsx +39 -0
- package/src/components/Icon/index.tsx +22 -1
- package/src/components/Toolbar/StyledToolbar.tsx +2 -2
- package/src/components/Typography/Body/StyledBody.tsx +2 -2
- package/src/components/Typography/Body/index.tsx +20 -2
- package/src/components/Typography/Caption/StyledCaption.tsx +2 -2
- package/src/components/Typography/Caption/index.tsx +20 -2
- package/src/components/Typography/GradientText/index.tsx +85 -0
- package/src/components/Typography/Label/StyledLabel.tsx +2 -2
- package/src/components/Typography/Label/index.tsx +20 -2
- package/src/components/Typography/Title/StyledTitle.tsx +2 -2
- package/src/components/Typography/Title/index.tsx +32 -13
- package/src/components/Typography/types.ts +3 -1
- package/src/components/Typography/utils.ts +31 -0
- package/src/theme/components/avatar.ts +2 -0
- package/src/theme/global/colors/gradients.ts +78 -0
- package/src/theme/global/colors/types.ts +22 -0
- package/src/theme/global/index.ts +5 -2
- package/testUtils/setup.tsx +34 -0
- package/types/components/Avatar/Avatar.d.ts +2 -2
- package/types/components/Avatar/StyledAvatar.d.ts +1 -1
- package/types/components/Icon/GradientIcon/index.d.ts +12 -0
- package/types/components/Icon/SpinWrapper.d.ts +9 -0
- package/types/components/Icon/index.d.ts +1 -1
- package/types/components/TextInput/StyledTextInput.d.ts +1 -1
- package/types/components/Toolbar/StyledToolbar.d.ts +4 -4
- package/types/components/Typography/Body/StyledBody.d.ts +2 -2
- package/types/components/Typography/Body/index.d.ts +1 -1
- package/types/components/Typography/Caption/StyledCaption.d.ts +2 -2
- package/types/components/Typography/Caption/index.d.ts +1 -1
- package/types/components/Typography/GradientText/index.d.ts +7 -0
- package/types/components/Typography/Label/StyledLabel.d.ts +2 -2
- package/types/components/Typography/Label/index.d.ts +1 -1
- package/types/components/Typography/Title/StyledTitle.d.ts +2 -2
- package/types/components/Typography/Title/index.d.ts +1 -1
- package/types/components/Typography/types.d.ts +2 -1
- package/types/components/Typography/utils.d.ts +2 -0
- package/types/theme/components/avatar.d.ts +1 -0
- package/types/theme/global/colors/gradients.d.ts +3 -0
- package/types/theme/global/colors/types.d.ts +21 -0
- package/types/theme/global/index.d.ts +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @hero-design/rn
|
|
2
2
|
|
|
3
|
+
## 8.122.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
|
+
## 8.121.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#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
|
|
18
|
+
|
|
19
|
+
- [#4968](https://github.com/Thinkei/hero-design/pull/4968) [`654135e5178e2ab74dc6e9d80edb7bdab60275d7`](https://github.com/Thinkei/hero-design/commit/654135e5178e2ab74dc6e9d80edb7bdab60275d7) Thanks [@ttkien](https://github.com/ttkien)! - [PS-2754] Add ai intent to RN Typography components
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#4972](https://github.com/Thinkei/hero-design/pull/4972) [`4caa323ce232ef982bab8e3845aadc6b493a3804`](https://github.com/Thinkei/hero-design/commit/4caa323ce232ef982bab8e3845aadc6b493a3804) Thanks [@ttkien](https://github.com/ttkien)! - Fix GradientText cross-axis stretch in row containers
|
|
24
|
+
|
|
3
25
|
## 8.120.2
|
|
4
26
|
|
|
5
27
|
### Patch Changes
|
package/es/index.js
CHANGED
|
@@ -2,6 +2,8 @@ import * as reactNative from 'react-native';
|
|
|
2
2
|
import { StyleSheet as StyleSheet$1, Platform, Dimensions, Keyboard, Animated, View, UIManager, LayoutAnimation, TouchableOpacity, Text as Text$1, Easing, useWindowDimensions, TouchableWithoutFeedback, Modal as Modal$1, Image as Image$1, Pressable, SafeAreaView, KeyboardAvoidingView, TouchableHighlight, ScrollView, FlatList, TextInput as TextInput$1, PanResponder, BackHandler, InteractionManager, SectionList, RefreshControl as RefreshControl$1 } from 'react-native';
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import React__default, { useState, useEffect, useMemo, useCallback, useRef, useLayoutEffect, createContext, forwardRef, useContext, memo, useReducer, isValidElement, useImperativeHandle } from 'react';
|
|
5
|
+
import MaskedView from '@react-native-masked-view/masked-view';
|
|
6
|
+
import { LinearGradient } from 'expo-linear-gradient';
|
|
5
7
|
import { createIconSet } from 'react-native-vector-icons';
|
|
6
8
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
7
9
|
import { MonthYearPickerViewIOS, MonthYearPickerDialogueAndroid } from '@hero-design/react-native-month-year-picker';
|
|
@@ -10,7 +12,7 @@ import DateTimePicker from '@react-native-community/datetimepicker';
|
|
|
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';
|
|
@@ -5426,6 +5428,76 @@ var getShadows = function getShadows(palette) {
|
|
|
5426
5428
|
}
|
|
5427
5429
|
};
|
|
5428
5430
|
|
|
5431
|
+
var DIAGONAL_ANGLE = 282;
|
|
5432
|
+
var HORIZONTAL_ANGLE = 90;
|
|
5433
|
+
var DIAGONAL_LOCATIONS = [0, 0.2931, 0.993];
|
|
5434
|
+
var HORIZONTAL_LOCATIONS = [0, 0.25, 0.75];
|
|
5435
|
+
// Convert CSS gradient angle (degrees) to expo-linear-gradient start/end points.
|
|
5436
|
+
// Follows CSS convention: 0° = bottom→top, 90° = left→right,
|
|
5437
|
+
// 180° = top→bottom, 270° = right→left.
|
|
5438
|
+
var angleToPoints = function angleToPoints(angleDeg) {
|
|
5439
|
+
var rad = (angleDeg - 90) * Math.PI / 180;
|
|
5440
|
+
var x = Math.cos(rad);
|
|
5441
|
+
var y = Math.sin(rad);
|
|
5442
|
+
// Normalize so both components are in [0, 1]
|
|
5443
|
+
var start = {
|
|
5444
|
+
x: Math.round((1 - x) / 2 * 100) / 100,
|
|
5445
|
+
y: Math.round((1 - y) / 2 * 100) / 100
|
|
5446
|
+
};
|
|
5447
|
+
var end = {
|
|
5448
|
+
x: Math.round((1 + x) / 2 * 100) / 100,
|
|
5449
|
+
y: Math.round((1 + y) / 2 * 100) / 100
|
|
5450
|
+
};
|
|
5451
|
+
return {
|
|
5452
|
+
start: start,
|
|
5453
|
+
end: end
|
|
5454
|
+
};
|
|
5455
|
+
};
|
|
5456
|
+
var getGradients = function getGradients(systemPalette) {
|
|
5457
|
+
var blueMedium = palette$9.blueMedium;
|
|
5458
|
+
var pinkMedium = palette$9.pinkMedium;
|
|
5459
|
+
var brandPrimary = systemPalette.primary;
|
|
5460
|
+
var backgroundFallback = systemPalette.defaultGlobalSurface;
|
|
5461
|
+
return {
|
|
5462
|
+
aiDiagonal: _objectSpread2(_objectSpread2({
|
|
5463
|
+
angle: DIAGONAL_ANGLE
|
|
5464
|
+
}, angleToPoints(DIAGONAL_ANGLE)), {}, {
|
|
5465
|
+
colors: [blueMedium, brandPrimary, pinkMedium],
|
|
5466
|
+
locations: DIAGONAL_LOCATIONS
|
|
5467
|
+
}),
|
|
5468
|
+
aiDiagonal8: _objectSpread2(_objectSpread2({
|
|
5469
|
+
angle: DIAGONAL_ANGLE
|
|
5470
|
+
}, angleToPoints(DIAGONAL_ANGLE)), {}, {
|
|
5471
|
+
colors: [blueMedium, brandPrimary, pinkMedium],
|
|
5472
|
+
locations: DIAGONAL_LOCATIONS,
|
|
5473
|
+
opacity: 0.08,
|
|
5474
|
+
backgroundFallback: backgroundFallback
|
|
5475
|
+
}),
|
|
5476
|
+
aiDiagonal16: _objectSpread2(_objectSpread2({
|
|
5477
|
+
angle: DIAGONAL_ANGLE
|
|
5478
|
+
}, angleToPoints(DIAGONAL_ANGLE)), {}, {
|
|
5479
|
+
colors: [blueMedium, brandPrimary, pinkMedium],
|
|
5480
|
+
locations: DIAGONAL_LOCATIONS,
|
|
5481
|
+
opacity: 0.16,
|
|
5482
|
+
backgroundFallback: backgroundFallback
|
|
5483
|
+
}),
|
|
5484
|
+
aiDiagonal24: _objectSpread2(_objectSpread2({
|
|
5485
|
+
angle: DIAGONAL_ANGLE
|
|
5486
|
+
}, angleToPoints(DIAGONAL_ANGLE)), {}, {
|
|
5487
|
+
colors: [blueMedium, brandPrimary, pinkMedium],
|
|
5488
|
+
locations: DIAGONAL_LOCATIONS,
|
|
5489
|
+
opacity: 0.24,
|
|
5490
|
+
backgroundFallback: backgroundFallback
|
|
5491
|
+
}),
|
|
5492
|
+
aiHorizontal: _objectSpread2(_objectSpread2({
|
|
5493
|
+
angle: HORIZONTAL_ANGLE
|
|
5494
|
+
}, angleToPoints(HORIZONTAL_ANGLE)), {}, {
|
|
5495
|
+
colors: [brandPrimary, pinkMedium, brandPrimary],
|
|
5496
|
+
locations: HORIZONTAL_LOCATIONS
|
|
5497
|
+
})
|
|
5498
|
+
};
|
|
5499
|
+
};
|
|
5500
|
+
|
|
5429
5501
|
var getGlobalTheme = function getGlobalTheme(scale, systemPalette) {
|
|
5430
5502
|
var fonts = getFonts(scale.font);
|
|
5431
5503
|
var fontSizes = getFontSizes(scale.fontSize);
|
|
@@ -5435,8 +5507,11 @@ var getGlobalTheme = function getGlobalTheme(scale, systemPalette) {
|
|
|
5435
5507
|
var sizes = getSizes(scale.size);
|
|
5436
5508
|
var radii = getRadii(scale.radius);
|
|
5437
5509
|
var shadows = getShadows(systemPalette);
|
|
5510
|
+
var gradients = getGradients(systemPalette);
|
|
5438
5511
|
return {
|
|
5439
|
-
colors: _objectSpread2({}, systemPalette),
|
|
5512
|
+
colors: _objectSpread2(_objectSpread2({}, systemPalette), {}, {
|
|
5513
|
+
gradients: gradients
|
|
5514
|
+
}),
|
|
5440
5515
|
fonts: fonts,
|
|
5441
5516
|
fontSizes: fontSizes,
|
|
5442
5517
|
lineHeights: lineHeights,
|
|
@@ -5539,6 +5614,7 @@ var getAttachmentTheme = function getAttachmentTheme(theme) {
|
|
|
5539
5614
|
|
|
5540
5615
|
var getAvatarTheme = function getAvatarTheme(theme) {
|
|
5541
5616
|
var colors = {
|
|
5617
|
+
neutral: palette$8.maasstrichtBlueLight25,
|
|
5542
5618
|
primary: theme.colors.primary,
|
|
5543
5619
|
info: theme.colors.info,
|
|
5544
5620
|
danger: theme.colors.error,
|
|
@@ -8066,7 +8142,7 @@ var StyledText$4 = index$c(Text$1)(function (_ref) {
|
|
|
8066
8142
|
});
|
|
8067
8143
|
});
|
|
8068
8144
|
|
|
8069
|
-
var _excluded$
|
|
8145
|
+
var _excluded$Q = ["children", "fontSize", "fontWeight", "intent", "typeface", "allowFontScaling"];
|
|
8070
8146
|
/**
|
|
8071
8147
|
* @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.
|
|
8072
8148
|
*/
|
|
@@ -8082,7 +8158,7 @@ var Text = function Text(_ref) {
|
|
|
8082
8158
|
typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
|
|
8083
8159
|
_ref$allowFontScaling = _ref.allowFontScaling,
|
|
8084
8160
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
8085
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
8161
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$Q);
|
|
8086
8162
|
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.');
|
|
8087
8163
|
return /*#__PURE__*/React__default.createElement(StyledText$4, _extends$1({}, nativeProps, {
|
|
8088
8164
|
themeFontSize: fontSize,
|
|
@@ -8115,7 +8191,79 @@ var StyledCaption = index$c(Text$1)(function (_ref) {
|
|
|
8115
8191
|
};
|
|
8116
8192
|
});
|
|
8117
8193
|
|
|
8118
|
-
var
|
|
8194
|
+
var ACCESSIBILITY_KEYS = ['accessible', 'accessibilityActions', 'accessibilityLabel', 'accessibilityRole', 'accessibilityState', 'accessibilityHint', 'accessibilityValue', 'onAccessibilityAction',
|
|
8195
|
+
// Android
|
|
8196
|
+
'accessibilityLabelledBy', 'accessibilityLiveRegion', 'importantForAccessibility',
|
|
8197
|
+
// iOS
|
|
8198
|
+
'accessibilityElementsHidden', 'accessibilityLanguage', 'accessibilityIgnoresInvertColors', 'accessibilityViewIsModal', 'onAccessibilityEscape', 'onAccessibilityTap', 'onMagicTap', 'accessibilityIgnoresInvertColors'];
|
|
8199
|
+
var pickAccessibilityProps = function pickAccessibilityProps(props) {
|
|
8200
|
+
return ACCESSIBILITY_KEYS.filter(function (key) {
|
|
8201
|
+
return key in props;
|
|
8202
|
+
}).reduce(function (acc, key) {
|
|
8203
|
+
return Object.assign(acc, _defineProperty({}, key, props[key]));
|
|
8204
|
+
}, {});
|
|
8205
|
+
};
|
|
8206
|
+
|
|
8207
|
+
var _excluded$P = ["children"];
|
|
8208
|
+
var GradientText = function GradientText(_ref) {
|
|
8209
|
+
var children = _ref.children,
|
|
8210
|
+
accessibilityProps = _objectWithoutProperties(_ref, _excluded$P);
|
|
8211
|
+
var theme = useTheme();
|
|
8212
|
+
var gradient = theme.colors.gradients.aiDiagonal;
|
|
8213
|
+
var _useState = useState(null),
|
|
8214
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
8215
|
+
size = _useState2[0],
|
|
8216
|
+
setSize = _useState2[1];
|
|
8217
|
+
var onLayout = useCallback(function (event) {
|
|
8218
|
+
var _event$nativeEvent$la = event.nativeEvent.layout,
|
|
8219
|
+
width = _event$nativeEvent$la.width,
|
|
8220
|
+
height = _event$nativeEvent$la.height;
|
|
8221
|
+
setSize(function (prevSize) {
|
|
8222
|
+
if (prevSize && prevSize.width === width && prevSize.height === height) {
|
|
8223
|
+
return prevSize;
|
|
8224
|
+
}
|
|
8225
|
+
return {
|
|
8226
|
+
width: width,
|
|
8227
|
+
height: height
|
|
8228
|
+
};
|
|
8229
|
+
});
|
|
8230
|
+
}, []);
|
|
8231
|
+
return /*#__PURE__*/React__default.createElement(View, accessibilityProps, /*#__PURE__*/React__default.createElement(MaskedView, {
|
|
8232
|
+
style: {
|
|
8233
|
+
alignSelf: 'stretch'
|
|
8234
|
+
},
|
|
8235
|
+
accessibilityElementsHidden: true,
|
|
8236
|
+
importantForAccessibility: "no-hide-descendants",
|
|
8237
|
+
maskElement: /*#__PURE__*/React__default.createElement(View, {
|
|
8238
|
+
onLayout: onLayout,
|
|
8239
|
+
style: {
|
|
8240
|
+
backgroundColor: 'transparent'
|
|
8241
|
+
},
|
|
8242
|
+
testID: "gradient-text-mask"
|
|
8243
|
+
}, children)
|
|
8244
|
+
}, size ? /*#__PURE__*/React__default.createElement(LinearGradient, {
|
|
8245
|
+
start: gradient.start,
|
|
8246
|
+
end: gradient.end,
|
|
8247
|
+
colors: gradient.colors,
|
|
8248
|
+
locations: gradient.locations,
|
|
8249
|
+
style: {
|
|
8250
|
+
width: size.width,
|
|
8251
|
+
height: size.height
|
|
8252
|
+
}
|
|
8253
|
+
}) :
|
|
8254
|
+
// Render children as fallback until layout is measured, so text
|
|
8255
|
+
// is visible immediately rather than blank on the first frame.
|
|
8256
|
+
children), /*#__PURE__*/React__default.createElement(View, {
|
|
8257
|
+
style: {
|
|
8258
|
+
position: 'absolute',
|
|
8259
|
+
opacity: 0
|
|
8260
|
+
},
|
|
8261
|
+
importantForAccessibility: "yes",
|
|
8262
|
+
accessibilityElementsHidden: false
|
|
8263
|
+
}, children));
|
|
8264
|
+
};
|
|
8265
|
+
|
|
8266
|
+
var _excluded$O = ["children", "fontWeight", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
|
|
8119
8267
|
var Caption = function Caption(_ref) {
|
|
8120
8268
|
var children = _ref.children,
|
|
8121
8269
|
_ref$fontWeight = _ref.fontWeight,
|
|
@@ -8126,13 +8274,22 @@ var Caption = function Caption(_ref) {
|
|
|
8126
8274
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
8127
8275
|
_ref$fontStyle = _ref.fontStyle,
|
|
8128
8276
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
8129
|
-
|
|
8130
|
-
|
|
8277
|
+
style = _ref.style,
|
|
8278
|
+
testID = _ref.testID,
|
|
8279
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$O);
|
|
8280
|
+
var isAi = intent === 'ai';
|
|
8281
|
+
var styledText = /*#__PURE__*/React__default.createElement(StyledCaption, _extends$1({}, nativeProps, {
|
|
8131
8282
|
themeFontWeight: fontWeight,
|
|
8132
|
-
themeIntent: intent,
|
|
8283
|
+
themeIntent: isAi ? 'body' : intent,
|
|
8133
8284
|
themeIsItalic: fontStyle === 'italic',
|
|
8134
|
-
allowFontScaling: allowFontScaling
|
|
8285
|
+
allowFontScaling: allowFontScaling,
|
|
8286
|
+
style: style,
|
|
8287
|
+
testID: testID
|
|
8135
8288
|
}), children);
|
|
8289
|
+
if (isAi) {
|
|
8290
|
+
return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
8291
|
+
}
|
|
8292
|
+
return styledText;
|
|
8136
8293
|
};
|
|
8137
8294
|
|
|
8138
8295
|
var StyledLabel$1 = index$c(Text$1)(function (_ref) {
|
|
@@ -8151,7 +8308,7 @@ var StyledLabel$1 = index$c(Text$1)(function (_ref) {
|
|
|
8151
8308
|
};
|
|
8152
8309
|
});
|
|
8153
8310
|
|
|
8154
|
-
var _excluded$
|
|
8311
|
+
var _excluded$N = ["children", "intent", "allowFontScaling", "fontStyle", "style", "testID"];
|
|
8155
8312
|
var Label = function Label(_ref) {
|
|
8156
8313
|
var children = _ref.children,
|
|
8157
8314
|
_ref$intent = _ref.intent,
|
|
@@ -8160,12 +8317,21 @@ var Label = function Label(_ref) {
|
|
|
8160
8317
|
allowFontScaling = _ref$allowFontScaling === void 0 ? false : _ref$allowFontScaling,
|
|
8161
8318
|
_ref$fontStyle = _ref.fontStyle,
|
|
8162
8319
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8320
|
+
style = _ref.style,
|
|
8321
|
+
testID = _ref.testID,
|
|
8322
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$N);
|
|
8323
|
+
var isAi = intent === 'ai';
|
|
8324
|
+
var styledText = /*#__PURE__*/React__default.createElement(StyledLabel$1, _extends$1({}, nativeProps, {
|
|
8325
|
+
themeIntent: isAi ? 'body' : intent,
|
|
8166
8326
|
themeIsItalic: fontStyle === 'italic',
|
|
8167
|
-
allowFontScaling: allowFontScaling
|
|
8327
|
+
allowFontScaling: allowFontScaling,
|
|
8328
|
+
style: style,
|
|
8329
|
+
testID: testID
|
|
8168
8330
|
}), children);
|
|
8331
|
+
if (isAi) {
|
|
8332
|
+
return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
8333
|
+
}
|
|
8334
|
+
return styledText;
|
|
8169
8335
|
};
|
|
8170
8336
|
|
|
8171
8337
|
var StyledTitle$1 = index$c(Text$1)(function (_ref) {
|
|
@@ -8183,7 +8349,7 @@ var StyledTitle$1 = index$c(Text$1)(function (_ref) {
|
|
|
8183
8349
|
};
|
|
8184
8350
|
});
|
|
8185
8351
|
|
|
8186
|
-
var _excluded$
|
|
8352
|
+
var _excluded$M = ["children", "intent", "allowFontScaling", "level", "typeface", "fontStyle", "style", "testID"];
|
|
8187
8353
|
var Title = function Title(_ref) {
|
|
8188
8354
|
var children = _ref.children,
|
|
8189
8355
|
_ref$intent = _ref.intent,
|
|
@@ -8196,14 +8362,23 @@ var Title = function Title(_ref) {
|
|
|
8196
8362
|
typeface = _ref$typeface === void 0 ? 'neutral' : _ref$typeface,
|
|
8197
8363
|
_ref$fontStyle = _ref.fontStyle,
|
|
8198
8364
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
8199
|
-
|
|
8200
|
-
|
|
8365
|
+
style = _ref.style,
|
|
8366
|
+
testID = _ref.testID,
|
|
8367
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$M);
|
|
8368
|
+
var isAi = intent === 'ai';
|
|
8369
|
+
var styledText = /*#__PURE__*/React__default.createElement(StyledTitle$1, _extends$1({}, nativeProps, {
|
|
8201
8370
|
themeLevel: level,
|
|
8202
8371
|
themeTypeface: typeface,
|
|
8203
|
-
themeIntent: intent,
|
|
8372
|
+
themeIntent: isAi ? 'body' : intent,
|
|
8204
8373
|
themeIsItalic: fontStyle === 'italic',
|
|
8205
|
-
allowFontScaling: allowFontScaling
|
|
8374
|
+
allowFontScaling: allowFontScaling,
|
|
8375
|
+
style: style,
|
|
8376
|
+
testID: testID
|
|
8206
8377
|
}), children);
|
|
8378
|
+
if (isAi) {
|
|
8379
|
+
return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
8380
|
+
}
|
|
8381
|
+
return styledText;
|
|
8207
8382
|
};
|
|
8208
8383
|
|
|
8209
8384
|
var FONTWEIGHT_MAP = {
|
|
@@ -8235,7 +8410,7 @@ var StyledBody$2 = index$c(Text$1)(function (_ref) {
|
|
|
8235
8410
|
};
|
|
8236
8411
|
});
|
|
8237
8412
|
|
|
8238
|
-
var _excluded$
|
|
8413
|
+
var _excluded$L = ["children", "intent", "allowFontScaling", "typeface", "variant", "fontStyle", "style", "testID"];
|
|
8239
8414
|
var Body = function Body(_ref) {
|
|
8240
8415
|
var children = _ref.children,
|
|
8241
8416
|
_ref$intent = _ref.intent,
|
|
@@ -8248,14 +8423,23 @@ var Body = function Body(_ref) {
|
|
|
8248
8423
|
variant = _ref$variant === void 0 ? 'regular' : _ref$variant,
|
|
8249
8424
|
_ref$fontStyle = _ref.fontStyle,
|
|
8250
8425
|
fontStyle = _ref$fontStyle === void 0 ? 'normal' : _ref$fontStyle,
|
|
8251
|
-
|
|
8252
|
-
|
|
8426
|
+
style = _ref.style,
|
|
8427
|
+
testID = _ref.testID,
|
|
8428
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$L);
|
|
8429
|
+
var isAi = intent === 'ai';
|
|
8430
|
+
var styledText = /*#__PURE__*/React__default.createElement(StyledBody$2, _extends$1({}, nativeProps, {
|
|
8253
8431
|
themeTypeface: typeface,
|
|
8254
|
-
themeIntent: intent,
|
|
8432
|
+
themeIntent: isAi ? 'body' : intent,
|
|
8255
8433
|
themeVariant: variant,
|
|
8256
8434
|
themeIsItalic: fontStyle === 'italic',
|
|
8257
|
-
allowFontScaling: allowFontScaling
|
|
8435
|
+
allowFontScaling: allowFontScaling,
|
|
8436
|
+
style: style,
|
|
8437
|
+
testID: testID
|
|
8258
8438
|
}), children);
|
|
8439
|
+
if (isAi) {
|
|
8440
|
+
return /*#__PURE__*/React__default.createElement(GradientText, pickAccessibilityProps(nativeProps), styledText);
|
|
8441
|
+
}
|
|
8442
|
+
return styledText;
|
|
8259
8443
|
};
|
|
8260
8444
|
|
|
8261
8445
|
var Typography = {
|
|
@@ -8865,10 +9049,10 @@ var StyledHeroIcon = index$c(HeroIcon)(function (_ref) {
|
|
|
8865
9049
|
};
|
|
8866
9050
|
});
|
|
8867
9051
|
|
|
8868
|
-
var
|
|
8869
|
-
var
|
|
8870
|
-
|
|
8871
|
-
|
|
9052
|
+
var SpinWrapper = function SpinWrapper(_ref) {
|
|
9053
|
+
var children = _ref.children,
|
|
9054
|
+
style = _ref.style,
|
|
9055
|
+
testID = _ref.testID;
|
|
8872
9056
|
var rotateAnimation = useRef(new Animated.Value(0));
|
|
8873
9057
|
useEffect(function () {
|
|
8874
9058
|
var animation = Animated.loop(Animated.timing(rotateAnimation.current, {
|
|
@@ -8879,22 +9063,74 @@ var AnimatedIcon = function AnimatedIcon(_ref) {
|
|
|
8879
9063
|
}));
|
|
8880
9064
|
animation.start();
|
|
8881
9065
|
return function () {
|
|
8882
|
-
animation.stop();
|
|
9066
|
+
return animation.stop();
|
|
8883
9067
|
};
|
|
8884
9068
|
}, []);
|
|
8885
|
-
var
|
|
9069
|
+
var rotate = rotateAnimation.current.interpolate({
|
|
8886
9070
|
inputRange: [0, 1],
|
|
8887
9071
|
outputRange: ['0deg', '360deg']
|
|
8888
9072
|
});
|
|
8889
9073
|
return /*#__PURE__*/React__default.createElement(Animated.View, {
|
|
9074
|
+
testID: testID,
|
|
8890
9075
|
style: [{
|
|
8891
9076
|
transform: [{
|
|
8892
|
-
rotate:
|
|
9077
|
+
rotate: rotate
|
|
8893
9078
|
}]
|
|
8894
9079
|
}, style]
|
|
9080
|
+
}, children);
|
|
9081
|
+
};
|
|
9082
|
+
|
|
9083
|
+
var _excluded$K = ["style"];
|
|
9084
|
+
var AnimatedIcon = function AnimatedIcon(_ref) {
|
|
9085
|
+
var style = _ref.style,
|
|
9086
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$K);
|
|
9087
|
+
return /*#__PURE__*/React__default.createElement(SpinWrapper, {
|
|
9088
|
+
style: style
|
|
8895
9089
|
}, /*#__PURE__*/React__default.createElement(StyledHeroIcon, otherProps));
|
|
8896
9090
|
};
|
|
8897
9091
|
|
|
9092
|
+
var _excluded$J = ["name", "themeSize", "testID", "style"];
|
|
9093
|
+
var GradientIcon = function GradientIcon(_ref) {
|
|
9094
|
+
var name = _ref.name,
|
|
9095
|
+
themeSize = _ref.themeSize,
|
|
9096
|
+
testID = _ref.testID,
|
|
9097
|
+
style = _ref.style,
|
|
9098
|
+
accessibilityProps = _objectWithoutProperties(_ref, _excluded$J);
|
|
9099
|
+
var theme = useTheme();
|
|
9100
|
+
var gradient = theme.colors.gradients.aiDiagonal;
|
|
9101
|
+
var size = theme.__hd__.icon.sizes[themeSize];
|
|
9102
|
+
return /*#__PURE__*/React__default.createElement(MaskedView, _extends$1({
|
|
9103
|
+
testID: testID,
|
|
9104
|
+
style: [{
|
|
9105
|
+
width: size,
|
|
9106
|
+
height: size
|
|
9107
|
+
}, style]
|
|
9108
|
+
}, accessibilityProps, {
|
|
9109
|
+
maskElement: /*#__PURE__*/React__default.createElement(View, {
|
|
9110
|
+
style: {
|
|
9111
|
+
backgroundColor: 'transparent',
|
|
9112
|
+
width: size,
|
|
9113
|
+
height: size,
|
|
9114
|
+
alignItems: 'center',
|
|
9115
|
+
justifyContent: 'center'
|
|
9116
|
+
}
|
|
9117
|
+
}, /*#__PURE__*/React__default.createElement(StyledHeroIcon, {
|
|
9118
|
+
name: name,
|
|
9119
|
+
themeIntent: "text",
|
|
9120
|
+
themeSize: themeSize
|
|
9121
|
+
}))
|
|
9122
|
+
}), /*#__PURE__*/React__default.createElement(LinearGradient, {
|
|
9123
|
+
start: gradient.start,
|
|
9124
|
+
end: gradient.end,
|
|
9125
|
+
colors: gradient.colors,
|
|
9126
|
+
locations: gradient.locations,
|
|
9127
|
+
style: {
|
|
9128
|
+
width: size,
|
|
9129
|
+
height: size
|
|
9130
|
+
}
|
|
9131
|
+
}));
|
|
9132
|
+
};
|
|
9133
|
+
|
|
8898
9134
|
var Icon = function Icon(_ref) {
|
|
8899
9135
|
var icon = _ref.icon,
|
|
8900
9136
|
style = _ref.style,
|
|
@@ -8930,6 +9166,20 @@ var Icon = function Icon(_ref) {
|
|
|
8930
9166
|
accessibilityViewIsModal: accessibilityViewIsModal,
|
|
8931
9167
|
accessibilityActions: accessibilityActions
|
|
8932
9168
|
};
|
|
9169
|
+
if (intent === 'ai') {
|
|
9170
|
+
var gradientIcon = /*#__PURE__*/React__default.createElement(GradientIcon, _extends$1({
|
|
9171
|
+
name: icon,
|
|
9172
|
+
themeSize: size,
|
|
9173
|
+
testID: testID,
|
|
9174
|
+
style: spin ? undefined : style
|
|
9175
|
+
}, accessibilityProps));
|
|
9176
|
+
if (spin) {
|
|
9177
|
+
return /*#__PURE__*/React__default.createElement(SpinWrapper, {
|
|
9178
|
+
style: style
|
|
9179
|
+
}, gradientIcon);
|
|
9180
|
+
}
|
|
9181
|
+
return gradientIcon;
|
|
9182
|
+
}
|
|
8933
9183
|
return spin ? /*#__PURE__*/React__default.createElement(AnimatedIcon, _extends$1({
|
|
8934
9184
|
name: icon,
|
|
8935
9185
|
themeIntent: intent,
|
|
@@ -9624,7 +9874,7 @@ var Avatar = function Avatar(_ref) {
|
|
|
9624
9874
|
_ref$size = _ref.size,
|
|
9625
9875
|
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
9626
9876
|
_ref$intent = _ref.intent,
|
|
9627
|
-
intent = _ref$intent === void 0 ? '
|
|
9877
|
+
intent = _ref$intent === void 0 ? 'neutral' : _ref$intent;
|
|
9628
9878
|
var _useState = useState(false),
|
|
9629
9879
|
_useState2 = _slicedToArray(_useState, 2),
|
|
9630
9880
|
hasImageError = _useState2[0],
|
|
@@ -27013,7 +27263,7 @@ var StyledGradientContainer = index$c(Box)(function (_ref2) {
|
|
|
27013
27263
|
});
|
|
27014
27264
|
|
|
27015
27265
|
var _excluded$b = ["intent", "variant", "style", "onLayout"];
|
|
27016
|
-
var AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient);
|
|
27266
|
+
var AnimatedLinearGradient = Animated.createAnimatedComponent(LinearGradient$1);
|
|
27017
27267
|
var gradientPositions = {
|
|
27018
27268
|
start: {
|
|
27019
27269
|
x: 0,
|
package/jest.config.js
CHANGED
|
@@ -19,6 +19,6 @@ module.exports = {
|
|
|
19
19
|
roots: ['<rootDir>/src'],
|
|
20
20
|
snapshotSerializers: ['@emotion/jest/serializer'],
|
|
21
21
|
transformIgnorePatterns: [
|
|
22
|
-
'node_modules/(?!((jest-)?@react-native|@emotion/.*|react-native|react-native-linear-gradient|react-native-pager-view|@react-native-community|nanoid|d3|d3-.*|internmap|delaunator|robust-predicates)/)',
|
|
22
|
+
'node_modules/(?!((jest-)?@react-native|@emotion/.*|react-native|react-native-linear-gradient|react-native-pager-view|@react-native-community|@react-native-masked-view|expo-linear-gradient|nanoid|d3|d3-.*|internmap|delaunator|robust-predicates)/)',
|
|
23
23
|
],
|
|
24
24
|
};
|