@lookiero/checkout 0.7.1 → 0.7.2

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.
@@ -1,7 +1,7 @@
1
1
  import { Button } from "@lookiero/aurora-next/build/components/atoms/Button/Button";
2
2
  import { BUTTON_VARIANT } from "@lookiero/aurora-next/build/components/atoms/Button/Button.definition";
3
3
  import { useI18nMessage } from "@lookiero/i18n-react";
4
- import React, { useCallback, useMemo } from "react";
4
+ import React, { useMemo } from "react";
5
5
  import { View } from "react-native";
6
6
  import { size } from "../../../../../../projection/shared/size";
7
7
  import { Sticky } from "../../../../../../shared/ui/components/layouts/sticky/Sticky";
@@ -18,14 +18,13 @@ const ItemActions = ({ productVariants, productVariantSelected, keepButtonLoadin
18
18
  value: productVariant.id,
19
19
  })), [country, productVariants]);
20
20
  const disabledSizeSelector = useMemo(() => sizeSelectorOptions.length === 1 && sizeSelectorOptions[0]?.value === productVariantSelected.id, [sizeSelectorOptions, productVariantSelected.id]);
21
- const handleOnPressSizeSelector = useCallback(() => onSizeSelectorPress(), [onSizeSelectorPress]);
22
21
  return (React.createElement(Sticky, { onLayout: onLayout },
23
22
  React.createElement(Body, { style: { column: style.container } },
24
23
  React.createElement(Button, { busy: keepButtonLoading, onPress: onKeep }, keepButtonText),
25
24
  React.createElement(View, { style: style.row },
26
25
  !productVariantSelected.size.unique && (React.createElement(SelectField, { ...(disabledSizeSelector && {
27
- onPress: handleOnPressSizeSelector,
28
- }), disabled: sizeSelectorDisabled, options: sizeSelectorOptions, placeholder: sizeSelectorLabelText || "", testID: "size-selector", value: productVariantSelected.id, style: {
26
+ onPress: onSizeSelectorPress,
27
+ }), disabled: sizeSelectorDisabled, options: sizeSelectorOptions, placeholder: sizeSelectorLabelText || "", testID: "size-selector", title: sizeSelectorLabelText || "", value: productVariantSelected.id, style: {
29
28
  selectField: style.sizeSelector,
30
29
  inputField: { input: (disabledSizeSelector || sizeSelectorDisabled) && style.inputDisabled },
31
30
  }, onChange: onReplace })),
@@ -13,6 +13,7 @@ interface Option {
13
13
  readonly value: string;
14
14
  }
15
15
  interface SelectFieldBaseProps {
16
+ readonly title?: string;
16
17
  readonly placeholder: string;
17
18
  readonly value: string | undefined;
18
19
  readonly options: Option[];
@@ -6,7 +6,7 @@ import { Modal } from "../../layouts/modal/Modal";
6
6
  import { InputField } from "../inputField/InputField";
7
7
  import { style } from "./SelectField.style";
8
8
  const { colorGrayscaleS } = theme();
9
- const SelectField = ({ placeholder, value, options, style: customStyle, onChange = () => void 0, ...touchableRestProps }) => {
9
+ const SelectField = ({ title, placeholder, value, options, style: customStyle, onChange = () => void 0, ...touchableRestProps }) => {
10
10
  const [modalVisible, setModalVisible] = useState(false);
11
11
  const handleOnPressSelectField = useCallback(() => setModalVisible(true), []);
12
12
  const handleOnModalClose = useCallback(() => setModalVisible(false), []);
@@ -19,8 +19,10 @@ const SelectField = ({ placeholder, value, options, style: customStyle, onChange
19
19
  React.createElement(TouchableHighlight, { style: customStyle?.selectField, underlayColor: colorGrayscaleS, onPress: handleOnPressSelectField, ...touchableRestProps },
20
20
  React.createElement(View, { pointerEvents: "none" },
21
21
  React.createElement(InputField, { editable: false, icon: "arrow-down", label: placeholder, style: customStyle?.inputField, value: selectedValue?.label }))),
22
- React.createElement(Modal, { visible: modalVisible, scroll: true, onClose: handleOnModalClose },
23
- React.createElement(View, { style: [style.modalContent, customStyle?.modalContent] }, options.map(({ label, value }) => (React.createElement(TouchableHighlight, { key: value, style: [style.option, customStyle?.option], underlayColor: colorGrayscaleS, onPress: () => handleOnPressOption(value) },
24
- React.createElement(Text, { level: 3, style: [style.optionText, customStyle?.optionText] }, label))))))));
22
+ React.createElement(Modal, { visible: modalVisible, scroll: true, showCloseButton: true, onClose: handleOnModalClose },
23
+ React.createElement(View, { style: [style.modalContent, customStyle?.modalContent] },
24
+ title && (React.createElement(Text, { level: 2, style: style.modalTitle }, title)),
25
+ options.map(({ label, value: optionValue }) => (React.createElement(TouchableHighlight, { key: optionValue, disabled: value === optionValue, style: [style.option, customStyle?.option], underlayColor: colorGrayscaleS, onPress: value !== optionValue ? () => handleOnPressOption(optionValue) : undefined },
26
+ React.createElement(Text, { level: 3, style: [style.optionText, value === optionValue && style.selectedOptionText, customStyle?.optionText] }, label))))))));
25
27
  };
26
28
  export { SelectField };
@@ -3,6 +3,10 @@ declare const style: {
3
3
  paddingBottom: number;
4
4
  paddingHorizontal: number;
5
5
  };
6
+ modalTitle: {
7
+ marginBottom: number;
8
+ textAlign: "center";
9
+ };
6
10
  option: {
7
11
  borderBottomColor: string;
8
12
  borderBottomWidth: number;
@@ -11,5 +15,8 @@ declare const style: {
11
15
  optionText: {
12
16
  lineHeight: number;
13
17
  };
18
+ selectedOptionText: {
19
+ color: string;
20
+ };
14
21
  };
15
22
  export { style };
@@ -1,11 +1,15 @@
1
1
  import { StyleSheet } from "react-native";
2
2
  import { theme } from "../../../../../infrastructure/ui/theme/theme";
3
- const { borderSize, colorGrayscaleS, spaceM, spaceXL } = theme();
3
+ const { borderSize, colorGrayscaleS, colorGrayscaleM, spaceM, spaceL, spaceXL } = theme();
4
4
  const style = StyleSheet.create({
5
5
  modalContent: {
6
6
  paddingBottom: spaceXL,
7
7
  paddingHorizontal: spaceXL,
8
8
  },
9
+ modalTitle: {
10
+ marginBottom: spaceL,
11
+ textAlign: "center",
12
+ },
9
13
  option: {
10
14
  borderBottomColor: colorGrayscaleS,
11
15
  borderBottomWidth: borderSize,
@@ -14,5 +18,8 @@ const style = StyleSheet.create({
14
18
  optionText: {
15
19
  lineHeight: 24,
16
20
  },
21
+ selectedOptionText: {
22
+ color: colorGrayscaleM,
23
+ },
17
24
  });
18
25
  export { style };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lookiero/checkout",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [