@lookiero/checkout 3.6.1 → 3.7.0-beta.100

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.
Files changed (41) hide show
  1. package/dist/infrastructure/projection/checkout/checkout.js +13 -0
  2. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef.d.ts +15 -0
  3. package/dist/infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef.js +14 -0
  4. package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.js +6 -4
  5. package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.d.ts +10 -3
  6. package/dist/infrastructure/ui/views/item/components/getOutOfCheckoutModal/GetOutOfCheckoutModal.style.js +10 -3
  7. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.js +3 -2
  8. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.style.d.ts +3 -0
  9. package/dist/infrastructure/ui/views/item/components/itemActions/ItemActions.style.js +3 -0
  10. package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.style.d.ts +1 -0
  11. package/dist/infrastructure/ui/views/item/components/returnQuestionsFeedback/ReturnQuestionsFeedback.style.js +1 -0
  12. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +3 -2
  13. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +3 -0
  14. package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +3 -0
  15. package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.js +4 -3
  16. package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.d.ts +10 -3
  17. package/dist/infrastructure/ui/views/item/components/sizeWithoutStockModal/SizeWithoutStockModal.style.js +10 -3
  18. package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.js +5 -4
  19. package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.d.ts +6 -0
  20. package/dist/infrastructure/ui/views/summary/components/pricing/Pricing.style.js +6 -0
  21. package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.js +4 -3
  22. package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.d.ts +10 -3
  23. package/dist/shared/notifications/infrastructure/ui/components/modalNotifications/ModalNotificationItem.style.js +10 -3
  24. package/dist/shared/ui/components/layouts/carousel/Carousel.d.ts +11 -0
  25. package/dist/shared/ui/components/layouts/carousel/Carousel.js +31 -0
  26. package/dist/shared/ui/components/layouts/carousel/Carousel.style.d.ts +17 -0
  27. package/dist/shared/ui/components/layouts/carousel/Carousel.style.js +7 -0
  28. package/dist/shared/ui/components/layouts/carousel/Carousel2.d.ts +16 -0
  29. package/dist/shared/ui/components/layouts/carousel/Carousel2.js +72 -0
  30. package/dist/shared/ui/components/layouts/carousel/DragComponent.d.ts +3 -0
  31. package/dist/shared/ui/components/layouts/carousel/DragComponent.js +48 -0
  32. package/dist/shared/ui/components/layouts/slider/Bullets.js +1 -1
  33. package/dist/shared/ui/components/layouts/slider/Pagination.d.ts +14 -0
  34. package/dist/shared/ui/components/layouts/slider/Pagination.js +11 -0
  35. package/dist/shared/ui/components/layouts/slider/Pagination.style.d.ts +23 -0
  36. package/dist/shared/ui/components/layouts/slider/Pagination.style.js +27 -0
  37. package/dist/shared/ui/components/layouts/slider/SliderDots.d.ts +8 -0
  38. package/dist/shared/ui/components/layouts/slider/SliderDots.js +16 -0
  39. package/dist/shared/ui/components/layouts/slider/SliderDots.style.d.ts +12 -0
  40. package/dist/shared/ui/components/layouts/slider/SliderDots.style.js +15 -0
  41. package/package.json +1 -1
@@ -1,5 +1,18 @@
1
1
  const toCheckoutProjection = (checkoutDto) => ({
2
2
  ...checkoutDto,
3
+ items: checkoutDto.items.map((item) => ({
4
+ ...item,
5
+ productVariant: {
6
+ ...item.productVariant,
7
+ media: [
8
+ ...item.productVariant.media,
9
+ ...item.productVariant.media,
10
+ ...item.productVariant.media,
11
+ ...item.productVariant.media,
12
+ ...item.productVariant.media,
13
+ ],
14
+ },
15
+ })),
3
16
  expiresOn: new Date(checkoutDto.expiresOn),
4
17
  });
5
18
  export { toCheckoutProjection };
@@ -0,0 +1,15 @@
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 };
@@ -0,0 +1,14 @@
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 };
@@ -12,9 +12,11 @@ const GetOutOfCheckoutModal = ({ visible, onDismiss, onConfirm }) => {
12
12
  const confirmButtonText = useI18nMessage({ id: I18nMessages.GET_OUT_OF_CHECKOUT_MODAL_CONFIRM_BUTTON });
13
13
  return (React.createElement(Modal, { visible: visible, onClose: onDismiss },
14
14
  React.createElement(View, { style: style.modal },
15
- React.createElement(Text, { align: ALIGN.CENTER, level: 1 }, titleText),
16
- React.createElement(Text, { level: 3, style: style.modalDescription }, descriptionText),
17
- React.createElement(Button, { style: style.button, onPress: onDismiss }, dismissButtonText),
18
- React.createElement(Button, { style: [style.button, style.confirmButton], variant: BUTTON_VARIANT.SECONDARY, onPress: onConfirm }, confirmButtonText))));
15
+ React.createElement(Text, { align: ALIGN.CENTER, level: 1, style: style.title }, titleText),
16
+ React.createElement(Text, { level: 3, style: style.description }, descriptionText),
17
+ React.createElement(Button, { style: style.button, onPress: onDismiss },
18
+ React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, dismissButtonText)),
19
+ React.createElement(Button, { style: [style.button, style.confirmButton], variant: BUTTON_VARIANT.SECONDARY, onPress: onConfirm },
20
+ React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, confirmButtonText)))));
19
21
  };
20
22
  export { GetOutOfCheckoutModal };
@@ -2,15 +2,22 @@ declare const style: {
2
2
  button: {
3
3
  flex: number;
4
4
  };
5
+ buttonText: {
6
+ width: string;
7
+ };
5
8
  confirmButton: {
6
9
  marginTop: number;
7
10
  };
11
+ description: {
12
+ marginVertical: number;
13
+ textAlign: "center";
14
+ width: string;
15
+ };
8
16
  modal: {
9
17
  padding: number;
10
18
  };
11
- modalDescription: {
12
- marginVertical: number;
13
- textAlign: "center";
19
+ title: {
20
+ width: string;
14
21
  };
15
22
  };
16
23
  export { style };
@@ -5,15 +5,22 @@ const style = StyleSheet.create({
5
5
  button: {
6
6
  flex: 0,
7
7
  },
8
+ buttonText: {
9
+ width: "100%",
10
+ },
8
11
  confirmButton: {
9
12
  marginTop: spaceXL,
10
13
  },
14
+ description: {
15
+ marginVertical: spaceXL,
16
+ textAlign: "center",
17
+ width: "100%",
18
+ },
11
19
  modal: {
12
20
  padding: spaceXL,
13
21
  },
14
- modalDescription: {
15
- marginVertical: spaceXL,
16
- textAlign: "center",
22
+ title: {
23
+ width: "100%",
17
24
  },
18
25
  });
19
26
  export { style };
@@ -1,4 +1,4 @@
1
- import { Button, BUTTON_VARIANT } from "@lookiero/aurora";
1
+ import { ALIGN, Button, BUTTON_VARIANT, Text } from "@lookiero/aurora";
2
2
  import { useI18nMessage } from "@lookiero/i18n-react";
3
3
  import React, { useMemo } from "react";
4
4
  import { View } from "react-native";
@@ -29,6 +29,7 @@ const ItemActions = ({ productVariants, currentProductVariant, country, onSizeSe
29
29
  inputField: { input: disabledSizeSelector && style.inputDisabled },
30
30
  }, onChange: onReplace })),
31
31
  React.createElement(View, { style: style.returnButtonContainer },
32
- React.createElement(Button, { variant: BUTTON_VARIANT.SECONDARY, onPress: onReturn }, returnButtonText))))));
32
+ React.createElement(Button, { variant: BUTTON_VARIANT.SECONDARY, onPress: onReturn },
33
+ React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, returnButtonText)))))));
33
34
  };
34
35
  export { ItemActions };
@@ -1,4 +1,7 @@
1
1
  declare const style: {
2
+ buttonText: {
3
+ width: string;
4
+ };
2
5
  container: {
3
6
  paddingHorizontal: number;
4
7
  };
@@ -2,6 +2,9 @@ import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../../../theme/theme";
3
3
  const { colorGrayscaleL, spaceL, spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
+ buttonText: {
6
+ width: "100%",
7
+ },
5
8
  container: {
6
9
  paddingHorizontal: spaceXL,
7
10
  },
@@ -2,6 +2,7 @@ declare const style: {
2
2
  title: {
3
3
  marginBottom: number;
4
4
  marginTop: number;
5
+ width: string;
5
6
  };
6
7
  titleContainer: {
7
8
  alignItems: "center";
@@ -5,6 +5,7 @@ const style = StyleSheet.create({
5
5
  title: {
6
6
  marginBottom: spaceL,
7
7
  marginTop: spaceXL,
8
+ width: "100%",
8
9
  },
9
10
  titleContainer: {
10
11
  alignItems: "center",
@@ -1,5 +1,5 @@
1
1
  import { PortalHost } from "@gorhom/portal";
2
- import { Button, Text } from "@lookiero/aurora";
2
+ import { ALIGN, Button, Text } from "@lookiero/aurora";
3
3
  import { useI18nMessage } from "@lookiero/i18n-react";
4
4
  import React, { useCallback } from "react";
5
5
  import { View } from "react-native";
@@ -35,6 +35,7 @@ const ReturnQuestionsForm = ({ returnQuestions, visible, onSubmit, onClose }) =>
35
35
  React.createElement(View, { style: style.returnQuestionsContainer },
36
36
  React.createElement(Text, { level: 2, style: style.title }, titleText),
37
37
  React.createElement(ReturnQuestions, { portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME, returnQuestions: returnQuestions }),
38
- React.createElement(Button, { style: style.submit, onPress: handleOnSubmit }, submitButtonText)))));
38
+ React.createElement(Button, { style: style.submit, onPress: handleOnSubmit },
39
+ React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, submitButtonText))))));
39
40
  };
40
41
  export { ReturnQuestionsForm };
@@ -1,4 +1,7 @@
1
1
  declare const style: {
2
+ buttonText: {
3
+ width: string;
4
+ };
2
5
  returnQuestionsContainer: {
3
6
  paddingHorizontal: number;
4
7
  };
@@ -2,6 +2,9 @@ import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../../../theme/theme";
3
3
  const { spaceS, spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
+ buttonText: {
6
+ width: "100%",
7
+ },
5
8
  returnQuestionsContainer: {
6
9
  paddingHorizontal: spaceXL,
7
10
  },
@@ -11,8 +11,9 @@ const SizeWithoutStockModal = ({ visible, onDismiss }) => {
11
11
  const buttonText = useI18nMessage({ id: I18nMessages.SIZE_WITHOUT_STOCK_MODAL_BUTTON });
12
12
  return (React.createElement(Modal, { visible: visible, onClose: onDismiss },
13
13
  React.createElement(View, { style: style.modal },
14
- React.createElement(Text, { align: ALIGN.CENTER, level: 1 }, titleText),
15
- React.createElement(Text, { level: 3, style: style.modalDescription }, descriptionText),
16
- React.createElement(Button, { style: style.button, onPress: onDismiss }, buttonText))));
14
+ React.createElement(Text, { align: ALIGN.CENTER, level: 1, style: style.title }, titleText),
15
+ React.createElement(Text, { level: 3, style: style.description }, descriptionText),
16
+ React.createElement(Button, { style: style.button, onPress: onDismiss },
17
+ React.createElement(Text, { align: ALIGN.CENTER, level: 3, selectable: false, style: style.buttonText, action: true, upperCase: true }, buttonText)))));
17
18
  };
18
19
  export { SizeWithoutStockModal };
@@ -2,12 +2,19 @@ declare const style: {
2
2
  button: {
3
3
  flex: number;
4
4
  };
5
- modal: {
6
- padding: number;
5
+ buttonText: {
6
+ width: string;
7
7
  };
8
- modalDescription: {
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
- modal: {
9
- padding: spaceXL,
8
+ buttonText: {
9
+ width: "100%",
10
10
  },
11
- modalDescription: {
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 };
@@ -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";
@@ -33,14 +33,15 @@ const Pricing = ({ pendingToPay, subtotal, balanceDiscount, discount, discountPe
33
33
  return (React.createElement(Pressable, { testID: "pricing", onPress: collapsible ? onPress : null },
34
34
  collapsible && (React.createElement(View, { style: style.iconContainer }, 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, null,
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, null,
43
- React.createElement(Button, { busy: busy, small: true, onPress: onSubmit }, submitButtonText)))) : (React.createElement(animated.View, { style: { opacity: notCollapsedStyle.opacitiy } },
42
+ React.createElement(View, { style: style.collapsedContent },
43
+ React.createElement(Button, { busy: busy, 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 },
@@ -1,8 +1,14 @@
1
1
  declare const style: {
2
+ buttonText: {
3
+ width: string;
4
+ };
2
5
  collapsed: {
3
6
  flexDirection: "row";
4
7
  justifyContent: "space-between";
5
8
  };
9
+ collapsedContent: {
10
+ flex: number;
11
+ };
6
12
  divider: {
7
13
  backgroundColor: string;
8
14
  height: number;
@@ -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.modalDescription }, bodyText),
29
- React.createElement(Button, { style: style.button, onPress: handleOnClose }, acceptText))));
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, 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
- modal: {
6
- padding: number;
5
+ buttonText: {
6
+ width: string;
7
7
  };
8
- modalDescription: {
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
- modal: {
9
- padding: spaceXL,
8
+ buttonText: {
9
+ width: "100%",
10
10
  },
11
- modalDescription: {
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 };
@@ -0,0 +1,11 @@
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 };
@@ -0,0 +1,31 @@
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 };
@@ -0,0 +1,17 @@
1
+ declare const style: {
2
+ carousel: {
3
+ flex: number;
4
+ flexDirection: "row";
5
+ height: string;
6
+ position: "absolute";
7
+ };
8
+ carouselItem: {
9
+ flex: number;
10
+ };
11
+ container: {
12
+ flex: number;
13
+ overflow: "hidden";
14
+ position: "relative";
15
+ };
16
+ };
17
+ export { style };
@@ -0,0 +1,7 @@
1
+ import { StyleSheet } from "react-native";
2
+ const style = StyleSheet.create({
3
+ carousel: { flex: 1, flexDirection: "row", height: "100%", position: "absolute" },
4
+ carouselItem: { flex: 1 },
5
+ container: { flex: 1, overflow: "hidden", position: "relative" },
6
+ });
7
+ export { style };
@@ -0,0 +1,16 @@
1
+ /// <reference types="react" />
2
+ interface RenderItemFunctionArgs<T> {
3
+ readonly item: T;
4
+ readonly index: number;
5
+ }
6
+ interface RenderItemFunction<T> {
7
+ (args: RenderItemFunctionArgs<T>): JSX.Element;
8
+ }
9
+ interface CarouselProps<T> {
10
+ readonly data: T[];
11
+ readonly children: RenderItemFunction<T>;
12
+ readonly onActiveIndexChanged?: (index: number) => void;
13
+ }
14
+ declare const Carousel2: <T>({ data, children, onActiveIndexChanged }: CarouselProps<T>) => JSX.Element;
15
+ export type { RenderItemFunction };
16
+ export { Carousel2 };
@@ -0,0 +1,72 @@
1
+ import { clamp } from "@react-spring/shared";
2
+ import React, { useCallback, useMemo, useRef, useState } from "react";
3
+ import { View } from "react-native";
4
+ import { Gesture, GestureDetector } from "react-native-gesture-handler";
5
+ import Animated, { useSharedValue, withSpring, useAnimatedStyle, runOnJS } from "react-native-reanimated";
6
+ import { useScrollViewRef } from "../../../../../infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef";
7
+ import { Bullets } from "../slider/Bullets";
8
+ import { style } from "./Carousel.style";
9
+ const SPRING_CONFIG = {
10
+ damping: 25,
11
+ mass: 1,
12
+ stiffness: 300,
13
+ };
14
+ const Carousel2 = ({ data, children, onActiveIndexChanged }) => {
15
+ const { scrollViewRef, panGestureRef } = useScrollViewRef();
16
+ const [carouselDimensions, setCarouselDimensions] = useState();
17
+ const carouselItemWidth = carouselDimensions?.width || 1;
18
+ const handleOnLayout = useCallback(({ nativeEvent: { layout: { width, height }, }, }) => setCarouselDimensions({ width, height }), []);
19
+ const [activeIndex, setActiveIndex] = useState(0);
20
+ const activeIndexRef = useRef(activeIndex);
21
+ activeIndexRef.current = activeIndex;
22
+ const panTranslationX = useSharedValue(0);
23
+ const panInitialTranslationX = useSharedValue(0);
24
+ const updateActiveIndex = useCallback((index) => {
25
+ if (activeIndexRef.current === index) {
26
+ return;
27
+ }
28
+ setActiveIndex(index);
29
+ onActiveIndexChanged?.(index);
30
+ }, [onActiveIndexChanged]);
31
+ const panGesture = useMemo(() => Gesture.Pan()
32
+ .maxPointers(1)
33
+ .activeOffsetX([-20, 20])
34
+ .onStart(() => {
35
+ panInitialTranslationX.value = panTranslationX.value;
36
+ })
37
+ .onUpdate(({ translationX }) => {
38
+ const tX = panInitialTranslationX.value + translationX;
39
+ const index = clamp(0, data.length - 1, Math.round(-tX / carouselItemWidth));
40
+ panTranslationX.value = tX;
41
+ runOnJS(updateActiveIndex)(index);
42
+ })
43
+ .onEnd(({ translationX }) => {
44
+ const tX = panInitialTranslationX.value + translationX;
45
+ const index = clamp(0, data.length - 1, Math.round(-tX / carouselItemWidth));
46
+ panTranslationX.value = withSpring(-index * carouselItemWidth, SPRING_CONFIG);
47
+ })
48
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
49
+ // @ts-ignore
50
+ .simultaneousWithExternalGesture(scrollViewRef)
51
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
52
+ // @ts-ignore
53
+ .withRef(panGestureRef), [
54
+ carouselItemWidth,
55
+ data.length,
56
+ panGestureRef,
57
+ panInitialTranslationX,
58
+ panTranslationX,
59
+ scrollViewRef,
60
+ updateActiveIndex,
61
+ ]);
62
+ const animatedStyle = useAnimatedStyle(() => ({ transform: [{ translateX: panTranslationX.value }] }), [panTranslationX]);
63
+ return (React.createElement(React.Fragment, null,
64
+ React.createElement(View, { style: style.container, onLayout: handleOnLayout }, carouselDimensions && (
65
+ // <GestureHandlerRootView style={{ flex: 1 }}>
66
+ React.createElement(GestureDetector, { gesture: panGesture },
67
+ React.createElement(Animated.View, { style: [style.carousel, { width: carouselDimensions.width * data.length }, animatedStyle] }, data.map((item, index) => (React.createElement(View, { key: index, style: [style.carouselItem, { width: carouselDimensions.width }] }, children({ index, item }))))))
68
+ // </GestureHandlerRootView>
69
+ )),
70
+ React.createElement(Bullets, { activeIndex: activeIndex, count: data.length, onChange: () => void 0 })));
71
+ };
72
+ export { Carousel2 };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const DragComponent: (props: any) => JSX.Element;
3
+ export { DragComponent };
@@ -0,0 +1,48 @@
1
+ /* eslint-disable @typescript-eslint/ban-ts-comment */
2
+ import React from "react";
3
+ import { View } from "react-native";
4
+ import { Gesture, GestureDetector } from "react-native-gesture-handler";
5
+ import { useSharedValue } from "react-native-reanimated";
6
+ import { useScrollViewRef } from "../../../../../infrastructure/ui/components/layouts/layout/dummyLayout/useScrollViewRef";
7
+ const TOUCH_SLOP = 5;
8
+ const TIME_TO_ACTIVATE_PAN = 400;
9
+ // @ts-ignore
10
+ const DragComponent = (props) => {
11
+ const { scrollViewRef, panGestureRef } = useScrollViewRef();
12
+ const touchStart = useSharedValue({ x: 0, y: 0, time: 0 });
13
+ const gesture = Gesture.Pan()
14
+ .manualActivation(true)
15
+ .onTouchesDown((e) => {
16
+ touchStart.value = {
17
+ // @ts-ignore
18
+ x: e.changedTouches[0].x,
19
+ // @ts-ignore
20
+ y: e.changedTouches[0].y,
21
+ time: Date.now(),
22
+ };
23
+ })
24
+ .onTouchesMove((e, state) => {
25
+ if (Date.now() - touchStart.value.time > TIME_TO_ACTIVATE_PAN) {
26
+ state.activate();
27
+ console.log("activate");
28
+ }
29
+ else if (
30
+ // @ts-ignore
31
+ Math.abs(touchStart.value.x - e.changedTouches[0].x) > TOUCH_SLOP ||
32
+ // @ts-ignore
33
+ Math.abs(touchStart.value.y - e.changedTouches[0].y) > TOUCH_SLOP) {
34
+ state.fail();
35
+ console.log("fail");
36
+ }
37
+ })
38
+ .onUpdate(() => {
39
+ console.log("pan update");
40
+ })
41
+ // @ts-ignore
42
+ .simultaneousWithExternalGesture(scrollViewRef)
43
+ // @ts-ignore
44
+ .withRef(panGestureRef);
45
+ return (React.createElement(GestureDetector, { gesture: gesture },
46
+ React.createElement(View, null, props.children)));
47
+ };
48
+ export { DragComponent };
@@ -5,7 +5,7 @@ import { theme } from "../../../../../infrastructure/ui/theme/theme";
5
5
  import { style } from "./Bullets.style";
6
6
  const { colorContent, colorGrayscaleM } = theme();
7
7
  const colorTransparent = "rgba(0,0,0,0)";
8
- const MAX = 5;
8
+ const MAX = 7;
9
9
  const DIAMETER_MAX = 8;
10
10
  const DIAMETER_MIN = 2;
11
11
  const Bullet = ({ index, activeIndex, maxBullets, onChange }) => {
@@ -0,0 +1,14 @@
1
+ import { FC, ReactNode } from "react";
2
+ import { StyleProp, ViewStyle } from "react-native";
3
+ interface PaginationProps {
4
+ readonly touchable?: boolean;
5
+ readonly paginationStyle?: StyleProp<ViewStyle>;
6
+ readonly paginationItemStyle?: StyleProp<ViewStyle>;
7
+ readonly paginationActiveItemStyle?: StyleProp<ViewStyle>;
8
+ readonly count?: number;
9
+ readonly activeIndex?: number;
10
+ readonly onChange: (index: number) => void;
11
+ readonly renderItem?: (index: number) => ReactNode;
12
+ }
13
+ declare const Pagination: FC<PaginationProps>;
14
+ export { Pagination };
@@ -0,0 +1,11 @@
1
+ import React from "react";
2
+ import { Pressable, View } from "react-native";
3
+ import { style } from "./Pagination.style";
4
+ const Pagination = ({ touchable = true, paginationStyle, paginationItemStyle, paginationActiveItemStyle, count = 0, activeIndex = 0, renderItem, onChange, }) => (React.createElement(View, { style: [style.paginationWrapper, paginationStyle], testID: "slider-pagination" }, Array.from(Array(count).keys()).map((index) => (React.createElement(View, { key: index, style: style.paginationContainer },
5
+ React.createElement(Pressable, { testID: "slider-pagination-item", style: [
6
+ style.paginationItem,
7
+ activeIndex === index && style.active,
8
+ paginationItemStyle,
9
+ activeIndex === index && paginationActiveItemStyle,
10
+ ], onPress: !touchable ? undefined : () => onChange(index) }, renderItem?.(index)))))));
11
+ export { Pagination };
@@ -0,0 +1,23 @@
1
+ declare const style: {
2
+ active: {
3
+ backgroundColor: string;
4
+ };
5
+ paginationContainer: {
6
+ margin: number;
7
+ };
8
+ paginationItem: {
9
+ backgroundColor: string;
10
+ borderRadius: number;
11
+ height: number;
12
+ width: number;
13
+ };
14
+ paginationWrapper: {
15
+ alignItems: "center";
16
+ bottom: number;
17
+ flexDirection: "row";
18
+ justifyContent: "center";
19
+ position: "absolute";
20
+ width: string;
21
+ };
22
+ };
23
+ export { style };
@@ -0,0 +1,27 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../../../../infrastructure/ui/theme/theme";
3
+ const { colorGrayscaleS, colorGrayscaleXL } = theme();
4
+ const DOT_SIZE = 8;
5
+ const style = StyleSheet.create({
6
+ active: {
7
+ backgroundColor: colorGrayscaleXL,
8
+ },
9
+ paginationContainer: {
10
+ margin: 3,
11
+ },
12
+ paginationItem: {
13
+ backgroundColor: colorGrayscaleS,
14
+ borderRadius: DOT_SIZE / 2,
15
+ height: DOT_SIZE,
16
+ width: DOT_SIZE,
17
+ },
18
+ paginationWrapper: {
19
+ alignItems: "center",
20
+ bottom: 10,
21
+ flexDirection: "row",
22
+ justifyContent: "center",
23
+ position: "absolute",
24
+ width: "100%",
25
+ },
26
+ });
27
+ export { style };
@@ -0,0 +1,8 @@
1
+ import { FC } from "react";
2
+ interface SliderDotsProps {
3
+ readonly count: number;
4
+ readonly index: number;
5
+ readonly onChange: (index: number) => void;
6
+ }
7
+ declare const SliderDots: FC<SliderDotsProps>;
8
+ export { SliderDots };
@@ -0,0 +1,16 @@
1
+ import React from "react";
2
+ import { TouchableWithoutFeedback, View } from "react-native";
3
+ import { theme } from "../../../../../infrastructure/ui/theme/theme";
4
+ import { style } from "./SliderDots.style";
5
+ const { colorContent } = theme();
6
+ const SliderDot = ({ diameter, color }) => (React.createElement(View, { style: [style.sliderDot, { width: diameter, height: diameter, backgroundColor: color, borderRadius: diameter }] }));
7
+ const SliderDots = () => {
8
+ return (React.createElement(View, { style: style.sliderDots },
9
+ React.createElement(TouchableWithoutFeedback, null,
10
+ React.createElement(SliderDot, { color: colorContent, diameter: 8 })),
11
+ React.createElement(TouchableWithoutFeedback, null,
12
+ React.createElement(SliderDot, { color: colorContent, diameter: 8 })),
13
+ React.createElement(TouchableWithoutFeedback, null,
14
+ React.createElement(SliderDot, { color: colorContent, diameter: 8 }))));
15
+ };
16
+ export { SliderDots };
@@ -0,0 +1,12 @@
1
+ declare const style: {
2
+ sliderDot: {
3
+ marginHorizontal: number;
4
+ };
5
+ sliderDots: {
6
+ alignItems: "center";
7
+ flexDirection: "row";
8
+ justifyContent: "center";
9
+ paddingVertical: number;
10
+ };
11
+ };
12
+ export { style };
@@ -0,0 +1,15 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "../../../../../infrastructure/ui/theme/theme";
3
+ const { spaceM } = theme();
4
+ const style = StyleSheet.create({
5
+ sliderDot: {
6
+ marginHorizontal: 3,
7
+ },
8
+ sliderDots: {
9
+ alignItems: "center",
10
+ flexDirection: "row",
11
+ justifyContent: "center",
12
+ paddingVertical: spaceM,
13
+ },
14
+ });
15
+ export { style };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "3.6.1",
3
+ "version": "3.7.0-beta.100",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [