@lookiero/checkout 0.2.21 → 0.2.22
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/projection/returnQuestion/returnQuestions.mock.js +1 -1
- package/dist/infrastructure/ui/components/layouts/body/Body.js +4 -7
- package/dist/infrastructure/ui/components/layouts/body/Body.style.d.ts +2 -2
- package/dist/infrastructure/ui/components/layouts/body/Body.style.js +2 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.d.ts +1 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestion.js +3 -3
- package/dist/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.d.ts +1 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/ReturnQuestions.js +1 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/ReturnQuestionItem.d.ts +3 -2
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +10 -9
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.d.ts +1 -10
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.style.js +1 -10
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.js +4 -4
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.style.d.ts +1 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem.style.js +7 -3
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.js +1 -1
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.style.d.ts +3 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem.style.js +3 -0
- package/dist/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +3 -2
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.d.ts +2 -2
- package/dist/infrastructure/ui/components/templates/SafeAreaScrollView.js +2 -1
- package/dist/infrastructure/ui/routing/CheckoutAccessibilityMiddleware.js +1 -1
- package/dist/infrastructure/ui/routing/CheckoutMiddleware.js +1 -1
- package/dist/infrastructure/ui/routing/Routing.js +21 -14
- package/dist/infrastructure/ui/{components → shared/components}/atoms/error/Error.style.js +1 -1
- package/dist/infrastructure/ui/{components → shared/components}/atoms/field/Field.js +1 -1
- package/dist/infrastructure/ui/{components → shared/components}/atoms/field/Field.style.js +1 -1
- package/dist/infrastructure/ui/shared/components/atoms/icon/Icon.d.ts +12 -0
- package/dist/infrastructure/ui/shared/components/atoms/icon/Icon.js +7 -0
- package/dist/infrastructure/ui/shared/components/atoms/icon/Icon.style.d.ts +13 -0
- package/dist/infrastructure/ui/shared/components/atoms/icon/Icon.style.js +16 -0
- package/dist/infrastructure/ui/{components → shared/components}/atoms/input/Input.d.ts +1 -1
- package/dist/infrastructure/ui/{components → shared/components}/atoms/input/Input.js +1 -1
- package/dist/infrastructure/ui/{components → shared/components}/atoms/input/Input.style.d.ts +4 -1
- package/dist/infrastructure/ui/{components → shared/components}/atoms/input/Input.style.js +10 -3
- package/dist/infrastructure/ui/{components → shared/components}/atoms/spinner/Spinner.js +1 -1
- package/dist/infrastructure/ui/shared/components/layouts/column/Column.d.ts +10 -0
- package/dist/infrastructure/ui/shared/components/layouts/column/Column.js +10 -0
- package/dist/infrastructure/ui/shared/components/layouts/column/Column.style.d.ts +12 -0
- package/dist/infrastructure/ui/shared/components/layouts/column/Column.style.js +23 -0
- package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.d.ts +17 -0
- package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.js +60 -0
- package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.style.d.ts +49 -0
- package/dist/infrastructure/ui/shared/components/layouts/modal/Modal.style.js +62 -0
- package/dist/infrastructure/ui/shared/components/layouts/row/Row.d.ts +6 -0
- package/dist/infrastructure/ui/shared/components/layouts/row/Row.js +10 -0
- package/dist/infrastructure/ui/shared/components/layouts/row/Row.style.d.ts +13 -0
- package/dist/infrastructure/ui/shared/components/layouts/row/Row.style.js +17 -0
- package/dist/infrastructure/ui/{components → shared/components}/layouts/slider/Pagination.d.ts +2 -2
- package/dist/infrastructure/ui/{components → shared/components}/layouts/slider/Pagination.style.js +1 -1
- package/dist/infrastructure/ui/{components → shared/components}/layouts/slider/Slider.d.ts +1 -1
- package/dist/infrastructure/ui/shared/components/molecules/buttonIcon/ButtonIcon.d.ts +14 -0
- package/dist/infrastructure/ui/shared/components/molecules/buttonIcon/ButtonIcon.js +7 -0
- package/dist/infrastructure/ui/shared/components/molecules/buttonIcon/ButtonIcon.style.d.ts +7 -0
- package/dist/infrastructure/ui/shared/components/molecules/buttonIcon/ButtonIcon.style.js +10 -0
- package/dist/infrastructure/ui/{components → shared/components}/molecules/inputField/InputField.d.ts +8 -6
- package/dist/infrastructure/ui/{components → shared/components}/molecules/inputField/InputField.js +8 -5
- package/dist/infrastructure/ui/{components → shared/components}/molecules/inputField/InputField.style.d.ts +6 -0
- package/dist/infrastructure/ui/{components → shared/components}/molecules/inputField/InputField.style.js +8 -2
- package/dist/infrastructure/ui/shared/hooks/useScreenSize.d.ts +4 -0
- package/dist/infrastructure/ui/shared/hooks/useScreenSize.js +9 -0
- package/dist/infrastructure/ui/views/App.d.ts +3 -0
- package/dist/infrastructure/ui/views/App.js +8 -0
- package/dist/infrastructure/ui/views/intro/Intro.js +1 -1
- package/dist/infrastructure/ui/views/item/Item.js +5 -5
- package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.js +1 -1
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js +17 -9
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.d.ts +1 -13
- package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.style.js +2 -14
- package/dist/projection/returnQuestion/returnQuestion.d.ts +1 -0
- package/dist/projection/returnQuestion/returnQuestion.js +1 -0
- package/package.json +5 -2
- /package/dist/infrastructure/ui/{components → shared/components}/atoms/error/Error.d.ts +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/atoms/error/Error.js +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/atoms/error/Error.style.d.ts +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/atoms/field/Field.d.ts +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/atoms/field/Field.style.d.ts +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/atoms/spinner/Spinner.d.ts +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/atoms/spinner/Spinner.style.d.ts +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/atoms/spinner/Spinner.style.js +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/layouts/slider/Pagination.js +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/layouts/slider/Pagination.style.d.ts +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/layouts/slider/Slider.js +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/layouts/slider/Slider.style.d.ts +0 -0
- /package/dist/infrastructure/ui/{components → shared/components}/layouts/slider/Slider.style.js +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
import { ViewProps } from "react-native";
|
|
3
|
+
import { ScreenSize } from "../../../hooks/useScreenSize";
|
|
4
|
+
declare type ColumnSize = "1/4" | "1/3" | "1/2" | "2/3";
|
|
5
|
+
declare type ModalStyle = "overlay" | "row" | "modal" | "header" | "closeButton";
|
|
6
|
+
interface ModalProps {
|
|
7
|
+
readonly children: ReactNode;
|
|
8
|
+
readonly visible: boolean;
|
|
9
|
+
readonly onClose?: () => void;
|
|
10
|
+
readonly header?: ReactNode;
|
|
11
|
+
readonly portalHostName?: string;
|
|
12
|
+
readonly size?: Partial<Record<ScreenSize, ColumnSize>>;
|
|
13
|
+
readonly style?: Partial<Record<ModalStyle, ViewProps>>;
|
|
14
|
+
}
|
|
15
|
+
declare const Modal: FC<ModalProps>;
|
|
16
|
+
export type { ColumnSize };
|
|
17
|
+
export { Modal };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Portal } from "@gorhom/portal";
|
|
2
|
+
import { animated, useTransition } from "@react-spring/native";
|
|
3
|
+
import React, { useCallback, useState } from "react";
|
|
4
|
+
import { Dimensions, Platform, TouchableWithoutFeedback, View } from "react-native";
|
|
5
|
+
import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
|
+
import { useScreenSize } from "../../../hooks/useScreenSize";
|
|
7
|
+
import { ButtonIcon } from "../../molecules/buttonIcon/ButtonIcon";
|
|
8
|
+
import { Row } from "../row/Row";
|
|
9
|
+
import { style } from "./Modal.style";
|
|
10
|
+
const TRANSITION_MODAL_SCALE = 0.9;
|
|
11
|
+
const Modal = ({ children, visible, header, portalHostName, onClose, size = { M: "2/3", L: "1/3" }, style: customStyle, }) => {
|
|
12
|
+
const { height: screenHeight } = Dimensions.get("screen");
|
|
13
|
+
const { top: safeAreaInsetTop, bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
14
|
+
const screenSizeWithoutInsets = screenHeight - safeAreaInsetTop;
|
|
15
|
+
const screenSize = useScreenSize();
|
|
16
|
+
const isSmallDevice = screenSize === "S" || Platform.OS !== "web";
|
|
17
|
+
const columnSizeForScreenSize = size[screenSize];
|
|
18
|
+
const [modalHeight, setModalHeight] = useState();
|
|
19
|
+
const handleOnModalLayout = useCallback(({ nativeEvent: { layout: { height }, }, }) => setModalHeight(height), []);
|
|
20
|
+
const transitions = useTransition(visible, {
|
|
21
|
+
from: isSmallDevice
|
|
22
|
+
? {
|
|
23
|
+
modalOpacity: 1,
|
|
24
|
+
overlayOpacity: 0,
|
|
25
|
+
modalTranslateY: (modalHeight || screenHeight) + safeAreaInsetBottom,
|
|
26
|
+
modalScale: 1,
|
|
27
|
+
}
|
|
28
|
+
: { modalOpacity: 0, overlayOpacity: 0, modalTranslateY: 0, modalScale: TRANSITION_MODAL_SCALE },
|
|
29
|
+
enter: { modalOpacity: 1, overlayOpacity: 1, modalTranslateY: 0, modalScale: 1 },
|
|
30
|
+
leave: isSmallDevice
|
|
31
|
+
? {
|
|
32
|
+
modalOpacity: 1,
|
|
33
|
+
overlayOpacity: 0,
|
|
34
|
+
modalTranslateY: (modalHeight || screenHeight) + safeAreaInsetBottom,
|
|
35
|
+
modalScale: 1,
|
|
36
|
+
}
|
|
37
|
+
: { modalOpacity: 0, overlayOpacity: 0, modalTranslateY: 0, modalScale: TRANSITION_MODAL_SCALE },
|
|
38
|
+
unique: true,
|
|
39
|
+
});
|
|
40
|
+
return (React.createElement(Portal, { hostName: portalHostName }, transitions(({ modalOpacity, overlayOpacity, modalTranslateY, modalScale }, item) => item && (React.createElement(View, { style: style.container, pointerEvents: visible ? "auto" : "none", testID: "modal" },
|
|
41
|
+
React.createElement(TouchableWithoutFeedback, { onPress: visible ? onClose : undefined },
|
|
42
|
+
React.createElement(animated.View, { style: [style.overlay, { opacity: overlayOpacity }, customStyle?.overlay] })),
|
|
43
|
+
React.createElement(SafeAreaView, { edges: ["right", "top", "left"], style: style.safeArea, pointerEvents: "box-none" },
|
|
44
|
+
React.createElement(Row, { style: [style.row, isSmallDevice && style.rowSmall, customStyle?.row], pointerEvents: "box-none" },
|
|
45
|
+
React.createElement(animated.View, { style: [
|
|
46
|
+
style.modal,
|
|
47
|
+
columnSizeForScreenSize && style.modal[columnSizeForScreenSize],
|
|
48
|
+
{
|
|
49
|
+
opacity: modalOpacity,
|
|
50
|
+
transform: [{ translateY: modalTranslateY }, { scale: modalScale }],
|
|
51
|
+
maxHeight: screenSizeWithoutInsets,
|
|
52
|
+
},
|
|
53
|
+
customStyle?.modal,
|
|
54
|
+
], onLayout: handleOnModalLayout, pointerEvents: visible ? "auto" : "none" },
|
|
55
|
+
(header || onClose) && (React.createElement(View, { style: [style.header, customStyle?.header] },
|
|
56
|
+
React.createElement(View, null, header),
|
|
57
|
+
onClose && (React.createElement(ButtonIcon, { style: { button: [style.closeButton, customStyle?.closeButton] }, name: "close", onPress: onClose })))),
|
|
58
|
+
children))))))));
|
|
59
|
+
};
|
|
60
|
+
export { Modal };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ViewStyle } from "react-native";
|
|
2
|
+
declare const style: {
|
|
3
|
+
container: {
|
|
4
|
+
position: "absolute";
|
|
5
|
+
width: string;
|
|
6
|
+
height: string;
|
|
7
|
+
overflow: "hidden";
|
|
8
|
+
};
|
|
9
|
+
overlay: {
|
|
10
|
+
zIndex: number;
|
|
11
|
+
backgroundColor: string;
|
|
12
|
+
position: "absolute";
|
|
13
|
+
width: string;
|
|
14
|
+
height: string;
|
|
15
|
+
cursor: string;
|
|
16
|
+
};
|
|
17
|
+
safeArea: {
|
|
18
|
+
flex: number;
|
|
19
|
+
zIndex: number;
|
|
20
|
+
};
|
|
21
|
+
row: {
|
|
22
|
+
flex: number;
|
|
23
|
+
alignContent: "center";
|
|
24
|
+
justifyContent: "center";
|
|
25
|
+
};
|
|
26
|
+
rowSmall: {
|
|
27
|
+
justifyContent: "flex-end";
|
|
28
|
+
};
|
|
29
|
+
modal: {
|
|
30
|
+
"1/4": ViewStyle;
|
|
31
|
+
"1/3": ViewStyle;
|
|
32
|
+
"1/2": ViewStyle;
|
|
33
|
+
"2/3": ViewStyle;
|
|
34
|
+
backgroundColor: string;
|
|
35
|
+
position: "absolute";
|
|
36
|
+
width: string;
|
|
37
|
+
zIndex: number;
|
|
38
|
+
};
|
|
39
|
+
header: {
|
|
40
|
+
alignItems: "center";
|
|
41
|
+
justifyContent: "space-between";
|
|
42
|
+
padding: number;
|
|
43
|
+
flexDirection: "row";
|
|
44
|
+
};
|
|
45
|
+
closeButton: {
|
|
46
|
+
alignSelf: "flex-end";
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export { style };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../../theme/theme";
|
|
3
|
+
const { spaceM, colorBase, colorOverlay } = theme();
|
|
4
|
+
const modalStylesForColumSize = {
|
|
5
|
+
["1/4"]: {
|
|
6
|
+
maxWidth: `${100 * (1 / 4)}%`,
|
|
7
|
+
},
|
|
8
|
+
["1/3"]: {
|
|
9
|
+
maxWidth: `${100 * (1 / 3)}%`,
|
|
10
|
+
},
|
|
11
|
+
["1/2"]: {
|
|
12
|
+
maxWidth: `${100 * (1 / 2)}%`,
|
|
13
|
+
},
|
|
14
|
+
["2/3"]: {
|
|
15
|
+
maxWidth: `${100 * (2 / 3)}%`,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const style = StyleSheet.create({
|
|
19
|
+
container: {
|
|
20
|
+
position: "absolute",
|
|
21
|
+
width: "100%",
|
|
22
|
+
height: "100%",
|
|
23
|
+
overflow: "hidden",
|
|
24
|
+
},
|
|
25
|
+
overlay: {
|
|
26
|
+
zIndex: 1,
|
|
27
|
+
backgroundColor: colorOverlay,
|
|
28
|
+
position: "absolute",
|
|
29
|
+
width: "100%",
|
|
30
|
+
height: "100%",
|
|
31
|
+
cursor: "pointer",
|
|
32
|
+
},
|
|
33
|
+
safeArea: {
|
|
34
|
+
flex: 1,
|
|
35
|
+
zIndex: 2,
|
|
36
|
+
},
|
|
37
|
+
row: {
|
|
38
|
+
flex: 1,
|
|
39
|
+
alignContent: "center",
|
|
40
|
+
justifyContent: "center",
|
|
41
|
+
},
|
|
42
|
+
rowSmall: {
|
|
43
|
+
justifyContent: "flex-end",
|
|
44
|
+
},
|
|
45
|
+
modal: {
|
|
46
|
+
backgroundColor: colorBase,
|
|
47
|
+
position: "absolute",
|
|
48
|
+
width: "100%",
|
|
49
|
+
zIndex: 3,
|
|
50
|
+
...modalStylesForColumSize,
|
|
51
|
+
},
|
|
52
|
+
header: {
|
|
53
|
+
alignItems: "center",
|
|
54
|
+
justifyContent: "space-between",
|
|
55
|
+
padding: spaceM,
|
|
56
|
+
flexDirection: "row",
|
|
57
|
+
},
|
|
58
|
+
closeButton: {
|
|
59
|
+
alignSelf: "flex-end",
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
export { style };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { useScreenSize } from "../../../hooks/useScreenSize";
|
|
4
|
+
import { style } from "./Row.style";
|
|
5
|
+
const Row = ({ children, style: customStyle, ...restProps }) => {
|
|
6
|
+
const screenSize = useScreenSize();
|
|
7
|
+
const largeStyle = screenSize !== "S" && style.rowLarge;
|
|
8
|
+
return (React.createElement(View, { style: [style.row, largeStyle, customStyle], ...restProps }, children));
|
|
9
|
+
};
|
|
10
|
+
export { Row };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../../theme/theme";
|
|
3
|
+
const { spaceXXL, layoutMaxWidth } = theme();
|
|
4
|
+
const rowLargeMaxWidth = layoutMaxWidth - 2 * spaceXXL;
|
|
5
|
+
const style = StyleSheet.create({
|
|
6
|
+
row: {
|
|
7
|
+
flexWrap: "wrap",
|
|
8
|
+
maxWidth: layoutMaxWidth,
|
|
9
|
+
width: "100%",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
marginHorizontal: "auto",
|
|
12
|
+
},
|
|
13
|
+
rowLarge: {
|
|
14
|
+
maxWidth: rowLargeMaxWidth,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export { style };
|
package/dist/infrastructure/ui/{components → shared/components}/layouts/slider/Pagination.d.ts
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FC } from "react";
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
2
|
import { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
interface PaginationProps {
|
|
4
4
|
readonly touchable?: boolean;
|
|
@@ -8,7 +8,7 @@ interface PaginationProps {
|
|
|
8
8
|
readonly count?: number;
|
|
9
9
|
readonly activeIndex?: number;
|
|
10
10
|
readonly onChange: (index: number) => void;
|
|
11
|
-
readonly renderItem?: (index: number) =>
|
|
11
|
+
readonly renderItem?: (index: number) => ReactNode;
|
|
12
12
|
}
|
|
13
13
|
declare const Pagination: FC<PaginationProps>;
|
|
14
14
|
export { Pagination };
|
|
@@ -14,7 +14,7 @@ interface SliderProps {
|
|
|
14
14
|
readonly onSliderStart?: () => void;
|
|
15
15
|
readonly onSliderEnd?: () => void;
|
|
16
16
|
readonly onChanged?: (index: number) => void;
|
|
17
|
-
readonly paginationRenderItem?: (index: number) =>
|
|
17
|
+
readonly paginationRenderItem?: (index: number) => ReactNode;
|
|
18
18
|
}
|
|
19
19
|
declare const Slider: FC<SliderProps>;
|
|
20
20
|
export { Slider };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { StyleProp, ViewStyle } from "react-native";
|
|
3
|
+
import { IconName, IconStyle } from "../../atoms/icon/Icon";
|
|
4
|
+
interface ButtonIconStyle {
|
|
5
|
+
readonly button: StyleProp<ViewStyle>;
|
|
6
|
+
readonly icon: IconStyle;
|
|
7
|
+
}
|
|
8
|
+
interface ButtonIconProps {
|
|
9
|
+
readonly name: IconName;
|
|
10
|
+
readonly style?: Partial<ButtonIconStyle>;
|
|
11
|
+
readonly onPress: () => void;
|
|
12
|
+
}
|
|
13
|
+
declare const ButtonIcon: FC<ButtonIconProps>;
|
|
14
|
+
export { ButtonIcon };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableHighlight } from "react-native";
|
|
3
|
+
import { Icon } from "../../atoms/icon/Icon";
|
|
4
|
+
import { buttonIconUnderlayColor, style } from "./ButtonIcon.style";
|
|
5
|
+
const ButtonIcon = ({ name, style: customStyle, onPress }) => (React.createElement(TouchableHighlight, { style: [style.buttonIcon, customStyle?.button], onPress: onPress, underlayColor: buttonIconUnderlayColor, testID: "button-icon" },
|
|
6
|
+
React.createElement(Icon, { name: name, style: customStyle?.icon })));
|
|
7
|
+
export { ButtonIcon };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { theme } from "../../../../theme/theme";
|
|
3
|
+
const { spaceS, colorGrayscaleS } = theme();
|
|
4
|
+
const buttonIconUnderlayColor = colorGrayscaleS;
|
|
5
|
+
const style = StyleSheet.create({
|
|
6
|
+
buttonIcon: {
|
|
7
|
+
padding: spaceS,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
export { style, buttonIconUnderlayColor };
|
package/dist/infrastructure/ui/{components → shared/components}/molecules/inputField/InputField.d.ts
RENAMED
|
@@ -2,21 +2,23 @@ import { FC } from "react";
|
|
|
2
2
|
import { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import { ErrorStyle } from "../../atoms/error/Error";
|
|
4
4
|
import { FieldStyle } from "../../atoms/field/Field";
|
|
5
|
-
import {
|
|
5
|
+
import { IconName, IconStyle } from "../../atoms/icon/Icon";
|
|
6
|
+
import { InputProps, InputStyle } from "../../atoms/input/Input";
|
|
6
7
|
declare type InputFieldStyle = FieldStyle & {
|
|
7
8
|
readonly inputField: StyleProp<ViewStyle>;
|
|
8
9
|
readonly input: InputStyle;
|
|
9
10
|
readonly error: ErrorStyle;
|
|
11
|
+
readonly icon: IconStyle;
|
|
10
12
|
};
|
|
11
|
-
interface
|
|
13
|
+
interface InputFieldBaseProps {
|
|
12
14
|
readonly label: string;
|
|
13
|
-
readonly placeholder?: string;
|
|
14
|
-
readonly value: string | undefined;
|
|
15
15
|
readonly multiline?: boolean;
|
|
16
|
-
readonly minHeight?: number;
|
|
17
16
|
readonly error?: string | null;
|
|
18
17
|
readonly style?: Partial<InputFieldStyle>;
|
|
19
|
-
readonly onChange
|
|
18
|
+
readonly onChange?: (value: string) => void;
|
|
19
|
+
readonly icon?: IconName;
|
|
20
|
+
}
|
|
21
|
+
interface InputFieldProps extends Omit<InputProps, keyof InputFieldBaseProps>, InputFieldBaseProps {
|
|
20
22
|
}
|
|
21
23
|
declare const InputField: FC<InputFieldProps>;
|
|
22
24
|
export { InputField };
|
package/dist/infrastructure/ui/{components → shared/components}/molecules/inputField/InputField.js
RENAMED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import React, { useCallback, useState } from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { theme } from "
|
|
3
|
+
import { theme } from "../../../../theme/theme";
|
|
4
4
|
import { Error } from "../../atoms/error/Error";
|
|
5
5
|
import { Field } from "../../atoms/field/Field";
|
|
6
|
+
import { Icon } from "../../atoms/icon/Icon";
|
|
6
7
|
import { Input } from "../../atoms/input/Input";
|
|
7
8
|
import { style } from "./InputField.style";
|
|
8
|
-
const { colorContent, colorGrayscaleL, colorPrimary } = theme();
|
|
9
|
-
const
|
|
9
|
+
const { colorContent, colorGrayscaleL, colorPrimary, spaceM, iconSize } = theme();
|
|
10
|
+
const inputPaddingRightWithIcon = iconSize + spaceM * 2;
|
|
11
|
+
const InputField = ({ label, placeholder, value, multiline = false, minHeight, error, style: customStyle, onChange = () => void 0, icon, ...inputRestProps }) => {
|
|
10
12
|
const [isFocused, setIsFocused] = useState(false);
|
|
11
13
|
const handleOnChange = useCallback((text) => onChange(text), [onChange]);
|
|
12
14
|
const handleOnBlur = useCallback(() => setIsFocused(false), []);
|
|
13
15
|
const handleOnFocus = useCallback(() => setIsFocused(true), []);
|
|
14
16
|
const color = error ? colorPrimary : isFocused ? colorContent : colorGrayscaleL;
|
|
15
|
-
return (React.createElement(View, { style: customStyle?.inputField },
|
|
17
|
+
return (React.createElement(View, { style: customStyle?.inputField, testID: "input-field" },
|
|
16
18
|
React.createElement(Field, { label: label, isFocused: isFocused || !!value, style: {
|
|
17
19
|
field: { ...style.field, ...customStyle?.field },
|
|
18
20
|
fieldText: {
|
|
@@ -20,7 +22,8 @@ const InputField = ({ label, placeholder, value, multiline = false, minHeight, e
|
|
|
20
22
|
...customStyle?.fieldText,
|
|
21
23
|
},
|
|
22
24
|
} }),
|
|
23
|
-
React.createElement(Input, { value: value, placeholder: placeholder, multiline: multiline, minHeight: minHeight, onChangeText: handleOnChange, onBlur: handleOnBlur, onFocus: handleOnFocus, style: [{ borderColor: color }, customStyle?.input] }),
|
|
25
|
+
React.createElement(Input, { value: value, placeholder: placeholder, multiline: multiline, minHeight: minHeight, onChangeText: handleOnChange, onBlur: handleOnBlur, onFocus: handleOnFocus, style: [!!icon ? { paddingRight: inputPaddingRightWithIcon } : {}, { borderColor: color }, customStyle?.input], ...inputRestProps }),
|
|
26
|
+
!!icon && React.createElement(Icon, { name: icon, style: [style.icon, { color }, customStyle?.icon] }),
|
|
24
27
|
!!error && React.createElement(Error, { error: error, style: [style.error, customStyle?.error] })));
|
|
25
28
|
};
|
|
26
29
|
export { InputField };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
|
-
import { theme } from "
|
|
3
|
-
const { spaceXS, spaceL } = theme();
|
|
2
|
+
import { theme } from "../../../../theme/theme";
|
|
3
|
+
const { spaceXS, spaceM, spaceL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
5
|
field: {
|
|
6
6
|
position: "absolute",
|
|
@@ -10,5 +10,11 @@ const style = StyleSheet.create({
|
|
|
10
10
|
marginTop: spaceXS,
|
|
11
11
|
marginLeft: spaceL,
|
|
12
12
|
},
|
|
13
|
+
icon: {
|
|
14
|
+
position: "absolute",
|
|
15
|
+
right: spaceM,
|
|
16
|
+
top: spaceM,
|
|
17
|
+
zIndex: 4,
|
|
18
|
+
},
|
|
13
19
|
});
|
|
14
20
|
export { style };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { useDevice } from "@lookiero/aurora-next/build/contexts/Device/Device";
|
|
2
|
+
const useScreenSize = () => {
|
|
3
|
+
const { screen } = useDevice();
|
|
4
|
+
const screenSize = Object.entries(screen)
|
|
5
|
+
.filter(([key]) => ["S", "M", "L"].includes(key))
|
|
6
|
+
.find(([, value]) => value);
|
|
7
|
+
return screenSize?.[0];
|
|
8
|
+
};
|
|
9
|
+
export { useScreenSize };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PortalProvider } from "@gorhom/portal";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
4
|
+
import { Outlet } from "react-router-native";
|
|
5
|
+
const App = () => (React.createElement(SafeAreaProvider, null,
|
|
6
|
+
React.createElement(PortalProvider, null,
|
|
7
|
+
React.createElement(Outlet, null))));
|
|
8
|
+
export { App };
|
|
@@ -7,10 +7,10 @@ import React, { useCallback } from "react";
|
|
|
7
7
|
import { View } from "react-native";
|
|
8
8
|
import { useSetCheckoutIntroShown } from "../../../domain/uiSetting/react/useSetCheckoutIntroShown";
|
|
9
9
|
import { useViewFiveItemsDiscountByCustomerId } from "../../../projection/checkout/react/useViewFiveItemsDiscountByCustomerId";
|
|
10
|
-
import { Spinner } from "../../components/atoms/spinner/Spinner";
|
|
11
10
|
import { Body } from "../../components/layouts/body/Body";
|
|
12
11
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
13
12
|
import { I18nMessages } from "../../i18n/i18n";
|
|
13
|
+
import { Spinner } from "../../shared/components/atoms/spinner/Spinner";
|
|
14
14
|
import { style } from "./Intro.style";
|
|
15
15
|
const Bullet = ({ text }) => (React.createElement(View, { style: style.bullet },
|
|
16
16
|
React.createElement(Icon, { name: "rounded-tick", style: style.tickIcon }),
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
|
|
2
1
|
import { QueryStatus } from "@lookiero/messaging-react";
|
|
3
2
|
import React, { useCallback, useState } from "react";
|
|
4
|
-
import { View } from "react-native";
|
|
3
|
+
import { Text, TouchableHighlight, View } from "react-native";
|
|
5
4
|
import { useParams } from "react-router-native";
|
|
6
5
|
import "../../../../projection/checkout/viewFirstAvailableCheckoutByCustomerId";
|
|
7
6
|
import { useViewFirstAvailableCheckoutByCustomerId } from "../../../projection/checkout/react/useViewFirstAvailableCheckoutByCustomerId";
|
|
8
7
|
import { returnQuestions as returnQuestionsMock } from "../../../projection/returnQuestion/returnQuestions.mock";
|
|
9
|
-
import { Spinner } from "../../components/atoms/spinner/Spinner";
|
|
10
8
|
import { Body } from "../../components/layouts/body/Body";
|
|
11
9
|
import { SafeAreaScrollView } from "../../components/templates/SafeAreaScrollView";
|
|
10
|
+
import { Spinner } from "../../shared/components/atoms/spinner/Spinner";
|
|
12
11
|
import { style } from "./Item.style";
|
|
13
12
|
import { ProductVariantDescription } from "./components/productVariantDescription/ProductVariantDescription";
|
|
14
13
|
import { ProductVariantSlider } from "./components/productVariantSlider/ProductVariantSlider";
|
|
@@ -21,7 +20,7 @@ const Item = ({ customerId }) => {
|
|
|
21
20
|
const { id } = useParams();
|
|
22
21
|
const [checkout, status] = useViewFirstAvailableCheckoutByCustomerId({ customerId });
|
|
23
22
|
const checkoutItem = checkout?.items.find((checkoutItem) => checkoutItem.id === id);
|
|
24
|
-
const [returnQuestionsVisible, setReturnQuestionsVisible] = useState(
|
|
23
|
+
const [returnQuestionsVisible, setReturnQuestionsVisible] = useState(false);
|
|
25
24
|
const handleOnShowReturnQuestions = useCallback(() => setReturnQuestionsVisible(true), []);
|
|
26
25
|
const handleOnHideReturnQuestions = useCallback(() => setReturnQuestionsVisible(false), []);
|
|
27
26
|
if (status === QueryStatus.LOADING)
|
|
@@ -35,7 +34,8 @@ const Item = ({ customerId }) => {
|
|
|
35
34
|
React.createElement(View, { style: style.sliderContainer },
|
|
36
35
|
React.createElement(ProductVariantSlider, { producVariantMedia: media })),
|
|
37
36
|
React.createElement(ProductVariantDescription, { brand: brand, name: name, price: price, size: size, color: color }),
|
|
38
|
-
React.createElement(
|
|
37
|
+
React.createElement(TouchableHighlight, { onPress: handleOnShowReturnQuestions },
|
|
38
|
+
React.createElement(Text, { style: { padding: 16 } }, "show return questions")))),
|
|
39
39
|
React.createElement(ReturnQuestionsForm, { feedback: feedback, returnQuestions: returnQuestions, visible: returnQuestionsVisible, onClose: handleOnHideReturnQuestions })));
|
|
40
40
|
};
|
|
41
41
|
export { Item };
|
package/dist/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useState } from "react";
|
|
2
2
|
import { Image } from "react-native";
|
|
3
|
-
import { Slider } from "../../../../components/layouts/slider/Slider";
|
|
4
3
|
import { useMediaImage } from "../../../../hooks/useMediaImage";
|
|
4
|
+
import { Slider } from "../../../../shared/components/layouts/slider/Slider";
|
|
5
5
|
import { style } from "./ProductVariantSlider.style";
|
|
6
6
|
const ProductVariantSlider = ({ producVariantMedia }) => {
|
|
7
7
|
const cdnImageUrl = useMediaImage();
|
package/dist/infrastructure/ui/views/item/components/returnQuestionsForm/ReturnQuestionsForm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Modal } from "@lookiero/aurora-next/build/components/molecules/Modal/Modal";
|
|
1
|
+
import { PortalHost } from "@gorhom/portal";
|
|
3
2
|
import React from "react";
|
|
4
3
|
import { ScrollView, View } from "react-native";
|
|
4
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
5
|
import { ReturnQuestionType, } from "../../../../../../projection/returnQuestion/returnQuestion";
|
|
6
6
|
import { ReturnQuestions } from "../../../../components/organisms/returnQuestions/ReturnQuestions";
|
|
7
7
|
import { ReturnQuestionFeedbackProvider } from "../../../../components/organisms/returnQuestions/behaviors/useReturnQuestionFeedback";
|
|
@@ -11,19 +11,27 @@ import { HostSelectReturnQuestionItem } from "../../../../components/organisms/r
|
|
|
11
11
|
import { HostStackReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/hostStackReturnQuestionItem/HostStackReturnQuestionItem";
|
|
12
12
|
import { OptionReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/optionReturnQuestionItem/OptionReturnQuestionItem";
|
|
13
13
|
import { TextareaReturnQuestionItem } from "../../../../components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem";
|
|
14
|
+
import { Modal } from "../../../../shared/components/layouts/modal/Modal";
|
|
15
|
+
import { theme } from "../../../../theme/theme";
|
|
14
16
|
import { style } from "./ReturnQuestionsForm.style";
|
|
17
|
+
const { spaceXL } = theme();
|
|
18
|
+
const RETURN_QUESTION_FORM_PORTAL_HOST_NAME = "return-question-form-portal";
|
|
15
19
|
const returnQuestionItems = {
|
|
16
20
|
[ReturnQuestionType.HOST_DEFAULT]: HostDefaultReturnQuestionItem,
|
|
21
|
+
[ReturnQuestionType.HOST_TEXTAREA]: HostDefaultReturnQuestionItem,
|
|
17
22
|
[ReturnQuestionType.HOST_SELECT]: HostSelectReturnQuestionItem,
|
|
18
23
|
[ReturnQuestionType.HOST_STACK]: HostStackReturnQuestionItem,
|
|
19
24
|
[ReturnQuestionType.TEXTAREA]: TextareaReturnQuestionItem,
|
|
20
25
|
[ReturnQuestionType.OPTION]: OptionReturnQuestionItem,
|
|
21
26
|
};
|
|
22
|
-
const ReturnQuestionsForm = ({ feedback, returnQuestions, onClose, visible }) =>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
React.createElement(
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const ReturnQuestionsForm = ({ feedback, returnQuestions, onClose, visible }) => {
|
|
28
|
+
const { bottom: safeAreaInsetBottom } = useSafeAreaInsets();
|
|
29
|
+
return (React.createElement(ReturnQuestionFeedbackProvider, { feedback: feedback },
|
|
30
|
+
React.createElement(ReturnQuestionItemProvider, { returnQuestionItems: returnQuestionItems },
|
|
31
|
+
React.createElement(PortalHost, { name: RETURN_QUESTION_FORM_PORTAL_HOST_NAME }),
|
|
32
|
+
React.createElement(Modal, { visible: visible, onClose: onClose, portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME },
|
|
33
|
+
React.createElement(ScrollView, null,
|
|
34
|
+
React.createElement(View, { style: [style.returnQuestionsContainer, { paddingBottom: spaceXL + safeAreaInsetBottom }] },
|
|
35
|
+
React.createElement(ReturnQuestions, { returnQuestions: returnQuestions, portalHostName: RETURN_QUESTION_FORM_PORTAL_HOST_NAME })))))));
|
|
36
|
+
};
|
|
29
37
|
export { ReturnQuestionsForm };
|
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
declare const style: {
|
|
2
|
-
scrollContainer: {
|
|
3
|
-
flex: number;
|
|
4
|
-
flexGrow: number;
|
|
5
|
-
};
|
|
6
|
-
modal: {
|
|
7
|
-
zIndex: number;
|
|
8
|
-
};
|
|
9
|
-
backButton: {
|
|
10
|
-
top: number;
|
|
11
|
-
right: number;
|
|
12
|
-
alignSelf: "flex-end";
|
|
13
|
-
zIndex: number;
|
|
14
|
-
};
|
|
15
2
|
returnQuestionsContainer: {
|
|
16
3
|
paddingBottom: number;
|
|
4
|
+
paddingHorizontal: number;
|
|
17
5
|
};
|
|
18
6
|
};
|
|
19
7
|
export { style };
|
|
@@ -1,22 +1,10 @@
|
|
|
1
1
|
import { StyleSheet } from "react-native";
|
|
2
2
|
import { theme } from "../../../../theme/theme";
|
|
3
|
-
const {
|
|
3
|
+
const { spaceXL } = theme();
|
|
4
4
|
const style = StyleSheet.create({
|
|
5
|
-
scrollContainer: {
|
|
6
|
-
flex: 1,
|
|
7
|
-
flexGrow: 1,
|
|
8
|
-
},
|
|
9
|
-
modal: {
|
|
10
|
-
zIndex: 1,
|
|
11
|
-
},
|
|
12
|
-
backButton: {
|
|
13
|
-
top: -spaceXL,
|
|
14
|
-
right: -spaceM,
|
|
15
|
-
alignSelf: "flex-end",
|
|
16
|
-
zIndex: 20,
|
|
17
|
-
},
|
|
18
5
|
returnQuestionsContainer: {
|
|
19
6
|
paddingBottom: spaceXL,
|
|
7
|
+
paddingHorizontal: spaceXL,
|
|
20
8
|
},
|
|
21
9
|
});
|
|
22
10
|
export { style };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var ReturnQuestionType;
|
|
2
2
|
(function (ReturnQuestionType) {
|
|
3
3
|
ReturnQuestionType["HOST_DEFAULT"] = "HOST_DEFAULT";
|
|
4
|
+
ReturnQuestionType["HOST_TEXTAREA"] = "HOST_TEXTAREA";
|
|
4
5
|
ReturnQuestionType["HOST_SELECT"] = "HOST_SELECT";
|
|
5
6
|
ReturnQuestionType["HOST_STACK"] = "HOST_STACK";
|
|
6
7
|
ReturnQuestionType["TEXTAREA"] = "TEXTAREA";
|