@lookiero/checkout 3.9.0-beta.0 → 3.9.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/dist/infrastructure/domain/checkout/react/useStartCheckout.js +1 -1
- package/dist/infrastructure/projection/checkout/checkout.js +0 -14
- package/dist/infrastructure/projection/payment/react/useViewPaymentFlowPayloadByCheckoutId.js +1 -1
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/DummyLayout.js +5 -7
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/CheckoutQuestion.js +1 -1
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/CheckoutQuestionItem.d.ts +1 -0
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/buttonCheckoutQuestionItem/ButtonCheckoutQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/iconCheckoutQuestionItem/IconCheckoutQuestionItem.js +3 -3
- package/dist/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +1 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +1 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +2 -2
- package/dist/infrastructure/ui/components/templates/header/Header.style.d.ts +0 -1
- package/dist/infrastructure/ui/components/templates/header/Header.style.js +1 -3
- package/dist/infrastructure/ui/hooks/useSubmitCheckout.js +0 -5
- package/dist/infrastructure/ui/views/feedback/components/checkoutQuestionsForm/CheckoutQuestionsForm.js +1 -1
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +6 -4
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +10 -3
- package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +10 -3
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +4 -3
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.style.js +6 -3
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.d.ts +1 -2
- package/dist/infrastructure/ui/views/item/components/productVariantDescription/ProductVariantDescription.style.js +3 -4
- package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.js +15 -9
- package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.style.d.ts +0 -3
- package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.style.js +0 -3
- package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.style.d.ts +1 -0
- package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.style.js +1 -0
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -2
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +3 -0
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +3 -0
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +4 -3
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.d.ts +10 -3
- package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.js +10 -3
- package/dist/infrastructure/ui/views/item/views/productVariant/ProductVariant.js +1 -2
- package/dist/infrastructure/ui/views/item/views/productVariant/ProductVariant.style.d.ts +4 -0
- package/dist/infrastructure/ui/views/item/views/productVariant/ProductVariant.style.js +4 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +8 -7
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.d.ts +6 -0
- package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.js +6 -0
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.js +4 -3
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.d.ts +10 -3
- package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.js +10 -3
- package/dist/shared/ui/components/atoms/input/Input.js +2 -2
- package/dist/shared/ui/components/layouts/modal/Modal.js +1 -1
- package/dist/shared/ui/components/layouts/slider/Slider.d.ts +5 -0
- package/dist/shared/ui/components/layouts/slider/Slider.js +4 -4
- package/dist/shared/ui/components/layouts/sticky/Sticky.js +3 -1
- package/dist/shared/ui/components/layouts/sticky/Sticky.style.d.ts +0 -3
- package/dist/shared/ui/components/layouts/sticky/Sticky.style.js +2 -3
- package/dist/shared/ui/components/molecules/selectField/SelectField.js +3 -3
- package/package.json +4 -10
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef.d.ts +0 -15
- package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef.js +0 -14
- package/dist/shared/ui/components/layouts/carousel/Carousel.d.ts +0 -11
- package/dist/shared/ui/components/layouts/carousel/Carousel.js +0 -31
- package/dist/shared/ui/components/layouts/carousel/Carousel.style.d.ts +0 -24
- package/dist/shared/ui/components/layouts/carousel/Carousel.style.js +0 -25
- package/dist/shared/ui/components/layouts/carousel/Carousel2.d.ts +0 -30
- package/dist/shared/ui/components/layouts/carousel/Carousel2.js +0 -79
- package/dist/shared/ui/components/layouts/carousel/DragComponent.d.ts +0 -3
- package/dist/shared/ui/components/layouts/carousel/DragComponent.js +0 -48
- package/dist/shared/ui/components/layouts/slider/Bullets.d.ts +0 -10
- package/dist/shared/ui/components/layouts/slider/Bullets.js +0 -28
- package/dist/shared/ui/components/layouts/slider/Bullets.style.d.ts +0 -12
- package/dist/shared/ui/components/layouts/slider/Bullets.style.js +0 -15
- package/dist/shared/ui/components/layouts/slider/Bullets2.d.ts +0 -10
- package/dist/shared/ui/components/layouts/slider/Bullets2.js +0 -30
- package/dist/shared/ui/components/layouts/slider/SliderDots.d.ts +0 -8
- package/dist/shared/ui/components/layouts/slider/SliderDots.js +0 -16
- package/dist/shared/ui/components/layouts/slider/SliderDots.style.d.ts +0 -12
- package/dist/shared/ui/components/layouts/slider/SliderDots.style.js +0 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Button, Text } from "@lookiero/aurora";
|
|
1
|
+
import { ALIGN, Button, Text } from "@lookiero/aurora";
|
|
2
2
|
import { useI18nMessage } from "@lookiero/i18n-react";
|
|
3
3
|
import { animated, useSpring } from "@react-spring/native";
|
|
4
4
|
import React from "react";
|
|
@@ -30,17 +30,18 @@ const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPe
|
|
|
30
30
|
const feeText = useI18nMessage({ id: I18nMessages.SUMMARY_FEE });
|
|
31
31
|
const collapsedStyle = useSpring({ opacitiy: collapsed ? 1 : 0 });
|
|
32
32
|
const notCollapsedStyle = useSpring({ opacitiy: collapsed ? 0 : 1 });
|
|
33
|
-
return (React.createElement(
|
|
34
|
-
collapsible && (React.createElement(
|
|
33
|
+
return (React.createElement(React.Fragment, null,
|
|
34
|
+
collapsible && (React.createElement(Pressable, { style: style.iconContainer, testID: "pricing-collapsed", onPress: onPress }, collapsed ? (React.createElement(ArrowUp, { stroke: colorGrayscaleS, style: style.icon, testID: "arrow-up" })) : (React.createElement(ArrowDown, { stroke: colorGrayscaleS, style: style.icon, testID: "arrow-down" })))),
|
|
35
35
|
collapsed && collapsible ? (React.createElement(animated.View, { style: [style.collapsed, { opacity: collapsedStyle.opacitiy }] },
|
|
36
|
-
React.createElement(View,
|
|
36
|
+
React.createElement(View, { style: style.collapsedContent },
|
|
37
37
|
React.createElement(Text, { level: 1, style: style.totalCollapsed, detail: true },
|
|
38
38
|
totalText,
|
|
39
39
|
" ",
|
|
40
40
|
totalCheckoutItemsKeptText),
|
|
41
41
|
React.createElement(Price, { price: pendingToPay, variant: "detail" })),
|
|
42
|
-
React.createElement(View,
|
|
43
|
-
React.createElement(Button, { busy: busy, small: true, onPress: onSubmit },
|
|
42
|
+
React.createElement(View, { style: style.collapsedContent },
|
|
43
|
+
React.createElement(Button, { busy: busy, testID: "confirm-checkout-collpased-button", small: true, onPress: onSubmit },
|
|
44
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, submitButtonText))))) : (React.createElement(animated.View, { style: { opacity: notCollapsedStyle.opacitiy } },
|
|
44
45
|
React.createElement(Row, { text: `${subtotalText} ${totalCheckoutItemsKeptText}` },
|
|
45
46
|
React.createElement(Price, { price: subtotal, variant: "subtotal" })),
|
|
46
47
|
discount && discount.amount !== 0 && (React.createElement(Row, { text: discountText },
|
|
@@ -51,6 +52,6 @@ const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPe
|
|
|
51
52
|
React.createElement(View, { style: style.divider }),
|
|
52
53
|
React.createElement(Row, { level: 2, text: totalText },
|
|
53
54
|
React.createElement(Price, { price: pendingToPay, variant: "total" })),
|
|
54
|
-
React.createElement(Button, { busy: busy, onPress: onSubmit }, submitButtonText)))));
|
|
55
|
+
React.createElement(Button, { busy: busy, testID: "confirm-checkout-button", onPress: onSubmit }, submitButtonText)))));
|
|
55
56
|
};
|
|
56
57
|
export { Pricing };
|
|
@@ -2,10 +2,16 @@ import { StyleSheet } from "react-native";
|
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
3
|
const { colorContent, spaceXS, spaceL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
+
buttonText: {
|
|
6
|
+
width: "100%",
|
|
7
|
+
},
|
|
5
8
|
collapsed: {
|
|
6
9
|
flexDirection: "row",
|
|
7
10
|
justifyContent: "space-between",
|
|
8
11
|
},
|
|
12
|
+
collapsedContent: {
|
|
13
|
+
flex: 1,
|
|
14
|
+
},
|
|
9
15
|
divider: {
|
|
10
16
|
backgroundColor: colorContent,
|
|
11
17
|
height: 1,
|
|
@@ -24,8 +24,9 @@ const ModalNotificationItem = ({ visible, notification, onRemove, testID = "moda
|
|
|
24
24
|
}, [notification.id, onRemove]);
|
|
25
25
|
return (React.createElement(Modal, { testID: testID, visible: visible, onClose: handleOnClose },
|
|
26
26
|
React.createElement(View, { style: style.modal },
|
|
27
|
-
React.createElement(Text, { align: ALIGN.CENTER, level: 1 }, titleText),
|
|
28
|
-
React.createElement(Text, { level: 3, style: style.
|
|
29
|
-
React.createElement(Button, { style: style.button, onPress: handleOnClose },
|
|
27
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 1, style: style.title }, titleText),
|
|
28
|
+
React.createElement(Text, { level: 3, style: style.description }, bodyText),
|
|
29
|
+
React.createElement(Button, { style: style.button, testID: "modal-notification-button", onPress: handleOnClose },
|
|
30
|
+
React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, acceptText)))));
|
|
30
31
|
};
|
|
31
32
|
export { ModalNotificationItem };
|
|
@@ -2,12 +2,19 @@ declare const style: {
|
|
|
2
2
|
button: {
|
|
3
3
|
flex: number;
|
|
4
4
|
};
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
buttonText: {
|
|
6
|
+
width: string;
|
|
7
7
|
};
|
|
8
|
-
|
|
8
|
+
description: {
|
|
9
9
|
marginVertical: number;
|
|
10
10
|
textAlign: "center";
|
|
11
|
+
width: string;
|
|
12
|
+
};
|
|
13
|
+
modal: {
|
|
14
|
+
padding: number;
|
|
15
|
+
};
|
|
16
|
+
title: {
|
|
17
|
+
width: string;
|
|
11
18
|
};
|
|
12
19
|
};
|
|
13
20
|
export { style };
|
|
@@ -5,12 +5,19 @@ const style = StyleSheet.create({
|
|
|
5
5
|
button: {
|
|
6
6
|
flex: 0,
|
|
7
7
|
},
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
buttonText: {
|
|
9
|
+
width: "100%",
|
|
10
10
|
},
|
|
11
|
-
|
|
11
|
+
description: {
|
|
12
12
|
marginVertical: spaceXL,
|
|
13
13
|
textAlign: "center",
|
|
14
|
+
width: "100%",
|
|
15
|
+
},
|
|
16
|
+
modal: {
|
|
17
|
+
padding: spaceXL,
|
|
18
|
+
},
|
|
19
|
+
title: {
|
|
20
|
+
width: "100%",
|
|
14
21
|
},
|
|
15
22
|
});
|
|
16
23
|
export { style };
|
|
@@ -6,7 +6,7 @@ const MIN_HEIGHT = 56;
|
|
|
6
6
|
const MAX_HEIGHT = 242; // 10 lines
|
|
7
7
|
const { colorGrayscaleL } = theme();
|
|
8
8
|
const clamp = (min, max, value) => Math.min(Math.max(min, value), max);
|
|
9
|
-
const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customStyle, placeholderTextColor = colorGrayscaleL, onChange, onContentSizeChange, value, multiline, ...restOfProps }) => {
|
|
9
|
+
const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customStyle, placeholderTextColor = colorGrayscaleL, onChange, onContentSizeChange, value, multiline, testID = "input", ...restOfProps }) => {
|
|
10
10
|
const [height, setHeight] = useState(minHeight);
|
|
11
11
|
// When content height has became smaller the onContentSizeChange does in fact triggered but the internal height is incorrect.
|
|
12
12
|
const handleOnContentSizeChange = useCallback((event) => {
|
|
@@ -32,6 +32,6 @@ const Input = ({ minHeight = MIN_HEIGHT, maxHeight = MAX_HEIGHT, style: customSt
|
|
|
32
32
|
}, [maxHeight, minHeight, multiline]);
|
|
33
33
|
useLayoutEffect(handleOnContentSizeChangeWeb, [handleOnContentSizeChangeWeb, value]);
|
|
34
34
|
const textInputRef = useRef(null);
|
|
35
|
-
return (React.createElement(TextInput, {
|
|
35
|
+
return (React.createElement(TextInput, { ref: textInputRef, accessibilityLabel: testID, multiline: multiline, numberOfLines: !!multiline ? undefined : 1, placeholderTextColor: placeholderTextColor, style: [style.input, customStyle, { height }], testID: testID, textAlignVertical: "top", value: value, accessible: true, onChange: onChange, onContentSizeChange: handleOnContentSizeChange, ...restOfProps }));
|
|
36
36
|
};
|
|
37
37
|
export { Input };
|
|
@@ -75,7 +75,7 @@ const Modal = ({ children, visible, header, footer, portalHostName, onClose, sho
|
|
|
75
75
|
(header || showCloseButton) && (React.createElement(View, { style: [style.header, customStyle?.header] },
|
|
76
76
|
React.createElement(View, null, header),
|
|
77
77
|
showCloseButton && (React.createElement(ButtonIcon, { name: "close", style: { button: customStyle?.closeButton }, onPress: onClose })))),
|
|
78
|
-
React.createElement(ModalContentView,
|
|
78
|
+
React.createElement(ModalContentView, { keyboardShouldPersistTaps: "handled" },
|
|
79
79
|
React.createElement(View, { style: {
|
|
80
80
|
paddingBottom: safeAreaInsetBottom +
|
|
81
81
|
(Platform.OS !== "ios" ? spaceXL : 0) +
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FC, ReactNode } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
2
3
|
interface SliderProps {
|
|
3
4
|
readonly children: ReactNode[];
|
|
4
5
|
readonly active?: number;
|
|
@@ -7,9 +8,13 @@ interface SliderProps {
|
|
|
7
8
|
readonly minDistanceForAction?: number;
|
|
8
9
|
readonly gesturesEnabled?: boolean;
|
|
9
10
|
readonly paginationEnabled?: boolean;
|
|
11
|
+
readonly paginationStyle?: StyleProp<ViewStyle>;
|
|
12
|
+
readonly paginationItemStyle?: StyleProp<ViewStyle>;
|
|
13
|
+
readonly paginationActiveItemStyle?: StyleProp<ViewStyle>;
|
|
10
14
|
readonly onSliderStart?: () => void;
|
|
11
15
|
readonly onSliderEnd?: () => void;
|
|
12
16
|
readonly onChanged?: (index: number) => void;
|
|
17
|
+
readonly paginationRenderItem?: (index: number) => ReactNode;
|
|
13
18
|
}
|
|
14
19
|
declare const Slider: FC<SliderProps>;
|
|
15
20
|
export { Slider };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
-
import { Animated, I18nManager, PanResponder, StyleSheet, View } from "react-native";
|
|
3
|
-
import {
|
|
2
|
+
import { Animated, I18nManager, PanResponder, StyleSheet, View, } from "react-native";
|
|
3
|
+
import { Pagination } from "./Pagination";
|
|
4
4
|
import { style } from "./Slider.style";
|
|
5
5
|
const DEFAULT_WIDTH = 200;
|
|
6
|
-
const Slider = ({ children, active = 0, loop = false, minDistanceToCapture = 5, minDistanceForAction = 0.2, gesturesEnabled = true, paginationEnabled = true, onSliderStart, onSliderEnd, onChanged, }) => {
|
|
6
|
+
const Slider = ({ children, active = 0, loop = false, minDistanceToCapture = 5, minDistanceForAction = 0.2, gesturesEnabled = true, paginationEnabled = true, paginationStyle, paginationItemStyle, paginationActiveItemStyle, onSliderStart, onSliderEnd, onChanged, paginationRenderItem, }) => {
|
|
7
7
|
const flatennedChildren = children.flat();
|
|
8
8
|
const count = flatennedChildren.length;
|
|
9
9
|
const [width, setWidth] = useState(0);
|
|
@@ -127,6 +127,6 @@ const Slider = ({ children, active = 0, loop = false, minDistanceToCapture = 5,
|
|
|
127
127
|
},
|
|
128
128
|
style.sliderAreaStyle,
|
|
129
129
|
]), ...panResponder.panHandlers }, flatennedChildren.map((child, index) => (React.createElement(View, { key: index, style: { width }, testID: "slider-child" }, child)))),
|
|
130
|
-
paginationEnabled && (React.createElement(
|
|
130
|
+
paginationEnabled && (React.createElement(Pagination, { activeIndex: getActiveIndex(), count: count, paginationActiveItemStyle: paginationActiveItemStyle, paginationItemStyle: paginationItemStyle, paginationStyle: paginationStyle, renderItem: paginationRenderItem, onChange: (index) => goTo(index) }))));
|
|
131
131
|
};
|
|
132
132
|
export { Slider };
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import React, { useCallback } from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
+
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
3
4
|
import { style } from "./Sticky.style";
|
|
5
|
+
const { spaceXL } = theme();
|
|
4
6
|
const Sticky = ({ children, style: customStyle, onLayout }) => {
|
|
5
7
|
const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => onLayout?.({ width, height }), [onLayout]);
|
|
6
|
-
return (React.createElement(View, { style: [style.sticky, customStyle], onLayout: handleOnLayout }, children));
|
|
8
|
+
return (React.createElement(View, { style: [style.sticky, { paddingBottom: spaceXL }, customStyle], onLayout: handleOnLayout }, children));
|
|
7
9
|
};
|
|
8
10
|
export { Sticky };
|
|
@@ -5,7 +5,6 @@ declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
|
5
5
|
backgroundColor: string;
|
|
6
6
|
bottom: number;
|
|
7
7
|
elevation: number;
|
|
8
|
-
paddingBottom: number;
|
|
9
8
|
paddingTop: number;
|
|
10
9
|
shadowColor: string;
|
|
11
10
|
shadowOffset: {
|
|
@@ -21,7 +20,6 @@ declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
|
21
20
|
backgroundColor: string;
|
|
22
21
|
bottom: number;
|
|
23
22
|
elevation: number;
|
|
24
|
-
paddingBottom: number;
|
|
25
23
|
paddingTop: number;
|
|
26
24
|
shadowColor: string;
|
|
27
25
|
shadowOffset: {
|
|
@@ -37,7 +35,6 @@ declare const style: StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
|
|
|
37
35
|
backgroundColor: string;
|
|
38
36
|
bottom: number;
|
|
39
37
|
elevation: number;
|
|
40
|
-
paddingBottom: number;
|
|
41
38
|
paddingTop: number;
|
|
42
39
|
shadowColor: string;
|
|
43
40
|
shadowOffset: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Platform, StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../../infrastructure/ui/theme/theme";
|
|
3
|
-
const { colorBase, elevationColor, elevationLayerL, elevationOffset, elevationOpacityM, elevationRadius,
|
|
3
|
+
const { colorBase, elevationColor, elevationLayerL, elevationOffset, elevationOpacityM, elevationRadius, spaceXL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
6
|
// @ts-ignore
|
|
@@ -8,8 +8,7 @@ const style = StyleSheet.create({
|
|
|
8
8
|
backgroundColor: colorBase,
|
|
9
9
|
bottom: 0,
|
|
10
10
|
elevation: elevationLayerL,
|
|
11
|
-
|
|
12
|
-
paddingTop: spaceM,
|
|
11
|
+
paddingTop: spaceXL,
|
|
13
12
|
shadowColor: elevationColor,
|
|
14
13
|
shadowOffset: elevationOffset,
|
|
15
14
|
shadowOpacity: elevationOpacityM,
|
|
@@ -6,7 +6,7 @@ import { Modal } from "../../layouts/modal/Modal";
|
|
|
6
6
|
import { InputField } from "../inputField/InputField";
|
|
7
7
|
import { style } from "./SelectField.style";
|
|
8
8
|
const { colorGrayscaleS } = theme();
|
|
9
|
-
const SelectField = ({ title, placeholder, value, options, style: customStyle, onChange = () => void 0, ...touchableRestProps }) => {
|
|
9
|
+
const SelectField = ({ title, placeholder, value, options, style: customStyle, onChange = () => void 0, testID, ...touchableRestProps }) => {
|
|
10
10
|
const [modalVisible, setModalVisible] = useState(false);
|
|
11
11
|
const handleOnPressSelectField = useCallback(() => setModalVisible(true), []);
|
|
12
12
|
const handleOnModalClose = useCallback(() => setModalVisible(false), []);
|
|
@@ -16,13 +16,13 @@ const SelectField = ({ title, placeholder, value, options, style: customStyle, o
|
|
|
16
16
|
}, [handleOnModalClose, onChange]);
|
|
17
17
|
const selectedValue = useMemo(() => options.find((option) => option.value === value), [options, value]);
|
|
18
18
|
return (React.createElement(React.Fragment, null,
|
|
19
|
-
React.createElement(TouchableHighlight, { style: customStyle?.selectField, underlayColor: colorGrayscaleS, onPress: handleOnPressSelectField, ...touchableRestProps },
|
|
19
|
+
React.createElement(TouchableHighlight, { accessibilityLabel: testID, style: customStyle?.selectField, testID: testID, underlayColor: colorGrayscaleS, accessible: true, onPress: handleOnPressSelectField, ...touchableRestProps },
|
|
20
20
|
React.createElement(View, { pointerEvents: "none" },
|
|
21
21
|
React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholder, style: customStyle?.inputField, value: selectedValue?.label }))),
|
|
22
22
|
React.createElement(Modal, { testID: "select-field-modal", visible: modalVisible, scroll: true, showCloseButton: true, onClose: handleOnModalClose },
|
|
23
23
|
React.createElement(View, { style: [style.modalContent, customStyle?.modalContent] },
|
|
24
24
|
title && (React.createElement(Text, { level: 2, style: style.modalTitle }, title)),
|
|
25
|
-
options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue, disabled: value === optionValue, style: [style.option, customStyle?.option], underlayColor: colorGrayscaleS, onPress: value !== optionValue ? () => handleOnPressOption(optionValue) : undefined },
|
|
25
|
+
options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue, accessibilityLabel: optionValue, disabled: value === optionValue, style: [style.option, customStyle?.option], testID: optionValue, underlayColor: colorGrayscaleS, accessible: true, onPress: value !== optionValue ? () => handleOnPressOption(optionValue) : undefined },
|
|
26
26
|
React.createElement(Text, { color: value === optionValue ? COLOR.GRAYSCALE_M : COLOR.CONTENT, level: 3, style: [style.optionText, customStyle?.optionText] }, label))))))));
|
|
27
27
|
};
|
|
28
28
|
export { SelectField };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lookiero/checkout",
|
|
3
|
-
"version": "3.9.0
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@lookiero/data-sources": "^0.3",
|
|
50
50
|
"@lookiero/event": "^0.3",
|
|
51
51
|
"@lookiero/locale": "^0.3",
|
|
52
|
-
"@lookiero/payments-front": "^
|
|
52
|
+
"@lookiero/payments-front": "^4.1.3",
|
|
53
53
|
"@lookiero/user-tracking-front": "0.0.37",
|
|
54
54
|
"apollo-boost": "0.4.4",
|
|
55
55
|
"graphql": "16.6.0",
|
|
@@ -57,11 +57,8 @@
|
|
|
57
57
|
"react": "^18.2.0",
|
|
58
58
|
"react-dom": "^18.2.0",
|
|
59
59
|
"react-native": "^0.71.4",
|
|
60
|
-
"react-native-gesture-handler": "^2.12.0",
|
|
61
60
|
"react-native-get-random-values": "^1.8.0",
|
|
62
61
|
"react-native-web": "^0.18.11",
|
|
63
|
-
"react-native-reanimated": "^3.3.0",
|
|
64
|
-
"react-native-reanimated-carousel": "^3.4.0",
|
|
65
62
|
"react-router-dom": "^6.8.1",
|
|
66
63
|
"react-router-native": "^6.8.1"
|
|
67
64
|
},
|
|
@@ -74,14 +71,14 @@
|
|
|
74
71
|
"@lookiero/data-sources": "^0.3",
|
|
75
72
|
"@lookiero/event": "^0.3",
|
|
76
73
|
"@lookiero/locale": "^0.3",
|
|
77
|
-
"@lookiero/payments-front": "^
|
|
74
|
+
"@lookiero/payments-front": "^4.1.3",
|
|
78
75
|
"@lookiero/user-tracking-front": "0.0.37",
|
|
79
76
|
"@pact-foundation/pact": "^10.1.4",
|
|
80
77
|
"@pact-foundation/pact-node": "^10.17.6",
|
|
81
78
|
"@react-native-firebase/analytics": "10.5.1",
|
|
82
79
|
"@react-native-firebase/app": "10.5.0",
|
|
83
|
-
"@testing-library/jest-native": "^5.4.2",
|
|
84
80
|
"@testing-library/react-native": "^11.5.0",
|
|
81
|
+
"@testing-library/jest-native": "^5.4.2",
|
|
85
82
|
"@trivago/prettier-plugin-sort-imports": "^3.3.0",
|
|
86
83
|
"@types/jest": "^29.2.4",
|
|
87
84
|
"@types/pino-pretty": "^5.0.0",
|
|
@@ -119,11 +116,8 @@
|
|
|
119
116
|
"react-error-overlay": "^6.0.9",
|
|
120
117
|
"react-native": "^0.71.3",
|
|
121
118
|
"react-native-adjust": "^4.33.0",
|
|
122
|
-
"react-native-gesture-handler": "^2.12.0",
|
|
123
119
|
"react-native-get-random-values": "^1.8.0",
|
|
124
120
|
"react-native-web": "^0.18.11",
|
|
125
|
-
"react-native-reanimated": "^3.3.0",
|
|
126
|
-
"react-native-reanimated-carousel": "^3.4.0",
|
|
127
121
|
"react-router-dom": "^6.8.1",
|
|
128
122
|
"react-router-native": "^6.8.1",
|
|
129
123
|
"react-test-renderer": "^18.0.0",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FC, ReactNode, Ref } from "react";
|
|
2
|
-
import { GestureType, ScrollView } from "react-native-gesture-handler";
|
|
3
|
-
interface ContextShape {
|
|
4
|
-
readonly scrollViewRef: Ref<ScrollView>;
|
|
5
|
-
readonly panGestureRef: Ref<GestureType>;
|
|
6
|
-
}
|
|
7
|
-
interface ScrollViewRefContextProviderProps {
|
|
8
|
-
readonly children: ReactNode;
|
|
9
|
-
}
|
|
10
|
-
declare const ScrollViewRefContextProvider: FC<ScrollViewRefContextProviderProps>;
|
|
11
|
-
interface UseScrollViewRefFunction {
|
|
12
|
-
(): ContextShape;
|
|
13
|
-
}
|
|
14
|
-
declare const useScrollViewRef: UseScrollViewRefFunction;
|
|
15
|
-
export { useScrollViewRef, ScrollViewRefContextProvider };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React, { createContext, useContext, useRef } from "react";
|
|
2
|
-
import invariant from "tiny-invariant";
|
|
3
|
-
const ScrollViewRefContext = createContext(null);
|
|
4
|
-
const ScrollViewRefContextProvider = ({ children }) => {
|
|
5
|
-
const scrollViewRef = useRef(null);
|
|
6
|
-
const panGestureRef = useRef(null);
|
|
7
|
-
return (React.createElement(ScrollViewRefContext.Provider, { value: { scrollViewRef, panGestureRef } }, children));
|
|
8
|
-
};
|
|
9
|
-
const useScrollViewRef = () => {
|
|
10
|
-
const ref = useContext(ScrollViewRefContext);
|
|
11
|
-
invariant(ref, "Your are trying to use the useScrollViewRef hook without wrapping your app with the <ScrollViewRefContextProvider>.");
|
|
12
|
-
return ref;
|
|
13
|
-
};
|
|
14
|
-
export { useScrollViewRef, ScrollViewRefContextProvider };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { TCarouselProps } from "react-native-reanimated-carousel";
|
|
3
|
-
type CarouselRenderItem<T> = TCarouselProps<T>["renderItem"];
|
|
4
|
-
interface CarouselProps<T> {
|
|
5
|
-
readonly data: T[];
|
|
6
|
-
readonly children: CarouselRenderItem<T>;
|
|
7
|
-
readonly onActiveIndexChanged?: (index: number) => void;
|
|
8
|
-
}
|
|
9
|
-
declare const Carousel: <T>({ data, children, onActiveIndexChanged }: CarouselProps<T>) => JSX.Element;
|
|
10
|
-
export type { CarouselRenderItem };
|
|
11
|
-
export { Carousel };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useRef, useState } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
import { GestureHandlerRootView } from "react-native-gesture-handler";
|
|
4
|
-
import RNRCarousel from "react-native-reanimated-carousel";
|
|
5
|
-
import { Bullets } from "../slider/Bullets";
|
|
6
|
-
const Carousel = ({ data, children, onActiveIndexChanged }) => {
|
|
7
|
-
const [carouselDimensions, setCarouselDimensions] = useState();
|
|
8
|
-
const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => setCarouselDimensions({ width, height }), []);
|
|
9
|
-
const ref = React.useRef(null);
|
|
10
|
-
const [activeIndex, setActiveIndex] = useState(0);
|
|
11
|
-
const activeIndexRef = useRef(activeIndex);
|
|
12
|
-
activeIndexRef.current = activeIndex;
|
|
13
|
-
const handleOnActiveChanged = useCallback((index) => ref.current?.scrollTo({ index, animated: true }), []);
|
|
14
|
-
const handleOnProgressChanged = useCallback(
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
16
|
-
(_offsetProgress, absoluteProgress) => {
|
|
17
|
-
const index = Math.round(absoluteProgress);
|
|
18
|
-
if (activeIndexRef.current === index) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
setActiveIndex(index);
|
|
22
|
-
onActiveIndexChanged?.(index);
|
|
23
|
-
}, [onActiveIndexChanged]);
|
|
24
|
-
return (React.createElement(React.Fragment, null,
|
|
25
|
-
React.createElement(View, { style: { flex: 1 }, onLayout: handleOnLayout }, carouselDimensions && (React.createElement(GestureHandlerRootView, { style: { flex: 1 } },
|
|
26
|
-
React.createElement(RNRCarousel, { ref: ref, data: data, height: carouselDimensions.height, loop: false, renderItem: children, width: carouselDimensions.width, panGestureHandlerProps: {
|
|
27
|
-
activeOffsetX: [-10, 10],
|
|
28
|
-
}, onProgressChange: handleOnProgressChanged })))),
|
|
29
|
-
React.createElement(Bullets, { activeIndex: activeIndex, count: data.length, onChange: handleOnActiveChanged })));
|
|
30
|
-
};
|
|
31
|
-
export { Carousel };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
declare const style: {
|
|
2
|
-
bullets: {
|
|
3
|
-
bottom: number;
|
|
4
|
-
justifyContent: "center";
|
|
5
|
-
position: "absolute";
|
|
6
|
-
width: string;
|
|
7
|
-
};
|
|
8
|
-
carousel: {
|
|
9
|
-
flex: number;
|
|
10
|
-
};
|
|
11
|
-
carouselItem: {
|
|
12
|
-
flex: number;
|
|
13
|
-
};
|
|
14
|
-
carouselTrack: {
|
|
15
|
-
flex: number;
|
|
16
|
-
flexDirection: "row";
|
|
17
|
-
height: string;
|
|
18
|
-
};
|
|
19
|
-
container: {
|
|
20
|
-
flex: number;
|
|
21
|
-
overflow: "hidden";
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
export { style };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from "react-native";
|
|
2
|
-
const style = StyleSheet.create({
|
|
3
|
-
bullets: {
|
|
4
|
-
bottom: 0,
|
|
5
|
-
justifyContent: "center",
|
|
6
|
-
position: "absolute",
|
|
7
|
-
width: "100%",
|
|
8
|
-
},
|
|
9
|
-
carousel: {
|
|
10
|
-
flex: 1,
|
|
11
|
-
},
|
|
12
|
-
carouselItem: {
|
|
13
|
-
flex: 1,
|
|
14
|
-
},
|
|
15
|
-
carouselTrack: {
|
|
16
|
-
flex: 1,
|
|
17
|
-
flexDirection: "row",
|
|
18
|
-
height: "100%",
|
|
19
|
-
},
|
|
20
|
-
container: {
|
|
21
|
-
flex: 1,
|
|
22
|
-
overflow: "hidden",
|
|
23
|
-
},
|
|
24
|
-
});
|
|
25
|
-
export { style };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
-
interface RenderItemFunctionArgs<T> {
|
|
4
|
-
readonly item: T;
|
|
5
|
-
readonly index: number;
|
|
6
|
-
}
|
|
7
|
-
interface RenderItemFunction<T> {
|
|
8
|
-
(args: RenderItemFunctionArgs<T>): JSX.Element;
|
|
9
|
-
}
|
|
10
|
-
interface RenderBulletsFunctionArgs {
|
|
11
|
-
readonly activeIndex: number;
|
|
12
|
-
readonly count: number;
|
|
13
|
-
readonly onChange: (index: number) => void;
|
|
14
|
-
}
|
|
15
|
-
interface RenderBulletsFunction {
|
|
16
|
-
(args: RenderBulletsFunctionArgs): JSX.Element;
|
|
17
|
-
}
|
|
18
|
-
interface CarouselStyle {
|
|
19
|
-
readonly container?: StyleProp<ViewStyle>;
|
|
20
|
-
}
|
|
21
|
-
interface CarouselProps<T> {
|
|
22
|
-
readonly data: T[];
|
|
23
|
-
readonly children: RenderItemFunction<T>;
|
|
24
|
-
readonly bullets: RenderBulletsFunction;
|
|
25
|
-
readonly onActiveIndexChanged?: (index: number) => void;
|
|
26
|
-
readonly style?: CarouselStyle;
|
|
27
|
-
}
|
|
28
|
-
declare const Carousel2: <T>({ data, children, bullets, onActiveIndexChanged, style: customStyle }: CarouselProps<T>) => JSX.Element;
|
|
29
|
-
export type { RenderItemFunction, RenderBulletsFunction };
|
|
30
|
-
export { Carousel2 };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import React, { useCallback, useMemo, useRef, useState } from "react";
|
|
2
|
-
import { View } from "react-native";
|
|
3
|
-
import { Gesture, GestureDetector, GestureHandlerRootView } from "react-native-gesture-handler";
|
|
4
|
-
import Animated, { useSharedValue, withSpring, useAnimatedStyle, runOnJS } from "react-native-reanimated";
|
|
5
|
-
import { style } from "./Carousel.style";
|
|
6
|
-
const SPRING_CONFIG = {
|
|
7
|
-
damping: 25,
|
|
8
|
-
mass: 1,
|
|
9
|
-
stiffness: 300,
|
|
10
|
-
};
|
|
11
|
-
const clamp = (min, max, value) => {
|
|
12
|
-
"worklet";
|
|
13
|
-
return Math.min(max, Math.max(min, value));
|
|
14
|
-
};
|
|
15
|
-
const Carousel2 = ({ data, children, bullets, onActiveIndexChanged, style: customStyle }) => {
|
|
16
|
-
const [carouselDimensions, setCarouselDimensions] = useState({
|
|
17
|
-
width: 0,
|
|
18
|
-
height: 0,
|
|
19
|
-
});
|
|
20
|
-
const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => setCarouselDimensions({ width, height }), []);
|
|
21
|
-
const [activeIndex, setActiveIndex] = useState(0);
|
|
22
|
-
const activeIndexRef = useRef(activeIndex);
|
|
23
|
-
activeIndexRef.current = activeIndex;
|
|
24
|
-
const updateActiveIndex = useCallback((index) => {
|
|
25
|
-
if (activeIndexRef.current === index) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
setActiveIndex(index);
|
|
29
|
-
onActiveIndexChanged?.(index);
|
|
30
|
-
}, [onActiveIndexChanged]);
|
|
31
|
-
const panTranslationX = useSharedValue(0);
|
|
32
|
-
const panInitialTranslationX = useSharedValue(undefined);
|
|
33
|
-
const handleOnActiveIndexChanged = useCallback((index) => {
|
|
34
|
-
updateActiveIndex(index);
|
|
35
|
-
panTranslationX.value = withSpring(-index * carouselDimensions.width, SPRING_CONFIG);
|
|
36
|
-
}, [carouselDimensions.width, panTranslationX, updateActiveIndex]);
|
|
37
|
-
const panGesture = useMemo(() => Gesture.Pan()
|
|
38
|
-
.maxPointers(1)
|
|
39
|
-
.activeOffsetX([-20, 20])
|
|
40
|
-
// .failOffsetY([-20, 20])
|
|
41
|
-
// This method does not work if legacy implementation is enabled
|
|
42
|
-
// Expo.tsx => enableLegacyWebImplementation(true)
|
|
43
|
-
// .onStart(() => {
|
|
44
|
-
// panInitialTranslationX.value = panTranslationX.value;
|
|
45
|
-
// })
|
|
46
|
-
// This method is defined as legacy implementation is enabled
|
|
47
|
-
.onBegin(() => {
|
|
48
|
-
panInitialTranslationX.value = panTranslationX.value;
|
|
49
|
-
})
|
|
50
|
-
.onUpdate(({ translationX }) => {
|
|
51
|
-
if (panInitialTranslationX.value === undefined) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const tX = panInitialTranslationX.value + translationX;
|
|
55
|
-
const index = clamp(0, data.length - 1, Math.round(-tX / carouselDimensions.width));
|
|
56
|
-
panTranslationX.value = tX;
|
|
57
|
-
runOnJS(updateActiveIndex)(index);
|
|
58
|
-
})
|
|
59
|
-
.onEnd(({ translationX, velocityX }) => {
|
|
60
|
-
if (panInitialTranslationX.value === undefined) {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
const tX = panInitialTranslationX.value + translationX;
|
|
64
|
-
const indexDelta = Math.round(translationX / carouselDimensions.width);
|
|
65
|
-
const velocityIndex = Math.abs(indexDelta) > 0 ? 0 : clamp(-1, 1, Math.abs(velocityX) > 2 ? -velocityX : 0);
|
|
66
|
-
const index = clamp(0, data.length - 1, Math.round(-tX / carouselDimensions.width) + velocityIndex);
|
|
67
|
-
panTranslationX.value = withSpring(-index * carouselDimensions.width, SPRING_CONFIG);
|
|
68
|
-
panInitialTranslationX.value = undefined;
|
|
69
|
-
runOnJS(updateActiveIndex)(index);
|
|
70
|
-
}), [carouselDimensions.width, data.length, panInitialTranslationX, panTranslationX, updateActiveIndex]);
|
|
71
|
-
const animatedStyle = useAnimatedStyle(() => ({ transform: [{ translateX: panTranslationX.value }] }), [panTranslationX]);
|
|
72
|
-
return (React.createElement(View, { style: [style.container, customStyle?.container] },
|
|
73
|
-
React.createElement(View, { style: style.carousel, onLayout: handleOnLayout },
|
|
74
|
-
React.createElement(GestureHandlerRootView, { style: { flex: 1 } },
|
|
75
|
-
React.createElement(GestureDetector, { gesture: panGesture },
|
|
76
|
-
React.createElement(Animated.View, { style: [style.carouselTrack, { width: carouselDimensions.width * data.length }, animatedStyle] }, data.map((item, index) => (React.createElement(View, { key: index, style: [style.carouselItem, { width: carouselDimensions.width }] }, children({ index, item })))))))),
|
|
77
|
-
React.createElement(View, { style: style.bullets }, bullets({ activeIndex, count: data.length, onChange: handleOnActiveIndexChanged }))));
|
|
78
|
-
};
|
|
79
|
-
export { Carousel2 };
|