@lookiero/checkout 9.5.0 → 9.7.0-beta.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.
Files changed (36) hide show
  1. package/dist/public/public/assets/adaptive-icon.png +0 -0
  2. package/dist/public/public/assets/favicon.png +0 -0
  3. package/dist/public/public/assets/icon.png +0 -0
  4. package/dist/public/public/assets/splash.png +0 -0
  5. package/dist/public/public/images/not-found.png +0 -0
  6. package/dist/src/ExpoRoot.js +1 -1
  7. package/dist/src/infrastructure/ui/Root.js +1 -1
  8. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.js +3 -2
  9. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.d.ts +10 -0
  10. package/dist/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.js +15 -0
  11. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.js +2 -3
  12. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.js +3 -3
  13. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.d.ts +7 -0
  14. package/dist/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.js +10 -1
  15. package/dist/src/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.js +1 -2
  16. package/dist/src/shared/ui/components/atoms/field/Field.js +12 -15
  17. package/dist/src/version.d.ts +1 -1
  18. package/dist/src/version.js +1 -1
  19. package/package.json +2 -2
  20. package/src/ExpoRoot.tsx +1 -1
  21. package/src/infrastructure/ui/Root.tsx +1 -1
  22. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.style.ts +19 -0
  23. package/src/infrastructure/ui/components/organisms/checkoutQuestions/components/textareaCheckoutQuestionItem/TextareaCheckoutQuestionItem.tsx +17 -6
  24. package/src/infrastructure/ui/components/organisms/returnQuestions/components/hostSelectReturnQuestionItem/HostSelectReturnQuestionItem.tsx +17 -3
  25. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.style.ts +11 -1
  26. package/src/infrastructure/ui/components/organisms/returnQuestions/components/textareaReturnQuestionItem/TextareaReturnQuestionItem.tsx +17 -7
  27. package/src/infrastructure/ui/views/item/components/productVariantSlider/ProductVariantSlider.tsx +1 -1
  28. package/src/shared/ui/components/atoms/aspectRatioView/AspectRatioView.tsx +0 -46
  29. package/src/shared/ui/components/atoms/field/Field.style.ts +0 -22
  30. package/src/shared/ui/components/atoms/field/Field.test.tsx +0 -19
  31. package/src/shared/ui/components/atoms/field/Field.tsx +0 -54
  32. package/src/shared/ui/components/atoms/field/__snapshots__/Field.test.tsx.snap +0 -225
  33. package/src/shared/ui/components/molecules/inputField/InputField.style.ts +0 -40
  34. package/src/shared/ui/components/molecules/inputField/InputField.test.tsx +0 -41
  35. package/src/shared/ui/components/molecules/inputField/InputField.tsx +0 -97
  36. package/src/shared/ui/components/molecules/inputField/__snapshots__/InputField.test.tsx.snap +0 -172
@@ -24,7 +24,7 @@ const order = {
24
24
  coupon: "MYLOOKIERO",
25
25
  };
26
26
  const customer = {
27
- customerId: "9413fe3a-09fc-4264-905e-040bb7b4ca75",
27
+ customerId: "74cb4f76-3f14-4983-81a6-2ee2a9a275d4",
28
28
  country: Country.ES,
29
29
  segment: Segment.WOMEN,
30
30
  };
@@ -19,6 +19,6 @@ const root = ({ Messaging, I18n, getAuthToken, development, sentry, kameleoon: k
19
19
  * It's important to not call sentryLoggerHOC each time this function gets called.
20
20
  * That's why its called outside this method.
21
21
  */
22
- return ({ customerId, rootClient }) => hoc({ customerId, rootClient })(Root);
22
+ return ({ customerId }) => hoc({ customerId })(Root);
23
23
  };
24
24
  export { root };
@@ -1,12 +1,13 @@
1
1
  import React, { useCallback, useMemo } from "react";
2
2
  import { useIntl } from "@lookiero/i18n-react";
3
- import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
3
+ import { InputField, TextInput } from "@lookiero/sty-psp-ui";
4
4
  import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
5
+ import { style } from "./TextareaCheckoutQuestionItem.style";
5
6
  const TextareaCheckoutQuestionItem = ({ checkoutQuestion, checkoutQuestionParentId, testID, }) => {
6
7
  const { formatMessage } = useIntl();
7
8
  const placeholderText = useMemo(() => (checkoutQuestion.placeholder ? formatMessage({ id: checkoutQuestion.placeholder }) : ""), [formatMessage, checkoutQuestion.placeholder]);
8
9
  const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
9
10
  const handleOnChange = useCallback((value) => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: value }), [onChange, checkoutQuestionParentId]);
10
- return (React.createElement(InputField, { label: placeholderText, placeholder: placeholderText, testID: testID, value: feedback, multiline: true, onChange: handleOnChange }));
11
+ return (React.createElement(InputField, { label: placeholderText, style: { input: { container: style.inputContainer, input: style.input } }, value: feedback, input: ({ onBlur, onFocus, style }) => (React.createElement(TextInput, { placeholder: placeholderText, style: style, testID: testID, value: feedback, multiline: true, onBlur: onBlur, onChange: handleOnChange, onFocus: onFocus })) }));
11
12
  };
12
13
  export { TextareaCheckoutQuestionItem };
@@ -0,0 +1,10 @@
1
+ declare const style: {
2
+ input: {
3
+ paddingTop: number;
4
+ };
5
+ inputContainer: {
6
+ maxHeight: number;
7
+ minHeight: number;
8
+ };
9
+ };
10
+ export { style };
@@ -0,0 +1,15 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "@lookiero/sty-psp-ui";
3
+ const { space4 } = theme();
4
+ const INPUT_MIN_HEIGHT = 96;
5
+ const INPUT_MAX_HEIGHT = 242;
6
+ const style = StyleSheet.create({
7
+ input: {
8
+ paddingTop: space4,
9
+ },
10
+ inputContainer: {
11
+ maxHeight: INPUT_MAX_HEIGHT,
12
+ minHeight: INPUT_MIN_HEIGHT,
13
+ },
14
+ });
15
+ export { style };
@@ -3,8 +3,7 @@ import React, { useCallback, useEffect, useMemo, useState } from "react";
3
3
  import { TouchableHighlight, View } from "react-native";
4
4
  import { ButtonIcon } from "@lookiero/aurora";
5
5
  import { useIntl } from "@lookiero/i18n-react";
6
- import { Modal } from "@lookiero/sty-psp-ui";
7
- import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
6
+ import { InputField, Modal, TextInput } from "@lookiero/sty-psp-ui";
8
7
  import { useReturnQuestionFeedback, useReturnQuestionFeedbackForReturnQuestion, } from "../../behaviors/useReturnQuestionFeedback";
9
8
  import { deepestReturnQuestionWithFeedbackForReturnQuestion, feedbackForReturnQuestion, } from "../../util/returnQuestionFeedback";
10
9
  import { style, containerUnderlayColor } from "./HostSelectReturnQuestionItem.style";
@@ -34,7 +33,7 @@ const HostSelectReturnQuestionItem = ({ returnQuestion, children, portalHostName
34
33
  return (React.createElement(React.Fragment, null,
35
34
  React.createElement(TouchableHighlight, { accessibilityLabel: testID, style: style.container, testID: testID, underlayColor: containerUnderlayColor, accessible: true, onPress: handleOnPress },
36
35
  React.createElement(View, { pointerEvents: "none" },
37
- React.createElement(InputField, { editable: false, icon: "arrow_down", label: placeholderText, value: inputValue }))),
36
+ React.createElement(InputField, { icon: "arrow_down", label: placeholderText, value: inputValue, input: ({ onBlur, onFocus, style }) => (React.createElement(TextInput, { editable: false, placeholder: placeholderText, style: style, value: inputValue, onBlur: onBlur, onChange: () => void 0, onFocus: onFocus })) }))),
38
37
  React.createElement(Modal, { portalHostName: portalHostName, style: deepestReturnQuestionWithFeedback && { header: style.header }, visible: modalVisible, header: deepestReturnQuestionWithFeedback && (React.createElement(ButtonIcon, { name: "arrow_left", style: style.backButton, testID: "modal-back-button", onPress: handleOnBackButtonPress })), scroll: true, showCloseButton: true, onClose: handleOnModalClose },
39
38
  React.createElement(View, { style: style.modalContent }, children))));
40
39
  };
@@ -2,7 +2,7 @@
2
2
  import React, { useCallback, useMemo } from "react";
3
3
  import { View } from "@lookiero/aurora";
4
4
  import { useIntl } from "@lookiero/i18n-react";
5
- import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
5
+ import { InputField, TextInput } from "@lookiero/sty-psp-ui";
6
6
  import { useReturnQuestionFeedbackForReturnQuestion } from "../../behaviors/useReturnQuestionFeedback";
7
7
  import { style } from "./TextareaReturnQuestionItem.style";
8
8
  const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParent, testID, }) => {
@@ -10,7 +10,7 @@ const TextareaReturnQuestionItem = ({ returnQuestion, returnQuestionParent, test
10
10
  const placeholderText = useMemo(() => (returnQuestion.metadata.placeholder ? formatMessage({ id: returnQuestion.metadata.placeholder }) : ""), [formatMessage, returnQuestion.metadata.placeholder]);
11
11
  const { feedback, onChange } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
12
12
  const handleOnChange = useCallback((value) => onChange({ returnQuestionId: returnQuestionParent.id, returnQuestionFeedback: value }), [onChange, returnQuestionParent.id]);
13
- return (React.createElement(View, { style: style.wrapper },
14
- React.createElement(InputField, { label: placeholderText, placeholder: placeholderText, testID: testID, value: feedback, multiline: true, onChange: handleOnChange })));
13
+ return (React.createElement(View, { style: style.wrapper, testID: "textarea-return-question-item" },
14
+ React.createElement(InputField, { label: placeholderText, style: { input: { container: style.inputContainer, input: style.input } }, value: feedback, input: ({ onBlur, onFocus, style }) => (React.createElement(TextInput, { placeholder: placeholderText, style: style, testID: testID, value: feedback, multiline: true, onBlur: onBlur, onChange: handleOnChange, onFocus: onFocus })) })));
15
15
  };
16
16
  export { TextareaReturnQuestionItem };
@@ -1,4 +1,11 @@
1
1
  declare const style: {
2
+ input: {
3
+ paddingTop: number;
4
+ };
5
+ inputContainer: {
6
+ maxHeight: number;
7
+ minHeight: number;
8
+ };
2
9
  wrapper: {
3
10
  backgroundColor: string;
4
11
  padding: number;
@@ -1,7 +1,16 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "@lookiero/sty-psp-ui";
3
- const { colorBgBase, space6 } = theme();
3
+ const { colorBgBase, space4, space6 } = theme();
4
+ const INPUT_MIN_HEIGHT = 96;
5
+ const INPUT_MAX_HEIGHT = 242;
4
6
  const style = StyleSheet.create({
7
+ input: {
8
+ paddingTop: space4,
9
+ },
10
+ inputContainer: {
11
+ maxHeight: INPUT_MAX_HEIGHT,
12
+ minHeight: INPUT_MIN_HEIGHT,
13
+ },
5
14
  wrapper: {
6
15
  backgroundColor: colorBgBase,
7
16
  padding: space6,
@@ -1,7 +1,6 @@
1
1
  import React, { useCallback, useState } from "react";
2
- import { Bullets, Carousel, LazyImage, theme, useScreenSize, } from "@lookiero/sty-psp-ui";
2
+ import { AspectRatioView, Bullets, Carousel, LazyImage, theme, useScreenSize, } from "@lookiero/sty-psp-ui";
3
3
  import { MediaPerspective } from "../../../../../../projection/checkoutItem/checkoutItem";
4
- import { AspectRatioView } from "../../../../../../shared/ui/components/atoms/aspectRatioView/AspectRatioView";
5
4
  import { useMediaImage } from "../../../../hooks/useMediaImage";
6
5
  import { style } from "./ProductVariantSlider.style";
7
6
  const { space16 } = theme();
@@ -1,6 +1,6 @@
1
+ import { animated, useSpring } from "@react-spring/native";
1
2
  import React, { useCallback, useState } from "react";
2
3
  import { View } from "react-native";
3
- import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
4
4
  import { Text } from "@lookiero/aurora";
5
5
  import { theme } from "@lookiero/sty-psp-ui";
6
6
  import { style } from "./Field.style";
@@ -9,20 +9,17 @@ const { space1, space4 } = theme();
9
9
  const Field = ({ label, isFocused = false, style: customStyle }) => {
10
10
  const [width, setWidth] = useState(0);
11
11
  const handleOnLayout = useCallback(({ nativeEvent: { layout } }) => setWidth(layout.width), []);
12
- const scale = useSharedValue(isFocused ? SCALE : 1);
13
- scale.value = isFocused ? SCALE : 1;
14
- const translateY = useSharedValue(isFocused ? -14 : space4);
15
- translateY.value = isFocused ? -14 : space4;
16
- const translateX = useSharedValue(isFocused ? -(((1 - SCALE) * width) / 2 + space1) : 0);
17
- translateX.value = isFocused ? -(((1 - SCALE) * width) / 2 + space1) : 0;
18
- const animatedStyle = useAnimatedStyle(() => ({
19
- transform: [
20
- { scale: withTiming(scale.value) },
21
- { translateY: withTiming(translateY.value) },
22
- { translateX: withTiming(translateX.value) },
23
- ],
24
- }), [scale.value, translateX.value, translateY.value]);
25
- return (React.createElement(Animated.View, { pointerEvents: "none", style: [customStyle?.field, animatedStyle], onLayout: handleOnLayout },
12
+ const springs = useSpring(isFocused
13
+ ? { scale: SCALE, translateY: -14, translateX: -(((1 - SCALE) * width) / 2 + space1) }
14
+ : { scale: 1, translateY: space4, translateX: 0 });
15
+ return (React.createElement(animated.View, { pointerEvents: "none", style: [
16
+ {
17
+ transform: [{ scale: springs.scale }, { translateY: springs.translateY }, { translateX: springs.translateX }],
18
+ },
19
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
20
+ // @ts-ignore
21
+ customStyle?.field,
22
+ ], onLayout: handleOnLayout },
26
23
  React.createElement(Text, { level: 1, numberOfLines: 1, style: [style.fieldText, customStyle?.fieldText], detail: true }, label),
27
24
  React.createElement(View, { style: [style.fieldBackground, { opacity: isFocused ? 1 : 0 }] })));
28
25
  };
@@ -1 +1 @@
1
- export declare const VERSION = "9.5.0";
1
+ export declare const VERSION = "9.7.0-beta.0";
@@ -1 +1 @@
1
- export const VERSION = "9.5.0";
1
+ export const VERSION = "9.7.0-beta.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "9.5.0",
3
+ "version": "9.7.0-beta.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": "false",
@@ -26,7 +26,7 @@
26
26
  "@lookiero/sty-psp-http": "^2.0",
27
27
  "@lookiero/sty-psp-i18n": "^0.2",
28
28
  "@lookiero/sty-psp-locale": "^0.4",
29
- "@lookiero/sty-psp-logging": "^0.4",
29
+ "@lookiero/sty-psp-logging": "^0.5",
30
30
  "@lookiero/sty-psp-notifications": "^0.6",
31
31
  "@lookiero/sty-psp-react-native": "^0.3",
32
32
  "@lookiero/sty-psp-segment": "^0.1",
package/src/ExpoRoot.tsx CHANGED
@@ -32,7 +32,7 @@ const order: Order = {
32
32
  };
33
33
 
34
34
  const customer: Customer = {
35
- customerId: "9413fe3a-09fc-4264-905e-040bb7b4ca75",
35
+ customerId: "74cb4f76-3f14-4983-81a6-2ee2a9a275d4",
36
36
  country: Country.ES,
37
37
  segment: Segment.WOMEN,
38
38
  };
@@ -86,7 +86,7 @@ const root: RootFunction = ({ Messaging, I18n, getAuthToken, development, sentry
86
86
  * It's important to not call sentryLoggerHOC each time this function gets called.
87
87
  * That's why its called outside this method.
88
88
  */
89
- return ({ customerId, rootClient }) => hoc({ customerId, rootClient })(Root);
89
+ return ({ customerId }) => hoc({ customerId })(Root);
90
90
  };
91
91
 
92
92
  export type { RootProps };
@@ -0,0 +1,19 @@
1
+ import { StyleSheet } from "react-native";
2
+ import { theme } from "@lookiero/sty-psp-ui";
3
+
4
+ const { space4 } = theme();
5
+
6
+ const INPUT_MIN_HEIGHT = 96;
7
+ const INPUT_MAX_HEIGHT = 242;
8
+
9
+ const style = StyleSheet.create({
10
+ input: {
11
+ paddingTop: space4,
12
+ },
13
+ inputContainer: {
14
+ maxHeight: INPUT_MAX_HEIGHT,
15
+ minHeight: INPUT_MIN_HEIGHT,
16
+ },
17
+ });
18
+
19
+ export { style };
@@ -1,8 +1,9 @@
1
1
  import React, { useCallback, useMemo } from "react";
2
2
  import { useIntl } from "@lookiero/i18n-react";
3
- import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
3
+ import { InputField, TextInput } from "@lookiero/sty-psp-ui";
4
4
  import { useCheckoutQuestionFeedbackForId } from "../../behaviors/useCheckoutQuestionFeedback";
5
5
  import { CheckoutQuestionItem, CheckoutQuestionItemProps } from "../CheckoutQuestionItem";
6
+ import { style } from "./TextareaCheckoutQuestionItem.style";
6
7
 
7
8
  const TextareaCheckoutQuestionItem: CheckoutQuestionItem = ({
8
9
  checkoutQuestion,
@@ -17,18 +18,28 @@ const TextareaCheckoutQuestionItem: CheckoutQuestionItem = ({
17
18
 
18
19
  const { feedback, onChange } = useCheckoutQuestionFeedbackForId({ id: checkoutQuestionParentId });
19
20
  const handleOnChange = useCallback(
20
- (value: string) => onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: value }),
21
+ (value: string | undefined) =>
22
+ onChange({ checkoutQuestionId: checkoutQuestionParentId, checkoutQuestionFeedback: value }),
21
23
  [onChange, checkoutQuestionParentId],
22
24
  );
23
25
 
24
26
  return (
25
27
  <InputField
26
28
  label={placeholderText}
27
- placeholder={placeholderText}
28
- testID={testID}
29
+ style={{ input: { container: style.inputContainer, input: style.input } }}
29
30
  value={feedback}
30
- multiline
31
- onChange={handleOnChange}
31
+ input={({ onBlur, onFocus, style }) => (
32
+ <TextInput
33
+ placeholder={placeholderText}
34
+ style={style}
35
+ testID={testID}
36
+ value={feedback}
37
+ multiline
38
+ onBlur={onBlur}
39
+ onChange={handleOnChange}
40
+ onFocus={onFocus}
41
+ />
42
+ )}
32
43
  />
33
44
  );
34
45
  };
@@ -3,9 +3,8 @@ import React, { useCallback, useEffect, useMemo, useState } from "react";
3
3
  import { TouchableHighlight, View } from "react-native";
4
4
  import { ButtonIcon } from "@lookiero/aurora";
5
5
  import { useIntl } from "@lookiero/i18n-react";
6
- import { Modal } from "@lookiero/sty-psp-ui";
6
+ import { InputField, Modal, TextInput } from "@lookiero/sty-psp-ui";
7
7
  import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
8
- import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
9
8
  import {
10
9
  useReturnQuestionFeedback,
11
10
  useReturnQuestionFeedbackForReturnQuestion,
@@ -71,7 +70,22 @@ const HostSelectReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.HOST_S
71
70
  onPress={handleOnPress}
72
71
  >
73
72
  <View pointerEvents="none">
74
- <InputField editable={false} icon="arrow_down" label={placeholderText} value={inputValue} />
73
+ <InputField
74
+ icon="arrow_down"
75
+ label={placeholderText}
76
+ value={inputValue}
77
+ input={({ onBlur, onFocus, style }) => (
78
+ <TextInput
79
+ editable={false}
80
+ placeholder={placeholderText}
81
+ style={style}
82
+ value={inputValue}
83
+ onBlur={onBlur}
84
+ onChange={() => void 0}
85
+ onFocus={onFocus}
86
+ />
87
+ )}
88
+ />
75
89
  </View>
76
90
  </TouchableHighlight>
77
91
  <Modal
@@ -1,9 +1,19 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "@lookiero/sty-psp-ui";
3
3
 
4
- const { colorBgBase, space6 } = theme();
4
+ const { colorBgBase, space4, space6 } = theme();
5
+
6
+ const INPUT_MIN_HEIGHT = 96;
7
+ const INPUT_MAX_HEIGHT = 242;
5
8
 
6
9
  const style = StyleSheet.create({
10
+ input: {
11
+ paddingTop: space4,
12
+ },
13
+ inputContainer: {
14
+ maxHeight: INPUT_MAX_HEIGHT,
15
+ minHeight: INPUT_MIN_HEIGHT,
16
+ },
7
17
  wrapper: {
8
18
  backgroundColor: colorBgBase,
9
19
  padding: space6,
@@ -2,8 +2,8 @@
2
2
  import React, { useCallback, useMemo } from "react";
3
3
  import { View } from "@lookiero/aurora";
4
4
  import { useIntl } from "@lookiero/i18n-react";
5
+ import { InputField, TextInput } from "@lookiero/sty-psp-ui";
5
6
  import { ReturnQuestionType } from "../../../../../../../projection/returnQuestion/returnQuestion.constants";
6
- import { InputField } from "../../../../../../../shared/ui/components/molecules/inputField/InputField";
7
7
  import { useReturnQuestionFeedbackForReturnQuestion } from "../../behaviors/useReturnQuestionFeedback";
8
8
  import { ReturnQuestionItem } from "../ReturnQuestionItem";
9
9
  import { style } from "./TextareaReturnQuestionItem.style";
@@ -22,19 +22,29 @@ const TextareaReturnQuestionItem: ReturnQuestionItem<ReturnQuestionType.TEXTAREA
22
22
 
23
23
  const { feedback, onChange } = useReturnQuestionFeedbackForReturnQuestion({ returnQuestion: returnQuestionParent });
24
24
  const handleOnChange = useCallback(
25
- (value: string) => onChange({ returnQuestionId: returnQuestionParent.id, returnQuestionFeedback: value }),
25
+ (value: string | undefined) =>
26
+ onChange({ returnQuestionId: returnQuestionParent.id, returnQuestionFeedback: value }),
26
27
  [onChange, returnQuestionParent.id],
27
28
  );
28
29
 
29
30
  return (
30
- <View style={style.wrapper}>
31
+ <View style={style.wrapper} testID="textarea-return-question-item">
31
32
  <InputField
32
33
  label={placeholderText}
33
- placeholder={placeholderText}
34
- testID={testID}
34
+ style={{ input: { container: style.inputContainer, input: style.input } }}
35
35
  value={feedback}
36
- multiline
37
- onChange={handleOnChange}
36
+ input={({ onBlur, onFocus, style }) => (
37
+ <TextInput
38
+ placeholder={placeholderText}
39
+ style={style}
40
+ testID={testID}
41
+ value={feedback}
42
+ multiline
43
+ onBlur={onBlur}
44
+ onChange={handleOnChange}
45
+ onFocus={onFocus}
46
+ />
47
+ )}
38
48
  />
39
49
  </View>
40
50
  );
@@ -1,5 +1,6 @@
1
1
  import React, { FC, useCallback, useState } from "react";
2
2
  import {
3
+ AspectRatioView,
3
4
  Bullets,
4
5
  Carousel,
5
6
  LazyImage,
@@ -9,7 +10,6 @@ import {
9
10
  useScreenSize,
10
11
  } from "@lookiero/sty-psp-ui";
11
12
  import { MediaPerspective, MediaProjection } from "../../../../../../projection/checkoutItem/checkoutItem";
12
- import { AspectRatioView } from "../../../../../../shared/ui/components/atoms/aspectRatioView/AspectRatioView";
13
13
  import { useMediaImage } from "../../../../hooks/useMediaImage";
14
14
  import { style } from "./ProductVariantSlider.style";
15
15
 
@@ -1,46 +0,0 @@
1
- import React, { FC, ReactNode, useCallback, useState } from "react";
2
- import { LayoutChangeEvent, StyleProp, View, ViewStyle } from "react-native";
3
-
4
- interface Dimension {
5
- readonly width?: number | undefined;
6
- readonly height?: number | undefined;
7
- }
8
-
9
- enum AspectRatioViewResizeDirection {
10
- VERTICAL = "VERTICAL",
11
- HORIZONTAL = "HORIZONTAL",
12
- }
13
-
14
- interface AspectRatioViewProps {
15
- readonly aspectRatio?: number;
16
- readonly resizeDirection?: AspectRatioViewResizeDirection;
17
- readonly multiplier?: number;
18
- readonly children: ReactNode;
19
- readonly style?: StyleProp<ViewStyle>;
20
- }
21
- const AspectRatioView: FC<AspectRatioViewProps> = ({
22
- aspectRatio = 1,
23
- resizeDirection = AspectRatioViewResizeDirection.HORIZONTAL,
24
- multiplier = 1,
25
- style: customStyle = {},
26
- children,
27
- }) => {
28
- const [{ width, height }, setDimension] = useState<Dimension>({});
29
- const handleOnLayout = useCallback(
30
- ({ nativeEvent: { layout } }: LayoutChangeEvent) =>
31
- setDimension(
32
- resizeDirection === AspectRatioViewResizeDirection.HORIZONTAL
33
- ? { width: layout.width * multiplier, height: layout.width * aspectRatio }
34
- : { width: layout.height * aspectRatio, height: layout.height },
35
- ),
36
- [aspectRatio, multiplier, resizeDirection],
37
- );
38
-
39
- return (
40
- <View onLayout={handleOnLayout}>
41
- <View style={[{ width, height }, customStyle]}>{children}</View>
42
- </View>
43
- );
44
- };
45
-
46
- export { AspectRatioView, AspectRatioViewResizeDirection };
@@ -1,22 +0,0 @@
1
- import { StyleSheet } from "react-native";
2
- import { theme } from "@lookiero/sty-psp-ui";
3
-
4
- const { colorBgBase, space1 } = theme();
5
-
6
- const style = StyleSheet.create({
7
- fieldBackground: {
8
- backgroundColor: colorBgBase,
9
- height: "100%",
10
- position: "absolute",
11
- width: "100%",
12
- zIndex: 0,
13
- },
14
- fieldText: {
15
- flexWrap: "nowrap",
16
- overflow: "hidden",
17
- paddingHorizontal: space1,
18
- zIndex: 1,
19
- },
20
- });
21
-
22
- export { style };
@@ -1,19 +0,0 @@
1
- import React from "react";
2
- import { render } from "../../../../../infrastructure/ui/test/render";
3
- import { Field } from "./Field";
4
-
5
- const label = "Field label";
6
-
7
- describe("Field atom", () => {
8
- it("matches the snapshot for a non-focused", () => {
9
- const { toJSON } = render(<Field label={label} />);
10
-
11
- expect(toJSON()).toMatchSnapshot("non-focused");
12
- });
13
-
14
- it("matches the snapshot for focused", () => {
15
- const { toJSON } = render(<Field label={label} isFocused />);
16
-
17
- expect(toJSON()).toMatchSnapshot("focused");
18
- });
19
- });
@@ -1,54 +0,0 @@
1
- import React, { FC, useCallback, useState } from "react";
2
- import { LayoutChangeEvent, StyleProp, TextStyle, View, ViewStyle } from "react-native";
3
- import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
4
- import { Text } from "@lookiero/aurora";
5
- import { theme } from "@lookiero/sty-psp-ui";
6
- import { style } from "./Field.style";
7
-
8
- const SCALE = 0.75;
9
-
10
- const { space1, space4 } = theme();
11
-
12
- type FieldStyle = {
13
- readonly field: StyleProp<ViewStyle>;
14
- readonly fieldText: StyleProp<TextStyle>;
15
- };
16
-
17
- interface FieldProps {
18
- readonly label: string;
19
- readonly isFocused?: boolean;
20
- readonly style?: FieldStyle;
21
- }
22
- const Field: FC<FieldProps> = ({ label, isFocused = false, style: customStyle }) => {
23
- const [width, setWidth] = useState<number>(0);
24
- const handleOnLayout = useCallback(({ nativeEvent: { layout } }: LayoutChangeEvent) => setWidth(layout.width), []);
25
-
26
- const scale = useSharedValue(isFocused ? SCALE : 1);
27
- scale.value = isFocused ? SCALE : 1;
28
- const translateY = useSharedValue(isFocused ? -14 : space4);
29
- translateY.value = isFocused ? -14 : space4;
30
- const translateX = useSharedValue(isFocused ? -(((1 - SCALE) * width) / 2 + space1) : 0);
31
- translateX.value = isFocused ? -(((1 - SCALE) * width) / 2 + space1) : 0;
32
- const animatedStyle = useAnimatedStyle(
33
- () => ({
34
- transform: [
35
- { scale: withTiming(scale.value) },
36
- { translateY: withTiming(translateY.value) },
37
- { translateX: withTiming(translateX.value) },
38
- ],
39
- }),
40
- [scale.value, translateX.value, translateY.value],
41
- );
42
-
43
- return (
44
- <Animated.View pointerEvents="none" style={[customStyle?.field, animatedStyle]} onLayout={handleOnLayout}>
45
- <Text level={1} numberOfLines={1} style={[style.fieldText, customStyle?.fieldText]} detail>
46
- {label}
47
- </Text>
48
- <View style={[style.fieldBackground, { opacity: isFocused ? 1 : 0 }]} />
49
- </Animated.View>
50
- );
51
- };
52
-
53
- export type { FieldStyle };
54
- export { Field };
@@ -1,225 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`Field atom matches the snapshot for a non-focused: non-focused 1`] = `
4
- <View
5
- style={
6
- [
7
- {
8
- "backgroundColor": "#FFFFFF",
9
- "flex": 1,
10
- },
11
- ]
12
- }
13
- >
14
- <View
15
- style={
16
- [
17
- {
18
- "alignSelf": "center",
19
- "left": 0,
20
- "marginHorizontal": "auto",
21
- "position": "absolute",
22
- "right": 0,
23
- "top": 0,
24
- "width": "100%",
25
- "zIndex": 5,
26
- },
27
- ]
28
- }
29
- >
30
- <RCTSafeAreaView />
31
- </View>
32
- <View
33
- collapsable={false}
34
- jestAnimatedStyle={
35
- {
36
- "value": {
37
- "transform": [
38
- {
39
- "scale": 1,
40
- },
41
- {
42
- "translateY": 16,
43
- },
44
- {
45
- "translateX": 0,
46
- },
47
- ],
48
- },
49
- }
50
- }
51
- onLayout={[Function]}
52
- pointerEvents="none"
53
- style={
54
- {
55
- "transform": [
56
- {
57
- "scale": 1,
58
- },
59
- {
60
- "translateY": 16,
61
- },
62
- {
63
- "translateX": 0,
64
- },
65
- ],
66
- }
67
- }
68
- >
69
- <Text
70
- allowFontScaling={false}
71
- numberOfLines={1}
72
- selectable={false}
73
- style={
74
- [
75
- {
76
- "color": "#0C0A0A",
77
- "flexWrap": "nowrap",
78
- "fontFamily": "AreaNormal-Semibold",
79
- "fontSize": 13,
80
- "letterSpacing": 0.1,
81
- "lineHeight": 17,
82
- "overflow": "hidden",
83
- "paddingBottom": 0,
84
- "paddingHorizontal": 4,
85
- "paddingLeft": 0,
86
- "paddingRight": 0,
87
- "paddingTop": 4,
88
- "zIndex": 1,
89
- },
90
- ]
91
- }
92
- >
93
- Field label
94
- </Text>
95
- <View
96
- style={
97
- [
98
- {
99
- "backgroundColor": "#FFFFFF",
100
- "height": "100%",
101
- "position": "absolute",
102
- "width": "100%",
103
- "zIndex": 0,
104
- },
105
- {
106
- "opacity": 0,
107
- },
108
- ]
109
- }
110
- />
111
- </View>
112
- </View>
113
- `;
114
-
115
- exports[`Field atom matches the snapshot for focused: focused 1`] = `
116
- <View
117
- style={
118
- [
119
- {
120
- "backgroundColor": "#FFFFFF",
121
- "flex": 1,
122
- },
123
- ]
124
- }
125
- >
126
- <View
127
- style={
128
- [
129
- {
130
- "alignSelf": "center",
131
- "left": 0,
132
- "marginHorizontal": "auto",
133
- "position": "absolute",
134
- "right": 0,
135
- "top": 0,
136
- "width": "100%",
137
- "zIndex": 5,
138
- },
139
- ]
140
- }
141
- >
142
- <RCTSafeAreaView />
143
- </View>
144
- <View
145
- collapsable={false}
146
- jestAnimatedStyle={
147
- {
148
- "value": {
149
- "transform": [
150
- {
151
- "scale": 0.75,
152
- },
153
- {
154
- "translateY": -14,
155
- },
156
- {
157
- "translateX": -4,
158
- },
159
- ],
160
- },
161
- }
162
- }
163
- onLayout={[Function]}
164
- pointerEvents="none"
165
- style={
166
- {
167
- "transform": [
168
- {
169
- "scale": 0.75,
170
- },
171
- {
172
- "translateY": -14,
173
- },
174
- {
175
- "translateX": -4,
176
- },
177
- ],
178
- }
179
- }
180
- >
181
- <Text
182
- allowFontScaling={false}
183
- numberOfLines={1}
184
- selectable={false}
185
- style={
186
- [
187
- {
188
- "color": "#0C0A0A",
189
- "flexWrap": "nowrap",
190
- "fontFamily": "AreaNormal-Semibold",
191
- "fontSize": 13,
192
- "letterSpacing": 0.1,
193
- "lineHeight": 17,
194
- "overflow": "hidden",
195
- "paddingBottom": 0,
196
- "paddingHorizontal": 4,
197
- "paddingLeft": 0,
198
- "paddingRight": 0,
199
- "paddingTop": 4,
200
- "zIndex": 1,
201
- },
202
- ]
203
- }
204
- >
205
- Field label
206
- </Text>
207
- <View
208
- style={
209
- [
210
- {
211
- "backgroundColor": "#FFFFFF",
212
- "height": "100%",
213
- "position": "absolute",
214
- "width": "100%",
215
- "zIndex": 0,
216
- },
217
- {
218
- "opacity": 1,
219
- },
220
- ]
221
- }
222
- />
223
- </View>
224
- </View>
225
- `;
@@ -1,40 +0,0 @@
1
- import { StyleSheet, Platform } from "react-native";
2
- import { theme } from "@lookiero/sty-psp-ui";
3
-
4
- const { space1, space4, space6, borderRadius2, borderWidth1 } = theme();
5
-
6
- const style = StyleSheet.create({
7
- error: {
8
- marginLeft: space6,
9
- marginTop: space1,
10
- },
11
- field: {
12
- left: space4,
13
- maxWidth: "100%",
14
- position: "absolute",
15
- zIndex: 4,
16
- },
17
- icon: {
18
- height: 16,
19
- position: "absolute",
20
- right: space4,
21
- top: space4,
22
- width: 16,
23
- zIndex: 4,
24
- },
25
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
26
- // @ts-ignore
27
- input: {
28
- ...Platform.select({
29
- web: {
30
- textOverflow: "ellipsis",
31
- },
32
- }),
33
- },
34
- inputField: {
35
- borderRadius: borderRadius2,
36
- borderWidth: borderWidth1,
37
- },
38
- });
39
-
40
- export { style };
@@ -1,41 +0,0 @@
1
- import { fireEvent } from "@testing-library/react-native";
2
- import React from "react";
3
- import { render } from "../../../../../infrastructure/ui/test/render";
4
- import { InputField } from "./InputField";
5
-
6
- const label = "InputField label";
7
- const value = "InputField value";
8
- const mockOnChange = jest.fn();
9
-
10
- describe("InputField molecule", () => {
11
- it("matches the snapshot", () => {
12
- const { toJSON } = render(<InputField label={label} value={value} onChange={mockOnChange} />);
13
-
14
- expect(toJSON()).toMatchSnapshot();
15
- });
16
-
17
- it("renders correctly", () => {
18
- const { getByTestId } = render(<InputField label={label} value={value} onChange={mockOnChange} />);
19
-
20
- const newValue = "New input value";
21
- fireEvent.changeText(getByTestId("input-input"), newValue);
22
-
23
- expect(mockOnChange).toHaveBeenCalledWith(newValue);
24
- });
25
-
26
- it("renders correctly if there is error", () => {
27
- const error = "InputField error";
28
-
29
- const { getByText } = render(<InputField error={error} label={label} value={value} onChange={mockOnChange} />);
30
-
31
- expect(getByText(error)).toBeTruthy();
32
- });
33
-
34
- it.skip("renders correctly if there is an icon", () => {
35
- const { getByTestId } = render(
36
- <InputField icon="arrow_down" label={label} value={value} onChange={mockOnChange} />,
37
- );
38
-
39
- expect(getByTestId("icon")).toBeTruthy();
40
- });
41
- });
@@ -1,97 +0,0 @@
1
- import React, { FC, useCallback, useState } from "react";
2
- import { StyleProp, TextStyle, View, ViewStyle } from "react-native";
3
- import { COLOR, Icon, IconName, Input, InputProperties } from "@lookiero/aurora";
4
- import { Error, ErrorStyle, theme } from "@lookiero/sty-psp-ui";
5
- import { Field, FieldStyle } from "../../atoms/field/Field";
6
- import { style } from "./InputField.style";
7
-
8
- const {
9
- colorBgBase,
10
- colorBorderInput,
11
- colorBorderInputError,
12
- colorBorderInputFocus,
13
- colorText,
14
- colorTextError,
15
- colorTextMedium,
16
- iconSize,
17
- space6,
18
- } = theme();
19
-
20
- const inputPaddingRightWithIcon = iconSize + space6;
21
-
22
- type IconStyle = StyleProp<TextStyle>;
23
-
24
- type InputFieldStyle = FieldStyle & {
25
- readonly inputField: StyleProp<ViewStyle>;
26
- readonly error: ErrorStyle;
27
- readonly icon: IconStyle;
28
- };
29
-
30
- interface InputFieldBaseProps {
31
- readonly label: string;
32
- readonly multiline?: boolean;
33
- readonly error?: string | null;
34
- readonly style?: Partial<InputFieldStyle>;
35
- readonly onChange?: (value: string) => void;
36
- readonly icon?: IconName;
37
- }
38
-
39
- interface InputFieldProps extends Omit<InputProperties, keyof InputFieldBaseProps>, InputFieldBaseProps {}
40
-
41
- const InputField: FC<InputFieldProps> = ({
42
- label,
43
- placeholder,
44
- value,
45
- multiline = false,
46
- error,
47
- style: customStyle,
48
- onChange = () => void 0,
49
- icon,
50
- testID = "input",
51
- ...inputRestProps
52
- }) => {
53
- const [isFocused, setIsFocused] = useState(false);
54
-
55
- const handleOnChange = useCallback((text: string) => onChange(text), [onChange]);
56
-
57
- const handleOnBlur = useCallback(() => setIsFocused(false), []);
58
-
59
- const handleOnFocus = useCallback(() => setIsFocused(true), []);
60
-
61
- const borderColor = error ? colorBorderInputError : isFocused ? colorBorderInputFocus : colorBorderInput;
62
- const color = error ? colorTextError : isFocused ? colorText : colorTextMedium;
63
-
64
- return (
65
- <View style={[style.inputField, { borderColor }, customStyle?.inputField]} testID="input-field">
66
- <Field
67
- isFocused={isFocused || !!value}
68
- label={label}
69
- style={{
70
- field: [style.field, customStyle?.field],
71
- fieldText: [{ color }, customStyle?.fieldText],
72
- }}
73
- />
74
- <Input
75
- autoCapitalize="sentences"
76
- multiline={multiline}
77
- multilineMaxHeight={242}
78
- placeholder={placeholder}
79
- placeholderTextColor={isFocused ? colorTextMedium : colorBgBase}
80
- style={[!!icon && { paddingRight: inputPaddingRightWithIcon }, style.input, { color }]}
81
- testID={testID}
82
- value={value}
83
- onBlur={handleOnBlur}
84
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
85
- // @ts-ignore
86
- onChange={handleOnChange}
87
- onFocus={handleOnFocus}
88
- {...inputRestProps}
89
- />
90
- {!!icon && <Icon color={COLOR.GRAYSCALE_L} name={icon} style={[style.icon, customStyle?.icon]} testID="icon" />}
91
- {!!error && <Error error={error} style={[style.error, customStyle?.error]} />}
92
- </View>
93
- );
94
- };
95
-
96
- export type { InputFieldStyle };
97
- export { InputField };
@@ -1,172 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`InputField molecule matches the snapshot 1`] = `
4
- <View
5
- style={
6
- [
7
- {
8
- "backgroundColor": "#FFFFFF",
9
- "flex": 1,
10
- },
11
- ]
12
- }
13
- >
14
- <View
15
- style={
16
- [
17
- {
18
- "alignSelf": "center",
19
- "left": 0,
20
- "marginHorizontal": "auto",
21
- "position": "absolute",
22
- "right": 0,
23
- "top": 0,
24
- "width": "100%",
25
- "zIndex": 5,
26
- },
27
- ]
28
- }
29
- >
30
- <RCTSafeAreaView />
31
- </View>
32
- <View
33
- style={
34
- [
35
- {
36
- "borderRadius": 4,
37
- "borderWidth": 1,
38
- },
39
- {
40
- "borderColor": "#DAD8D8",
41
- },
42
- undefined,
43
- ]
44
- }
45
- testID="input-field"
46
- >
47
- <View
48
- collapsable={false}
49
- jestAnimatedStyle={
50
- {
51
- "value": {
52
- "transform": [
53
- {
54
- "scale": 0.75,
55
- },
56
- {
57
- "translateY": -14,
58
- },
59
- {
60
- "translateX": -4,
61
- },
62
- ],
63
- },
64
- }
65
- }
66
- onLayout={[Function]}
67
- pointerEvents="none"
68
- style={
69
- {
70
- "left": 16,
71
- "maxWidth": "100%",
72
- "position": "absolute",
73
- "transform": [
74
- {
75
- "scale": 0.75,
76
- },
77
- {
78
- "translateY": -14,
79
- },
80
- {
81
- "translateX": -4,
82
- },
83
- ],
84
- "zIndex": 4,
85
- }
86
- }
87
- >
88
- <Text
89
- allowFontScaling={false}
90
- numberOfLines={1}
91
- selectable={false}
92
- style={
93
- [
94
- {
95
- "color": "#837C7C",
96
- "flexWrap": "nowrap",
97
- "fontFamily": "AreaNormal-Semibold",
98
- "fontSize": 13,
99
- "letterSpacing": 0.1,
100
- "lineHeight": 17,
101
- "overflow": "hidden",
102
- "paddingBottom": 0,
103
- "paddingHorizontal": 4,
104
- "paddingLeft": 0,
105
- "paddingRight": 0,
106
- "paddingTop": 4,
107
- "zIndex": 1,
108
- },
109
- ]
110
- }
111
- >
112
- InputField label
113
- </Text>
114
- <View
115
- style={
116
- [
117
- {
118
- "backgroundColor": "#FFFFFF",
119
- "height": "100%",
120
- "position": "absolute",
121
- "width": "100%",
122
- "zIndex": 0,
123
- },
124
- {
125
- "opacity": 1,
126
- },
127
- ]
128
- }
129
- />
130
- </View>
131
- <TextInput
132
- allowFontScaling={false}
133
- autoCapitalize="sentences"
134
- autoCorrect={true}
135
- editable={true}
136
- keyboardType="default"
137
- multiline={false}
138
- onBlur={[Function]}
139
- onChangeText={[Function]}
140
- onContentSizeChange={[Function]}
141
- onFocus={[Function]}
142
- placeholderTextColor="#FFFFFF"
143
- secureTextEntry={false}
144
- style={
145
- [
146
- {
147
- "fontFamily": "AreaNormal-Semibold",
148
- "fontSize": 15,
149
- "letterSpacing": -0.3,
150
- "lineHeight": 20,
151
- "paddingBottom": 16,
152
- "paddingLeft": 16,
153
- "paddingRight": 16,
154
- "paddingTop": 11,
155
- },
156
- {
157
- "color": "#0C0A0A",
158
- "flex": 0,
159
- "height": 56,
160
- },
161
- {},
162
- {
163
- "color": "#837C7C",
164
- },
165
- ]
166
- }
167
- testID="input-input"
168
- value="InputField value"
169
- />
170
- </View>
171
- </View>
172
- `;