@hero-design/rn 8.10.0 → 8.11.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/.turbo/turbo-build.log +9 -9
- package/es/index.js +293 -82
- package/lib/index.js +293 -82
- package/package.json +5 -5
- package/src/components/Card/index.tsx +1 -1
- package/src/components/Carousel/CardCarousel.tsx +218 -0
- package/src/components/Carousel/StyledCardCarousel.tsx +40 -0
- package/src/components/Carousel/__tests__/CardCarousel.spec.tsx +105 -0
- package/src/components/Carousel/__tests__/StyledCardCarousel.spec.tsx +38 -0
- package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +289 -0
- package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +109 -0
- package/src/components/Carousel/contants.ts +10 -0
- package/src/components/Carousel/index.tsx +4 -1
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +0 -1
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +0 -1
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +2 -2
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +1 -6
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +1 -6
- package/src/components/TextInput/StyledTextInput.tsx +1 -2
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +5 -6
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +6 -20
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +0 -2
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +0 -2
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +24 -4
- package/src/theme/components/cardCarousel.ts +28 -0
- package/src/theme/components/textInput.ts +2 -6
- package/src/theme/getTheme.ts +3 -0
- package/src/types.ts +2 -0
- package/types/components/Card/index.d.ts +1 -1
- package/types/components/Carousel/CardCarousel.d.ts +40 -0
- package/types/components/Carousel/StyledCardCarousel.d.ts +31 -0
- package/types/components/Carousel/contants.d.ts +2 -0
- package/types/components/Carousel/index.d.ts +5 -3
- package/types/theme/components/cardCarousel.d.ts +25 -0
- package/types/theme/components/textInput.d.ts +1 -4
- package/types/theme/getTheme.d.ts +2 -0
- package/types/types.d.ts +2 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
[
|
|
2
|
-
[
|
|
3
|
-
[
|
|
4
|
-
[
|
|
5
|
-
[
|
|
6
|
-
[
|
|
7
|
-
[
|
|
8
|
-
[
|
|
9
|
-
[
|
|
1
|
+
[34m@hero-design/rn:build[0m: cache hit, replaying output [2mf335a4d5339821cf[0m
|
|
2
|
+
[34m@hero-design/rn:build: [0m$ yarn build:js && yarn build:types
|
|
3
|
+
[34m@hero-design/rn:build: [0m$ rollup -c
|
|
4
|
+
[34m@hero-design/rn:build: [0m[36m
|
|
5
|
+
[34m@hero-design/rn:build: [0m[1msrc/index.ts[22m → [1mlib/index.js, es/index.js[22m...[39m
|
|
6
|
+
[34m@hero-design/rn:build: [0m[1m[33m(!) Plugin replace: @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.[39m[22m
|
|
7
|
+
[34m@hero-design/rn:build: [0m[1m[33m(!) Plugin node-resolve: preferring built-in module 'events' over local alternative at '/root/hero-design/node_modules/events/events.js', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning[39m[22m
|
|
8
|
+
[34m@hero-design/rn:build: [0m[32mcreated [1mlib/index.js, es/index.js[22m in [1m22.5s[22m[39m
|
|
9
|
+
[34m@hero-design/rn:build: [0m$ tsc --noEmit false --emitDeclarationOnly --project tsconfig.prod.json
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as reactNative from 'react-native';
|
|
2
|
-
import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View, Easing, TouchableOpacity, Text as Text$1, Image as Image$1, TouchableWithoutFeedback, Pressable, SafeAreaView, KeyboardAvoidingView, ScrollView, Modal,
|
|
2
|
+
import { Platform, Dimensions, StyleSheet as StyleSheet$1, Animated, View, Easing, TouchableOpacity, Text as Text$1, Image as Image$1, TouchableWithoutFeedback, Pressable, SafeAreaView, KeyboardAvoidingView, ScrollView, Modal, FlatList, useWindowDimensions, TextInput as TextInput$1, PanResponder, TouchableHighlight, InteractionManager, Keyboard, SectionList, LayoutAnimation, RefreshControl as RefreshControl$1 } from 'react-native';
|
|
3
3
|
import React, { useContext, createContext, createElement, useMemo, forwardRef, useEffect, useCallback, useRef, useState, useLayoutEffect, useImperativeHandle } from 'react';
|
|
4
4
|
import { createIconSet } from 'react-native-vector-icons';
|
|
5
5
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -1826,6 +1826,36 @@ var getCarouselTheme = function getCarouselTheme(theme) {
|
|
|
1826
1826
|
};
|
|
1827
1827
|
};
|
|
1828
1828
|
|
|
1829
|
+
var getCardCarouselTheme = function getCardCarouselTheme(theme) {
|
|
1830
|
+
var space = {
|
|
1831
|
+
pageControlMarginTop: theme.space.medium,
|
|
1832
|
+
carouselItemSpacing: theme.space.small,
|
|
1833
|
+
contentContainerPaddingHorizontal: theme.space.large
|
|
1834
|
+
};
|
|
1835
|
+
var colors = {
|
|
1836
|
+
shadow: theme.colors.primaryOutline,
|
|
1837
|
+
carouselItemBackground: theme.colors.defaultSurface
|
|
1838
|
+
};
|
|
1839
|
+
var shadows = {
|
|
1840
|
+
offset: {
|
|
1841
|
+
width: 0,
|
|
1842
|
+
height: 2
|
|
1843
|
+
},
|
|
1844
|
+
opacity: 0.12,
|
|
1845
|
+
radius: theme.radii.medium,
|
|
1846
|
+
elevation: 4
|
|
1847
|
+
};
|
|
1848
|
+
var radii = {
|
|
1849
|
+
card: theme.radii.medium
|
|
1850
|
+
};
|
|
1851
|
+
return {
|
|
1852
|
+
shadows: shadows,
|
|
1853
|
+
colors: colors,
|
|
1854
|
+
space: space,
|
|
1855
|
+
radii: radii
|
|
1856
|
+
};
|
|
1857
|
+
};
|
|
1858
|
+
|
|
1829
1859
|
var getCheckboxTheme = function getCheckboxTheme(theme) {
|
|
1830
1860
|
var colors = {
|
|
1831
1861
|
"default": theme.colors.primaryOutline,
|
|
@@ -2551,7 +2581,8 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
2551
2581
|
errorMarginLeft: theme.space.xsmall,
|
|
2552
2582
|
maxLengthLabelMarginLeft: theme.space.xsmall,
|
|
2553
2583
|
errorAndHelpTextContainerPaddingLeft: theme.space.medium,
|
|
2554
|
-
containerMarginTop: theme.space.small
|
|
2584
|
+
containerMarginTop: theme.space.small,
|
|
2585
|
+
labelInsideTextInputMarginTop: -theme.space.xxsmall
|
|
2555
2586
|
};
|
|
2556
2587
|
var fontSizes = {
|
|
2557
2588
|
text: theme.fontSizes.medium,
|
|
@@ -2560,10 +2591,6 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
2560
2591
|
maxLength: theme.fontSizes.small,
|
|
2561
2592
|
asteriskLabel: theme.fontSizes.medium
|
|
2562
2593
|
};
|
|
2563
|
-
var lineHeights = {
|
|
2564
|
-
text: theme.lineHeights.xsmall,
|
|
2565
|
-
labelInsideTextInput: theme.lineHeights.xsmall
|
|
2566
|
-
};
|
|
2567
2594
|
var borderWidths = {
|
|
2568
2595
|
container: {
|
|
2569
2596
|
normal: theme.borderWidths.base,
|
|
@@ -2582,7 +2609,6 @@ var getTextInputTheme = function getTextInputTheme(theme) {
|
|
|
2582
2609
|
fontSizes: fontSizes,
|
|
2583
2610
|
borderWidths: borderWidths,
|
|
2584
2611
|
radii: radii,
|
|
2585
|
-
lineHeights: lineHeights,
|
|
2586
2612
|
sizes: sizes
|
|
2587
2613
|
};
|
|
2588
2614
|
};
|
|
@@ -2729,6 +2755,7 @@ var getTheme$1 = function getTheme() {
|
|
|
2729
2755
|
calendar: getCalendarTheme(globalTheme),
|
|
2730
2756
|
card: getCardTheme(globalTheme),
|
|
2731
2757
|
carousel: getCarouselTheme(globalTheme),
|
|
2758
|
+
cardCarousel: getCardCarouselTheme(globalTheme),
|
|
2732
2759
|
checkbox: getCheckboxTheme(globalTheme),
|
|
2733
2760
|
contentNavigator: getContentNavigatorTheme(globalTheme),
|
|
2734
2761
|
datePicker: getDatePickerTheme(globalTheme),
|
|
@@ -5624,7 +5651,7 @@ var index$a = components.reduce(function (acc, comp) {
|
|
|
5624
5651
|
});
|
|
5625
5652
|
}, styled);
|
|
5626
5653
|
|
|
5627
|
-
var StyledWrapper$
|
|
5654
|
+
var StyledWrapper$c = index$a(Animated.View)(function () {
|
|
5628
5655
|
return {
|
|
5629
5656
|
margin: 0,
|
|
5630
5657
|
padding: 0,
|
|
@@ -5698,7 +5725,7 @@ var Collapse = function Collapse(_ref) {
|
|
|
5698
5725
|
var height = _ref2.height;
|
|
5699
5726
|
setContentHeight(height);
|
|
5700
5727
|
}, []);
|
|
5701
|
-
return /*#__PURE__*/React.createElement(StyledWrapper$
|
|
5728
|
+
return /*#__PURE__*/React.createElement(StyledWrapper$c, {
|
|
5702
5729
|
style: {
|
|
5703
5730
|
height: collapseAnim
|
|
5704
5731
|
},
|
|
@@ -5711,10 +5738,10 @@ var Collapse = function Collapse(_ref) {
|
|
|
5711
5738
|
}, children)));
|
|
5712
5739
|
};
|
|
5713
5740
|
|
|
5714
|
-
var StyledWrapper$
|
|
5741
|
+
var StyledWrapper$b = index$a(View)(function () {
|
|
5715
5742
|
return {};
|
|
5716
5743
|
});
|
|
5717
|
-
var StyledItemWrapper = index$a(View)(function (_ref) {
|
|
5744
|
+
var StyledItemWrapper$1 = index$a(View)(function (_ref) {
|
|
5718
5745
|
var theme = _ref.theme,
|
|
5719
5746
|
themeVariant = _ref.themeVariant;
|
|
5720
5747
|
return {
|
|
@@ -6372,7 +6399,7 @@ var AccordionItem = function AccordionItem(_ref) {
|
|
|
6372
6399
|
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
6373
6400
|
style = _ref.style,
|
|
6374
6401
|
testID = _ref.testID;
|
|
6375
|
-
return /*#__PURE__*/React.createElement(StyledItemWrapper, {
|
|
6402
|
+
return /*#__PURE__*/React.createElement(StyledItemWrapper$1, {
|
|
6376
6403
|
themeVariant: variant,
|
|
6377
6404
|
style: style,
|
|
6378
6405
|
testID: testID
|
|
@@ -6406,7 +6433,7 @@ var Accordion = function Accordion(_ref) {
|
|
|
6406
6433
|
_usePropsOrInternalSt2 = _slicedToArray(_usePropsOrInternalSt, 2),
|
|
6407
6434
|
_activeItemKey = _usePropsOrInternalSt2[0],
|
|
6408
6435
|
_onItemPress = _usePropsOrInternalSt2[1];
|
|
6409
|
-
return /*#__PURE__*/React.createElement(StyledWrapper$
|
|
6436
|
+
return /*#__PURE__*/React.createElement(StyledWrapper$b, {
|
|
6410
6437
|
style: style,
|
|
6411
6438
|
testID: testID
|
|
6412
6439
|
}, items.map(function (_ref2, index) {
|
|
@@ -6593,7 +6620,7 @@ var Attachment = function Attachment(_ref) {
|
|
|
6593
6620
|
})) : null);
|
|
6594
6621
|
};
|
|
6595
6622
|
|
|
6596
|
-
var StyledWrapper$
|
|
6623
|
+
var StyledWrapper$a = index$a(TouchableOpacity)(function (_ref) {
|
|
6597
6624
|
var themeSize = _ref.themeSize,
|
|
6598
6625
|
themeIntent = _ref.themeIntent,
|
|
6599
6626
|
theme = _ref.theme;
|
|
@@ -6648,7 +6675,7 @@ var Avatar = function Avatar(_ref) {
|
|
|
6648
6675
|
hasImageError = _useState2[0],
|
|
6649
6676
|
setHasImageError = _useState2[1];
|
|
6650
6677
|
if (title === undefined && source === undefined) return null;
|
|
6651
|
-
return /*#__PURE__*/React.createElement(StyledWrapper$
|
|
6678
|
+
return /*#__PURE__*/React.createElement(StyledWrapper$a, {
|
|
6652
6679
|
testID: testID,
|
|
6653
6680
|
onPress: onPress,
|
|
6654
6681
|
disabled: onPress === undefined,
|
|
@@ -6672,7 +6699,7 @@ var Avatar = function Avatar(_ref) {
|
|
|
6672
6699
|
};
|
|
6673
6700
|
|
|
6674
6701
|
var VISIBLE_RATIO = 0.7;
|
|
6675
|
-
var StyledWrapper$
|
|
6702
|
+
var StyledWrapper$9 = index$a(View)(function (_ref) {
|
|
6676
6703
|
var theme = _ref.theme,
|
|
6677
6704
|
themeSize = _ref.themeSize,
|
|
6678
6705
|
themeAvatarCount = _ref.themeAvatarCount;
|
|
@@ -6734,7 +6761,7 @@ var AvatarStack = function AvatarStack(_ref) {
|
|
|
6734
6761
|
});
|
|
6735
6762
|
avatars.push(remainingAvatar);
|
|
6736
6763
|
}
|
|
6737
|
-
return /*#__PURE__*/React.createElement(StyledWrapper$
|
|
6764
|
+
return /*#__PURE__*/React.createElement(StyledWrapper$9, {
|
|
6738
6765
|
themeSize: size,
|
|
6739
6766
|
themeAvatarCount: avatars.length,
|
|
6740
6767
|
style: style,
|
|
@@ -7069,7 +7096,7 @@ var Divider = function Divider(_ref) {
|
|
|
7069
7096
|
|
|
7070
7097
|
var AnimatedPressable$1 = Animated.createAnimatedComponent(Pressable);
|
|
7071
7098
|
var AnimatedSafeAreaView = Animated.createAnimatedComponent(SafeAreaView);
|
|
7072
|
-
var StyledWrapper$
|
|
7099
|
+
var StyledWrapper$8 = index$a(View)(_objectSpread2(_objectSpread2({}, StyleSheet$1.absoluteFillObject), {}, {
|
|
7073
7100
|
flexDirection: 'column-reverse'
|
|
7074
7101
|
}));
|
|
7075
7102
|
var StyledKeyboardAvoidingView = index$a(KeyboardAvoidingView)(function () {
|
|
@@ -7728,7 +7755,7 @@ var BottomSheet = function BottomSheet(_ref) {
|
|
|
7728
7755
|
transparent: true,
|
|
7729
7756
|
testID: testID,
|
|
7730
7757
|
onShow: onOpen
|
|
7731
|
-
}, /*#__PURE__*/React.createElement(StyledWrapper$
|
|
7758
|
+
}, /*#__PURE__*/React.createElement(StyledWrapper$8, {
|
|
7732
7759
|
pointerEvents: "box-none"
|
|
7733
7760
|
}, /*#__PURE__*/React.createElement(StyledKeyboardAvoidingView, _extends$1({
|
|
7734
7761
|
behavior: Platform.OS === 'ios' ? 'padding' : 'height'
|
|
@@ -10559,7 +10586,7 @@ var Image = function Image(_ref) {
|
|
|
10559
10586
|
}, imageNativeProps));
|
|
10560
10587
|
};
|
|
10561
10588
|
|
|
10562
|
-
var StyledPageControl$
|
|
10589
|
+
var StyledPageControl$2 = index$a(View)(function () {
|
|
10563
10590
|
return {
|
|
10564
10591
|
flexDirection: 'row',
|
|
10565
10592
|
alignItems: 'center'
|
|
@@ -10587,7 +10614,7 @@ var PageControl = function PageControl(_ref) {
|
|
|
10587
10614
|
React.useEffect(function () {
|
|
10588
10615
|
animatedValue.setValue(currentPage);
|
|
10589
10616
|
}, [currentPage]);
|
|
10590
|
-
return /*#__PURE__*/React.createElement(StyledPageControl$
|
|
10617
|
+
return /*#__PURE__*/React.createElement(StyledPageControl$2, {
|
|
10591
10618
|
testID: testID,
|
|
10592
10619
|
style: style
|
|
10593
10620
|
}, new Array(numberOfPages).fill('').map(function (_, index) {
|
|
@@ -10676,7 +10703,7 @@ var StyledCarouselFooterWrapper = index$a(View)(function (_ref5) {
|
|
|
10676
10703
|
marginBottom: theme.__hd__.carousel.space.footerMarginBottom
|
|
10677
10704
|
};
|
|
10678
10705
|
});
|
|
10679
|
-
var StyledPageControl = index$a(PageControl)({
|
|
10706
|
+
var StyledPageControl$1 = index$a(PageControl)({
|
|
10680
10707
|
marginStart: 'auto'
|
|
10681
10708
|
});
|
|
10682
10709
|
|
|
@@ -10711,7 +10738,243 @@ var CarouselItem = function CarouselItem(_ref) {
|
|
|
10711
10738
|
}, body) : null));
|
|
10712
10739
|
};
|
|
10713
10740
|
|
|
10714
|
-
|
|
10741
|
+
/*
|
|
10742
|
+
* Carousel item width.
|
|
10743
|
+
* the percentage of the Card Carousel width
|
|
10744
|
+
*/
|
|
10745
|
+
var ITEM_WIDTH_RATE = 0.85;
|
|
10746
|
+
/*
|
|
10747
|
+
* view position when scroll to Index
|
|
10748
|
+
*/
|
|
10749
|
+
var VIEW_POSITION_CENTER = 0.5;
|
|
10750
|
+
|
|
10751
|
+
var StyledDataCard = index$a(View)(function (_ref) {
|
|
10752
|
+
var theme = _ref.theme;
|
|
10753
|
+
return {
|
|
10754
|
+
borderRadius: theme.__hd__.card.radii["default"],
|
|
10755
|
+
overflow: 'hidden',
|
|
10756
|
+
flexDirection: 'row'
|
|
10757
|
+
};
|
|
10758
|
+
});
|
|
10759
|
+
var Indicator = index$a(View)(function (_ref2) {
|
|
10760
|
+
var theme = _ref2.theme,
|
|
10761
|
+
themeIntent = _ref2.themeIntent;
|
|
10762
|
+
return {
|
|
10763
|
+
backgroundColor: theme.__hd__.card.colors[themeIntent],
|
|
10764
|
+
width: theme.__hd__.card.sizes.indicatorWidth,
|
|
10765
|
+
height: '100%'
|
|
10766
|
+
};
|
|
10767
|
+
});
|
|
10768
|
+
|
|
10769
|
+
var _excluded$d = ["intent", "children"];
|
|
10770
|
+
var DataCard = function DataCard(_ref) {
|
|
10771
|
+
var _ref$intent = _ref.intent,
|
|
10772
|
+
intent = _ref$intent === void 0 ? 'info' : _ref$intent,
|
|
10773
|
+
children = _ref.children,
|
|
10774
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$d);
|
|
10775
|
+
return /*#__PURE__*/React.createElement(StyledDataCard, nativeProps, /*#__PURE__*/React.createElement(Indicator, {
|
|
10776
|
+
themeIntent: intent,
|
|
10777
|
+
testID: "data-card-indicator"
|
|
10778
|
+
}), children);
|
|
10779
|
+
};
|
|
10780
|
+
|
|
10781
|
+
var StyledCard$1 = index$a(View)(function (_ref) {
|
|
10782
|
+
var theme = _ref.theme,
|
|
10783
|
+
themeIntent = _ref.themeIntent;
|
|
10784
|
+
return _objectSpread2(_objectSpread2({}, themeIntent !== undefined && {
|
|
10785
|
+
backgroundColor: theme.__hd__.card.colors[themeIntent]
|
|
10786
|
+
}), {}, {
|
|
10787
|
+
borderRadius: theme.__hd__.card.radii["default"],
|
|
10788
|
+
overflow: 'hidden'
|
|
10789
|
+
});
|
|
10790
|
+
});
|
|
10791
|
+
|
|
10792
|
+
var _excluded$c = ["intent", "children"];
|
|
10793
|
+
var Card = function Card(_ref) {
|
|
10794
|
+
var intent = _ref.intent,
|
|
10795
|
+
children = _ref.children,
|
|
10796
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$c);
|
|
10797
|
+
return /*#__PURE__*/React.createElement(StyledCard$1, _extends$1({}, nativeProps, {
|
|
10798
|
+
themeIntent: intent
|
|
10799
|
+
}), children);
|
|
10800
|
+
};
|
|
10801
|
+
var Card$1 = Object.assign(Card, {
|
|
10802
|
+
Data: DataCard
|
|
10803
|
+
});
|
|
10804
|
+
|
|
10805
|
+
var StyledPageControl = index$a(PageControl)(function (_ref) {
|
|
10806
|
+
var theme = _ref.theme;
|
|
10807
|
+
return {
|
|
10808
|
+
alignSelf: 'center',
|
|
10809
|
+
marginTop: theme.__hd__.cardCarousel.space.pageControlMarginTop
|
|
10810
|
+
};
|
|
10811
|
+
});
|
|
10812
|
+
var StyledWrapper$7 = index$a(View)({});
|
|
10813
|
+
var StyledCard = index$a(Card$1)(function (_ref2) {
|
|
10814
|
+
var theme = _ref2.theme;
|
|
10815
|
+
return {
|
|
10816
|
+
borderRadius: theme.__hd__.cardCarousel.radii.card,
|
|
10817
|
+
overflow: 'hidden',
|
|
10818
|
+
flex: 1
|
|
10819
|
+
};
|
|
10820
|
+
});
|
|
10821
|
+
var StyledShadow = index$a(View)(function (_ref3) {
|
|
10822
|
+
var theme = _ref3.theme;
|
|
10823
|
+
return {
|
|
10824
|
+
borderRadius: theme.__hd__.cardCarousel.radii.card,
|
|
10825
|
+
shadowColor: theme.__hd__.cardCarousel.colors.shadow,
|
|
10826
|
+
shadowOffset: theme.__hd__.cardCarousel.shadows.offset,
|
|
10827
|
+
shadowRadius: theme.__hd__.cardCarousel.shadows.radius,
|
|
10828
|
+
shadowOpacity: theme.__hd__.cardCarousel.shadows.opacity,
|
|
10829
|
+
elevation: theme.__hd__.cardCarousel.shadows.elevation,
|
|
10830
|
+
flex: 1
|
|
10831
|
+
};
|
|
10832
|
+
});
|
|
10833
|
+
var StyledItemWrapper = index$a(View)(function (_ref4) {
|
|
10834
|
+
var theme = _ref4.theme;
|
|
10835
|
+
return {
|
|
10836
|
+
padding: theme.__hd__.cardCarousel.space.carouselItemSpacing
|
|
10837
|
+
};
|
|
10838
|
+
});
|
|
10839
|
+
|
|
10840
|
+
var CardCarousel = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
10841
|
+
var onItemIndexChange = _ref.onItemIndexChange,
|
|
10842
|
+
items = _ref.items,
|
|
10843
|
+
_ref$hidePageControl = _ref.hidePageControl,
|
|
10844
|
+
hidePageControl = _ref$hidePageControl === void 0 ? false : _ref$hidePageControl,
|
|
10845
|
+
style = _ref.style,
|
|
10846
|
+
testID = _ref.testID,
|
|
10847
|
+
_ref$autoPlay = _ref.autoPlay,
|
|
10848
|
+
autoPlay = _ref$autoPlay === void 0 ? false : _ref$autoPlay,
|
|
10849
|
+
_ref$autoPlayInterval = _ref.autoPlayInterval,
|
|
10850
|
+
autoPlayInterval = _ref$autoPlayInterval === void 0 ? 3000 : _ref$autoPlayInterval;
|
|
10851
|
+
var _useState = useState(0),
|
|
10852
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
10853
|
+
currentIndex = _useState2[0],
|
|
10854
|
+
setCurrentIndex = _useState2[1];
|
|
10855
|
+
var theme = useTheme();
|
|
10856
|
+
var _useState3 = useState(0),
|
|
10857
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
10858
|
+
flatListWidth = _useState4[0],
|
|
10859
|
+
setFlatListWidth = _useState4[1];
|
|
10860
|
+
var itemWidth = flatListWidth * ITEM_WIDTH_RATE;
|
|
10861
|
+
var carouselRef = useRef(null);
|
|
10862
|
+
var _snapToIndex = useCallback(function (index) {
|
|
10863
|
+
var _carouselRef$current;
|
|
10864
|
+
var validIndex = 0;
|
|
10865
|
+
if (index < 0) {
|
|
10866
|
+
validIndex = 0;
|
|
10867
|
+
} else if (index >= items.length) {
|
|
10868
|
+
validIndex = items.length - 1;
|
|
10869
|
+
} else {
|
|
10870
|
+
validIndex = index;
|
|
10871
|
+
}
|
|
10872
|
+
(_carouselRef$current = carouselRef.current) === null || _carouselRef$current === void 0 ? void 0 : _carouselRef$current.scrollToIndex({
|
|
10873
|
+
index: validIndex,
|
|
10874
|
+
animated: true,
|
|
10875
|
+
viewPosition: VIEW_POSITION_CENTER
|
|
10876
|
+
});
|
|
10877
|
+
}, [carouselRef, itemWidth]);
|
|
10878
|
+
/*
|
|
10879
|
+
* snap to the next index. If the curent index is the last one, snap to the first one.
|
|
10880
|
+
*/
|
|
10881
|
+
var snapToNext = useCallback(function () {
|
|
10882
|
+
var _carouselRef$current2;
|
|
10883
|
+
var nextIndex = currentIndex + 1;
|
|
10884
|
+
if (nextIndex >= items.length) {
|
|
10885
|
+
nextIndex = 0;
|
|
10886
|
+
}
|
|
10887
|
+
(_carouselRef$current2 = carouselRef.current) === null || _carouselRef$current2 === void 0 ? void 0 : _carouselRef$current2.scrollToIndex({
|
|
10888
|
+
index: nextIndex,
|
|
10889
|
+
animated: true,
|
|
10890
|
+
viewPosition: VIEW_POSITION_CENTER
|
|
10891
|
+
});
|
|
10892
|
+
}, [carouselRef, currentIndex, itemWidth, items.length]);
|
|
10893
|
+
React.useImperativeHandle(ref, function () {
|
|
10894
|
+
return {
|
|
10895
|
+
snapToIndex: function snapToIndex(index) {
|
|
10896
|
+
_snapToIndex(index);
|
|
10897
|
+
},
|
|
10898
|
+
// we don't expose this method, it's for testing https://medium.com/developer-rants/how-to-test-useref-without-mocking-useref-699165f4994e
|
|
10899
|
+
getFlatListRef: function getFlatListRef() {
|
|
10900
|
+
return carouselRef.current;
|
|
10901
|
+
}
|
|
10902
|
+
};
|
|
10903
|
+
}, [_snapToIndex]);
|
|
10904
|
+
useEffect(function () {
|
|
10905
|
+
var timer;
|
|
10906
|
+
if (autoPlay) {
|
|
10907
|
+
timer = setInterval(function () {
|
|
10908
|
+
snapToNext();
|
|
10909
|
+
}, autoPlayInterval);
|
|
10910
|
+
}
|
|
10911
|
+
return function () {
|
|
10912
|
+
clearInterval(timer);
|
|
10913
|
+
};
|
|
10914
|
+
}, [autoPlay, snapToNext, currentIndex, autoPlayInterval]);
|
|
10915
|
+
var visibleSlideChanged = useCallback(function (_ref2) {
|
|
10916
|
+
var viewableItems = _ref2.viewableItems;
|
|
10917
|
+
if (!viewableItems || viewableItems && !viewableItems.length) return;
|
|
10918
|
+
var index = viewableItems[0].index;
|
|
10919
|
+
setCurrentIndex(index);
|
|
10920
|
+
if (onItemIndexChange) {
|
|
10921
|
+
onItemIndexChange(index);
|
|
10922
|
+
}
|
|
10923
|
+
}, [onItemIndexChange]);
|
|
10924
|
+
var getItemLayout = useCallback(function (_, index) {
|
|
10925
|
+
return {
|
|
10926
|
+
length: itemWidth,
|
|
10927
|
+
offset: itemWidth * index,
|
|
10928
|
+
index: index
|
|
10929
|
+
};
|
|
10930
|
+
}, [itemWidth]);
|
|
10931
|
+
var onLayout = useCallback(function (e) {
|
|
10932
|
+
setFlatListWidth(e.nativeEvent.layout.width);
|
|
10933
|
+
}, [setFlatListWidth]);
|
|
10934
|
+
var renderItem = useCallback(function (_ref3) {
|
|
10935
|
+
var item = _ref3.item;
|
|
10936
|
+
return /*#__PURE__*/React.createElement(StyledItemWrapper, {
|
|
10937
|
+
style: {
|
|
10938
|
+
width: itemWidth
|
|
10939
|
+
}
|
|
10940
|
+
}, /*#__PURE__*/React.createElement(StyledShadow, null, /*#__PURE__*/React.createElement(StyledCard, null, item)));
|
|
10941
|
+
}, [itemWidth]);
|
|
10942
|
+
return /*#__PURE__*/React.createElement(StyledWrapper$7, {
|
|
10943
|
+
style: style,
|
|
10944
|
+
testID: testID
|
|
10945
|
+
}, /*#__PURE__*/React.createElement(FlatList, {
|
|
10946
|
+
contentContainerStyle: {
|
|
10947
|
+
paddingHorizontal: theme.__hd__.cardCarousel.space.contentContainerPaddingHorizontal
|
|
10948
|
+
},
|
|
10949
|
+
onLayout: onLayout,
|
|
10950
|
+
data: items,
|
|
10951
|
+
horizontal: true,
|
|
10952
|
+
showsHorizontalScrollIndicator: false,
|
|
10953
|
+
pagingEnabled: true,
|
|
10954
|
+
bounces: false,
|
|
10955
|
+
scrollEventThrottle: 32,
|
|
10956
|
+
snapToAlignment: "center",
|
|
10957
|
+
getItemLayout: getItemLayout,
|
|
10958
|
+
ref: carouselRef,
|
|
10959
|
+
renderItem: renderItem,
|
|
10960
|
+
keyExtractor: function keyExtractor(_, index) {
|
|
10961
|
+
return "".concat(index);
|
|
10962
|
+
},
|
|
10963
|
+
decelerationRate: "fast",
|
|
10964
|
+
renderToHardwareTextureAndroid: true,
|
|
10965
|
+
snapToInterval: itemWidth + theme.__hd__.cardCarousel.space.carouselItemSpacing,
|
|
10966
|
+
onViewableItemsChanged: visibleSlideChanged,
|
|
10967
|
+
viewabilityConfig: {
|
|
10968
|
+
itemVisiblePercentThreshold: 80
|
|
10969
|
+
}
|
|
10970
|
+
}), !hidePageControl && /*#__PURE__*/React.createElement(StyledPageControl, {
|
|
10971
|
+
testID: "pageControl",
|
|
10972
|
+
currentPage: currentIndex,
|
|
10973
|
+
numberOfPages: items.length
|
|
10974
|
+
}));
|
|
10975
|
+
});
|
|
10976
|
+
|
|
10977
|
+
var _excluded$b = ["items", "onItemIndexChange", "renderActions", "selectedItemIndex", "style", "shouldShowPagination"];
|
|
10715
10978
|
function useStateFromProp(initialValue) {
|
|
10716
10979
|
var _useState = useState(initialValue),
|
|
10717
10980
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -10733,7 +10996,7 @@ var Carousel = function Carousel(_ref) {
|
|
|
10733
10996
|
shouldShowPagination = _ref$shouldShowPagina === void 0 ? function () {
|
|
10734
10997
|
return true;
|
|
10735
10998
|
} : _ref$shouldShowPagina,
|
|
10736
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$
|
|
10999
|
+
nativeProps = _objectWithoutProperties(_ref, _excluded$b);
|
|
10737
11000
|
var carouselRef = useRef(null);
|
|
10738
11001
|
var _useStateFromProp = useStateFromProp(selectedItemIndex),
|
|
10739
11002
|
_useStateFromProp2 = _slicedToArray(_useStateFromProp, 2),
|
|
@@ -10809,64 +11072,13 @@ var Carousel = function Carousel(_ref) {
|
|
|
10809
11072
|
width: width
|
|
10810
11073
|
});
|
|
10811
11074
|
}
|
|
10812
|
-
}), /*#__PURE__*/React.createElement(StyledCarouselFooterWrapper, null, renderActions && renderActions(currentSlideIndex), shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React.createElement(StyledPageControl, {
|
|
11075
|
+
}), /*#__PURE__*/React.createElement(StyledCarouselFooterWrapper, null, renderActions && renderActions(currentSlideIndex), shouldShowPagination(currentSlideIndex) && /*#__PURE__*/React.createElement(StyledPageControl$1, {
|
|
10813
11076
|
numberOfPages: items.length,
|
|
10814
11077
|
currentPage: currentSlideIndex
|
|
10815
11078
|
}))));
|
|
10816
11079
|
};
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
var theme = _ref.theme;
|
|
10820
|
-
return {
|
|
10821
|
-
borderRadius: theme.__hd__.card.radii["default"],
|
|
10822
|
-
overflow: 'hidden',
|
|
10823
|
-
flexDirection: 'row'
|
|
10824
|
-
};
|
|
10825
|
-
});
|
|
10826
|
-
var Indicator = index$a(View)(function (_ref2) {
|
|
10827
|
-
var theme = _ref2.theme,
|
|
10828
|
-
themeIntent = _ref2.themeIntent;
|
|
10829
|
-
return {
|
|
10830
|
-
backgroundColor: theme.__hd__.card.colors[themeIntent],
|
|
10831
|
-
width: theme.__hd__.card.sizes.indicatorWidth,
|
|
10832
|
-
height: '100%'
|
|
10833
|
-
};
|
|
10834
|
-
});
|
|
10835
|
-
|
|
10836
|
-
var _excluded$c = ["intent", "children"];
|
|
10837
|
-
var DataCard = function DataCard(_ref) {
|
|
10838
|
-
var _ref$intent = _ref.intent,
|
|
10839
|
-
intent = _ref$intent === void 0 ? 'info' : _ref$intent,
|
|
10840
|
-
children = _ref.children,
|
|
10841
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$c);
|
|
10842
|
-
return /*#__PURE__*/React.createElement(StyledDataCard, nativeProps, /*#__PURE__*/React.createElement(Indicator, {
|
|
10843
|
-
themeIntent: intent,
|
|
10844
|
-
testID: "data-card-indicator"
|
|
10845
|
-
}), children);
|
|
10846
|
-
};
|
|
10847
|
-
|
|
10848
|
-
var StyledCard = index$a(View)(function (_ref) {
|
|
10849
|
-
var theme = _ref.theme,
|
|
10850
|
-
themeIntent = _ref.themeIntent;
|
|
10851
|
-
return _objectSpread2(_objectSpread2({}, themeIntent !== undefined && {
|
|
10852
|
-
backgroundColor: theme.__hd__.card.colors[themeIntent]
|
|
10853
|
-
}), {}, {
|
|
10854
|
-
borderRadius: theme.__hd__.card.radii["default"],
|
|
10855
|
-
overflow: 'hidden'
|
|
10856
|
-
});
|
|
10857
|
-
});
|
|
10858
|
-
|
|
10859
|
-
var _excluded$b = ["intent", "children"];
|
|
10860
|
-
var Card = function Card(_ref) {
|
|
10861
|
-
var intent = _ref.intent,
|
|
10862
|
-
children = _ref.children,
|
|
10863
|
-
nativeProps = _objectWithoutProperties(_ref, _excluded$b);
|
|
10864
|
-
return /*#__PURE__*/React.createElement(StyledCard, _extends$1({}, nativeProps, {
|
|
10865
|
-
themeIntent: intent
|
|
10866
|
-
}), children);
|
|
10867
|
-
};
|
|
10868
|
-
var index$8 = Object.assign(Card, {
|
|
10869
|
-
Data: DataCard
|
|
11080
|
+
var index$8 = Object.assign(Carousel, {
|
|
11081
|
+
Card: CardCarousel
|
|
10870
11082
|
});
|
|
10871
11083
|
|
|
10872
11084
|
var StyledWrapper$6 = index$a(TouchableOpacity)(function (_ref) {
|
|
@@ -10991,9 +11203,9 @@ var StyledLabelInsideTextInput = index$a(Typography.Text)(function (_ref5) {
|
|
|
10991
11203
|
textAlignVertical: 'center',
|
|
10992
11204
|
alignContent: 'center',
|
|
10993
11205
|
fontSize: theme.__hd__.textInput.fontSizes.labelInsideTextInput,
|
|
10994
|
-
lineHeight: theme.__hd__.textInput.lineHeights.labelInsideTextInput,
|
|
10995
11206
|
alignItems: 'center',
|
|
10996
|
-
color: theme.__hd__.textInput.colors.labelsInsideTextInput[themeVariant]
|
|
11207
|
+
color: theme.__hd__.textInput.colors.labelsInsideTextInput[themeVariant],
|
|
11208
|
+
marginTop: theme.__hd__.textInput.space.labelInsideTextInputMarginTop
|
|
10997
11209
|
};
|
|
10998
11210
|
});
|
|
10999
11211
|
var StyledAsteriskLabelInsideTextInput = index$a(Typography.Text)(function (_ref6) {
|
|
@@ -11046,7 +11258,6 @@ var StyledTextInput = index$a(TextInput$1)(function (_ref11) {
|
|
|
11046
11258
|
return {
|
|
11047
11259
|
textAlignVertical: 'center',
|
|
11048
11260
|
fontSize: theme.__hd__.textInput.fontSizes.text,
|
|
11049
|
-
lineHeight: theme.__hd__.textInput.lineHeights.text,
|
|
11050
11261
|
alignSelf: 'stretch',
|
|
11051
11262
|
flexGrow: 2,
|
|
11052
11263
|
marginHorizontal: theme.__hd__.textInput.space.inputHorizontalMargin,
|
|
@@ -31329,4 +31540,4 @@ var index = Object.assign(RichTextEditor$1, {
|
|
|
31329
31540
|
Toolbar: EditorToolbar
|
|
31330
31541
|
});
|
|
31331
31542
|
|
|
31332
|
-
export { Accordion, Alert, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar,
|
|
31543
|
+
export { Accordion, Alert, Attachment, index$9 as Avatar, Badge$1 as Badge, BottomNavigation, BottomSheet$1 as BottomSheet, Box, CompoundButton as Button, Calendar, Card$1 as Card, index$8 as Carousel, Checkbox, Collapse, ContentNavigator, DatePicker, Divider, index$7 as Drawer, Empty, index$6 as FAB, Icon, Image, List, PageControl, PinInput, Progress, CompoundRadio as Radio, RefreshControl, index as RichTextEditor, SectionHeading, index$4 as Select, Slider, Spinner, index$5 as Swipeable, index$3 as Switch, index$2 as Tabs, Tag, TextInput, ThemeProvider, ThemeSwitcher, TimePicker, Toast, index$1 as Toolbar, Typography, eBensSystemPalette, getTheme$1 as getTheme, jobsSystemPalette, scale, swagSystemPalette, defaultTheme as theme, useAvatarColors, useTheme, walletSystemPalette, workSystemPalette };
|