@trafilea/afrodita-components 4.0.2-beta.5 → 4.0.2-beta.9

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,3 +1,2 @@
1
1
  import { IconWrapperProps } from 'src/components/Icon-wrapper/IconWrapper';
2
2
  export declare const Mail: ({ height, width }: IconWrapperProps) => JSX.Element;
3
- export default Mail;
@@ -5,4 +5,4 @@ interface IconProps {
5
5
  title?: string;
6
6
  }
7
7
  export declare const Message: ({ height, width, fill }: IconProps) => JSX.Element;
8
- export default Message;
8
+ export {};
@@ -45,4 +45,5 @@ import { Pagination } from './pagination/Pagination';
45
45
  import Text from './text/Text';
46
46
  import { SearchBar } from './search-bar';
47
47
  import ProductGalleryMobile from './mobile/gallery/ProductGalleryMobile';
48
- export { Icon, Card, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, SimpleDropdown, SizeSelector, SizeFitGuide, TextButton, DiscountTag, PriceLabel, SingleColorPicker, MultiColorPicker, ProductGallery, Rating, FitPredictor, ProgressBar, IconButton, Tooltip, Accordion, Checkbox, RadioGroupInput, Bundle, CategoryTag, SeasonOfferTag, Timer, Input, PaymentMethod, OfferBanner, Totals, DeliveryDetails, ScrollToTop, OrderBar, SizeTable, SimpleOrderItem, Review, SliderNavigation, DropdownListIcons, Image, AmazonButton, PaypalButton, CrossSell, Collection, StarList, Drawer, Spinner, FilteringTags, FilteringDropdown, Pagination, Text, SearchBar, ProductGalleryMobile, };
48
+ import { RadioInput } from './radio/input/radio';
49
+ export { Icon, Card, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, SimpleDropdown, SizeSelector, SizeFitGuide, TextButton, DiscountTag, PriceLabel, SingleColorPicker, MultiColorPicker, ProductGallery, Rating, FitPredictor, ProgressBar, IconButton, Tooltip, Accordion, Checkbox, RadioGroupInput, RadioInput, Bundle, CategoryTag, SeasonOfferTag, Timer, Input, PaymentMethod, OfferBanner, Totals, DeliveryDetails, ScrollToTop, OrderBar, SizeTable, SimpleOrderItem, Review, SliderNavigation, DropdownListIcons, Image, AmazonButton, PaypalButton, CrossSell, Collection, StarList, Drawer, Spinner, FilteringTags, FilteringDropdown, Pagination, Text, SearchBar, ProductGalleryMobile, };
@@ -1,14 +1,23 @@
1
1
  import React from 'react';
2
2
  import { InputValidationType } from '../../../types/enums';
3
- export interface BaseInputProps {
3
+ export interface BaseInputCommmonProps {
4
4
  defaultValue?: string;
5
5
  maxLength?: number;
6
6
  placeholder?: string;
7
7
  label?: string;
8
- onChange?: (value: string) => void;
9
8
  onValidation?: (status: InputValidationType) => void;
10
9
  disabled?: boolean;
11
10
  required?: string;
12
11
  children?: React.ReactNode;
12
+ size?: 'regular' | 'small';
13
+ }
14
+ export interface BaseInputControlled extends BaseInputCommmonProps {
15
+ value: string;
16
+ onChange: (value: string) => void;
17
+ }
18
+ export interface BaseInputUncontrolled extends BaseInputCommmonProps {
19
+ value?: never;
20
+ onChange?: (value: string) => void;
13
21
  }
14
- export declare const BaseInput: ({ onChange, defaultValue, label, children, required, onValidation, ...rest }: BaseInputProps) => JSX.Element;
22
+ export declare type BaseInputProps = BaseInputControlled | BaseInputUncontrolled;
23
+ export declare const BaseInput: ({ value, onChange, defaultValue, label, children, required, onValidation, size, ...rest }: BaseInputProps) => JSX.Element;
@@ -1,9 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { Story } from '@storybook/react';
3
- import { BaseInputProps } from './BaseInput';
4
2
  declare const _default: {
5
3
  title: string;
6
- component: ({ onChange, defaultValue, label, children, required, onValidation, ...rest }: BaseInputProps) => JSX.Element;
4
+ component: ({ value, onChange, defaultValue, label, children, required, onValidation, size, ...rest }: import("./BaseInput").BaseInputProps) => JSX.Element;
7
5
  };
8
6
  export default _default;
9
- export declare const Base: Story<BaseInputProps>;
7
+ export declare const Uncontrolled: () => JSX.Element;
8
+ export declare const Controlled: () => JSX.Element;
@@ -1,4 +1,5 @@
1
1
  /// <reference types="react" />
2
+ import { BaseInputProps } from './BaseInput';
2
3
  export interface StyledInputProps {
3
4
  border: string;
4
5
  borderRadius: string;
@@ -27,5 +28,5 @@ export declare const StyledInput: import("@emotion/styled").StyledComponent<{
27
28
  export declare const InputWrapper: import("@emotion/styled").StyledComponent<{
28
29
  theme?: import("@emotion/react").Theme | undefined;
29
30
  as?: import("react").ElementType<any> | undefined;
30
- }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
31
+ } & Pick<BaseInputProps, "size">, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
31
32
  export {};
@@ -1,13 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseInputProps } from '../base/BaseInput';
3
- declare type BaseInputPropsWithoutLabel = Omit<BaseInputProps, 'label'>;
4
- export interface BasePlusButtonProps extends BaseInputPropsWithoutLabel {
5
- onClick: () => void;
3
+ export declare type BasePlusButtonProps = BaseInputProps & {
4
+ label?: undefined;
5
+ onClick: (value: string) => void;
6
6
  onClickEdit: () => void;
7
7
  text: string;
8
8
  success: boolean;
9
9
  editText: string;
10
10
  successText: string;
11
- }
11
+ };
12
12
  export declare const BasePlusButton: ({ onClick, onClickEdit, text, success, editText, successText, ...rest }: BasePlusButtonProps) => JSX.Element;
13
- export {};
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
- export interface SuccessProps {
2
+ import { BaseInputProps } from '../base/BaseInput';
3
+ export declare type SuccessProps = {
3
4
  children: React.ReactNode;
4
5
  successText: string;
5
- }
6
- export declare const Success: ({ children, successText }: SuccessProps) => JSX.Element;
6
+ } & Pick<BaseInputProps, 'size'>;
7
+ export declare const Success: ({ children, successText, size }: SuccessProps) => JSX.Element;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseInputProps } from '../base/BaseInput';
3
3
  import { IconType } from '../../icons';
4
- export interface BasePlusIconProps extends BaseInputProps {
4
+ export declare type BasePlusIconProps = BaseInputProps & {
5
5
  Icon: IconType;
6
- }
6
+ };
7
7
  export declare const BasePlusIcon: ({ Icon, ...rest }: BasePlusIconProps) => JSX.Element;
@@ -1,8 +1,9 @@
1
1
  /// <reference types="react" />
2
2
  import { BaseInputProps } from '../base/BaseInput';
3
- export interface CustomProps extends BaseInputProps {
3
+ import { ButtonProps } from 'src/components/shared/button/Button';
4
+ export declare type CustomProps = BaseInputProps & {
4
5
  onClick: () => void;
5
6
  text: string;
6
- type: 'primary' | 'secondary';
7
- }
8
- export declare const Custom: ({ onClick, text, type, ...rest }: CustomProps) => JSX.Element;
7
+ variant: ButtonProps['variant'];
8
+ };
9
+ export declare const Custom: ({ onClick, text, variant, ...rest }: CustomProps) => JSX.Element;
@@ -3,7 +3,7 @@ import { Story } from '@storybook/react';
3
3
  import { CustomProps } from './Custom';
4
4
  declare const _default: {
5
5
  title: string;
6
- component: ({ onClick, text, type, ...rest }: CustomProps) => JSX.Element;
6
+ component: ({ onClick, text, variant, ...rest }: CustomProps) => JSX.Element;
7
7
  };
8
8
  export default _default;
9
- export declare const Cstm: Story<CustomProps>;
9
+ export declare const Custom: Story<CustomProps>;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Input: {
3
- Simple: ({ onChange, defaultValue, label, children, required, onValidation, ...rest }: import("./base/BaseInput").BaseInputProps) => JSX.Element;
4
- Custom: ({ onClick, text, type, ...rest }: import("./custom/Custom").CustomProps) => JSX.Element;
3
+ Simple: ({ value, onChange, defaultValue, label, children, required, onValidation, size, ...rest }: import("./base/BaseInput").BaseInputProps) => JSX.Element;
4
+ Custom: ({ onClick, text, variant, ...rest }: import("./custom/Custom").CustomProps) => JSX.Element;
5
5
  SimplePlusButton: ({ onClick, onClickEdit, text, success, editText, successText, ...rest }: import("./basePlusButton/BasePlusButton").BasePlusButtonProps) => JSX.Element;
6
6
  SimplePlusIcon: ({ Icon, ...rest }: import("./basePlusIcon/BasePlusIcon").BasePlusIconProps) => JSX.Element;
7
7
  };
@@ -8,6 +8,7 @@ export interface BaseButtonProps {
8
8
  type?: ButtonType;
9
9
  onClick: () => void;
10
10
  className?: string;
11
+ inline?: boolean;
11
12
  }
12
- declare const BaseButton: ({ children, renderLeading, renderTrailing, disabled, type, onClick, className, }: BaseButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
13
+ declare const BaseButton: ({ children, renderLeading, renderTrailing, disabled, type, onClick, className, inline, }: BaseButtonProps) => import("@emotion/react/jsx-runtime").JSX.Element;
13
14
  export default BaseButton;
@@ -2,7 +2,7 @@ import { Story } from '@storybook/react';
2
2
  import { BaseButtonProps } from './BaseButton';
3
3
  declare const _default: {
4
4
  title: string;
5
- component: ({ children, renderLeading, renderTrailing, disabled, type, onClick, className, }: BaseButtonProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
5
+ component: ({ children, renderLeading, renderTrailing, disabled, type, onClick, className, inline, }: BaseButtonProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
6
6
  disabled: {
7
7
  options: boolean[];
8
8
  control: {
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ import { BaseCTAProps } from 'src/components/cta/BaseCTA';
3
+ export declare type ButtonProps = {
4
+ variant: 'primary' | 'secondary' | 'secondary-outline';
5
+ } & BaseCTAProps;
6
+ export declare const Button: FC<ButtonProps>;
package/build/index.d.ts CHANGED
@@ -2,6 +2,7 @@
2
2
  import { IconWrapperProps } from 'src/components/Icon-wrapper/IconWrapper';
3
3
  import React, { ReactNode, FC, AriaAttributes, CSSProperties, AnchorHTMLAttributes, LabelHTMLAttributes, ElementType, RefObject } from 'react';
4
4
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
5
+ import { ButtonProps } from 'src/components/shared/button/Button';
5
6
  import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
6
7
  import { SearchBarOptionItem as SearchBarOptionItem$1 } from 'src/types/types';
7
8
  import { ThemeBreakpoints as ThemeBreakpoints$1 } from 'src/core/theme/Theme';
@@ -487,6 +488,7 @@ interface BaseButtonProps {
487
488
  type?: ButtonType;
488
489
  onClick: () => void;
489
490
  className?: string;
491
+ inline?: boolean;
490
492
  }
491
493
 
492
494
  declare type BaseProps = Pick<BaseButtonProps, 'disabled' | 'type' | 'onClick'>;
@@ -674,41 +676,50 @@ interface TimerProps extends TimeProps {
674
676
  }
675
677
  declare const Timer: ({ onTimeUp, ...rest }: TimerProps) => JSX.Element;
676
678
 
677
- interface BaseInputProps {
679
+ interface BaseInputCommmonProps {
678
680
  defaultValue?: string;
679
681
  maxLength?: number;
680
682
  placeholder?: string;
681
683
  label?: string;
682
- onChange?: (value: string) => void;
683
684
  onValidation?: (status: InputValidationType) => void;
684
685
  disabled?: boolean;
685
686
  required?: string;
686
687
  children?: React.ReactNode;
687
- }
688
+ size?: 'regular' | 'small';
689
+ }
690
+ interface BaseInputControlled extends BaseInputCommmonProps {
691
+ value: string;
692
+ onChange: (value: string) => void;
693
+ }
694
+ interface BaseInputUncontrolled extends BaseInputCommmonProps {
695
+ value?: never;
696
+ onChange?: (value: string) => void;
697
+ }
698
+ declare type BaseInputProps = BaseInputControlled | BaseInputUncontrolled;
688
699
 
689
- interface BasePlusIconProps extends BaseInputProps {
700
+ declare type BasePlusIconProps = BaseInputProps & {
690
701
  Icon: IconType;
691
- }
702
+ };
692
703
 
693
- declare type BaseInputPropsWithoutLabel = Omit<BaseInputProps, 'label'>;
694
- interface BasePlusButtonProps extends BaseInputPropsWithoutLabel {
695
- onClick: () => void;
704
+ declare type BasePlusButtonProps = BaseInputProps & {
705
+ label?: undefined;
706
+ onClick: (value: string) => void;
696
707
  onClickEdit: () => void;
697
708
  text: string;
698
709
  success: boolean;
699
710
  editText: string;
700
711
  successText: string;
701
- }
712
+ };
702
713
 
703
- interface CustomProps extends BaseInputProps {
714
+ declare type CustomProps = BaseInputProps & {
704
715
  onClick: () => void;
705
716
  text: string;
706
- type: 'primary' | 'secondary';
707
- }
717
+ variant: ButtonProps['variant'];
718
+ };
708
719
 
709
720
  declare const Input: {
710
- Simple: ({ onChange, defaultValue, label, children, required, onValidation, ...rest }: BaseInputProps) => JSX.Element;
711
- Custom: ({ onClick, text, type, ...rest }: CustomProps) => JSX.Element;
721
+ Simple: ({ value, onChange, defaultValue, label, children, required, onValidation, size, ...rest }: BaseInputProps) => JSX.Element;
722
+ Custom: ({ onClick, text, variant, ...rest }: CustomProps) => JSX.Element;
712
723
  SimplePlusButton: ({ onClick, onClickEdit, text, success, editText, successText, ...rest }: BasePlusButtonProps) => JSX.Element;
713
724
  SimplePlusIcon: ({ Icon, ...rest }: BasePlusIconProps) => JSX.Element;
714
725
  };
@@ -1101,6 +1112,18 @@ interface ProductGalleryMobileProps {
1101
1112
  }
1102
1113
  declare const ProductGalleryMobile: ({ images, selectedValue, DiscountTagElement, BestSellerTagElement, productImageDataTestId, slideDotsDataTestId, }: ProductGalleryMobileProps) => JSX.Element;
1103
1114
 
1115
+ interface RadioProps {
1116
+ name: string;
1117
+ value: string;
1118
+ id: string;
1119
+ label: string;
1120
+ size?: ComponentSize.Small | ComponentSize.Medium | ComponentSize.Large;
1121
+ checked?: boolean;
1122
+ disabled?: boolean;
1123
+ onChange: (option: RadioGroupOption) => void;
1124
+ }
1125
+ declare const RadioInput: ({ name, value, id, label, checked, disabled, onChange, size, }: RadioProps) => JSX.Element;
1126
+
1104
1127
  declare const ThemeProvider: FC<{
1105
1128
  theme: Theme;
1106
1129
  children: ReactNode;
@@ -1492,4 +1515,4 @@ declare const useWindowDimensions: (breakpoints: ThemeBreakpoints$1) => {
1492
1515
  };
1493
1516
  };
1494
1517
 
1495
- export { Accordion, AmazonButton, AssetsProvider, Bundle, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, ButtonType, CTAProps, _default as Card, CardSectionType, CategoryTag, Checkbox, Collection, Color, ColorPickerOption, ComponentPosition, ComponentSize, index_d as CrossSell, DeliveryDetails, DiscountTag, Drawer, DropdownListIcons, DropdownListIconsItem, DropdownListIconsSubItem, DropdownOption, Filter, FilterChange, FilteringDropdown, Tags as FilteringTags, FitPredictor, Icon, IconButton, IconProps$1 as IconProps, IconWithOpacityProps, Image, ImageType, Input, InputValidationType, MultiColorPicker, OfferBanner, OrderBar, Pagination, Pattern, PaymentMethod, PaypalButton, PriceLabel, ProductGallery, ProductGalleryMobile, ProgressBar, RadioGroupInput, RadioGroupOption, Rating, Review, ScrollToTop, SearchBar, SearchBarOptionItem, SeasonOfferTag, SimpleDropdown, SimpleOrderItem, SingleColorPicker, SizeFitGuide, SizeOption, SizeSelector, SizeTable, SliderNavigation, Spinner, StarList, Text, TextButton, Theme, ThemeAssets, ThemeBasicPallete, ThemeBreakpoints, ThemeColorPallete, ThemeColors, ThemeComponent, ThemeFonts, ThemeProvider, ThemeTypography, ThemeVariables, Timer, Tooltip, Totals, WithTestId, useOnClickOutside, useTheme, useThemeAssets, useWindowDimensions };
1518
+ export { Accordion, AmazonButton, AssetsProvider, Bundle, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, ButtonType, CTAProps, _default as Card, CardSectionType, CategoryTag, Checkbox, Collection, Color, ColorPickerOption, ComponentPosition, ComponentSize, index_d as CrossSell, DeliveryDetails, DiscountTag, Drawer, DropdownListIcons, DropdownListIconsItem, DropdownListIconsSubItem, DropdownOption, Filter, FilterChange, FilteringDropdown, Tags as FilteringTags, FitPredictor, Icon, IconButton, IconProps$1 as IconProps, IconWithOpacityProps, Image, ImageType, Input, InputValidationType, MultiColorPicker, OfferBanner, OrderBar, Pagination, Pattern, PaymentMethod, PaypalButton, PriceLabel, ProductGallery, ProductGalleryMobile, ProgressBar, RadioGroupInput, RadioGroupOption, RadioInput, Rating, Review, ScrollToTop, SearchBar, SearchBarOptionItem, SeasonOfferTag, SimpleDropdown, SimpleOrderItem, SingleColorPicker, SizeFitGuide, SizeOption, SizeSelector, SizeTable, SliderNavigation, Spinner, StarList, Text, TextButton, Theme, ThemeAssets, ThemeBasicPallete, ThemeBreakpoints, ThemeColorPallete, ThemeColors, ThemeComponent, ThemeFonts, ThemeProvider, ThemeTypography, ThemeVariables, Timer, Tooltip, Totals, WithTestId, useOnClickOutside, useTheme, useThemeAssets, useWindowDimensions };
@@ -3481,13 +3481,14 @@ function jsxs(type, props, key) {
3481
3481
  }
3482
3482
 
3483
3483
  var BaseButton = function (_a) {
3484
- var children = _a.children, renderLeading = _a.renderLeading, renderTrailing = _a.renderTrailing, disabled = _a.disabled, _b = _a.type, type = _b === void 0 ? 'button' : _b, onClick = _a.onClick, className = _a.className;
3484
+ var children = _a.children, renderLeading = _a.renderLeading, renderTrailing = _a.renderTrailing, disabled = _a.disabled, _b = _a.type, type = _b === void 0 ? 'button' : _b, onClick = _a.onClick, className = _a.className, inline = _a.inline;
3485
3485
  return (jsxs("button", __assign({ onClick: onClick, disabled: disabled, className: className, type: type, css: {
3486
- display: 'flex',
3486
+ display: inline ? 'inherit-flex' : 'flex',
3487
3487
  justifyContent: 'center',
3488
3488
  alignItems: 'center',
3489
3489
  padding: '0.75rem 2rem',
3490
3490
  textDecoration: 'none',
3491
+ textTransform: 'uppercase',
3491
3492
  boxSizing: 'border-box',
3492
3493
  cursor: 'pointer',
3493
3494
  } }, { children: [renderLeading, children, renderTrailing] }), void 0));
@@ -3521,7 +3522,7 @@ var BaseCTA = function (_a) {
3521
3522
  var text = _a.text, onClick = _a.onClick, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.wide, wide = _c === void 0 ? false : _c, _d = _a.size, size = _d === void 0 ? ComponentSize.Medium : _d, type = _a.type, className = _a.className;
3522
3523
  var theme = useTheme();
3523
3524
  var stylesBySize = getStylesBySize$9(size, theme);
3524
- return (jsx(BaseButton, __assign({ onClick: onClick, disabled: disabled, className: className, type: type, css: __assign(__assign({ width: wide ? '100%' : '' }, stylesBySize), { fontWeight: theme.component.button.fontWeight, borderRadius: "".concat(theme.component.button.borderRadius), cursor: 'pointer', '&:disabled': {
3525
+ return (jsx(BaseButton, __assign({ onClick: onClick, disabled: disabled, className: className, type: type, css: __assign(__assign({ width: wide ? '100%' : 'fit-content' }, stylesBySize), { fontWeight: theme.component.button.fontWeight, borderRadius: "".concat(theme.component.button.borderRadius), cursor: 'pointer', '&:disabled': {
3525
3526
  backgroundColor: theme.colors.background.disabled,
3526
3527
  color: theme.colors.text.disabled,
3527
3528
  cursor: 'not-allowed',
@@ -4438,7 +4439,7 @@ function Disclosure(props) {
4438
4439
  } // ---
4439
4440
 
4440
4441
  var DEFAULT_BUTTON_TAG$1 = 'button';
4441
- var Button$6 = /*#__PURE__*/forwardRefWithAs(function Button(props, ref) {
4442
+ var Button$7 = /*#__PURE__*/forwardRefWithAs(function Button(props, ref) {
4442
4443
  var _useDisclosureContext = useDisclosureContext([Disclosure.name, Button.name].join('.')),
4443
4444
  state = _useDisclosureContext[0],
4444
4445
  dispatch = _useDisclosureContext[1];
@@ -4601,7 +4602,7 @@ var Panel = /*#__PURE__*/forwardRefWithAs(function Panel(props, ref) {
4601
4602
  }));
4602
4603
  }); // ---
4603
4604
 
4604
- Disclosure.Button = Button$6;
4605
+ Disclosure.Button = Button$7;
4605
4606
  Disclosure.Panel = Panel;
4606
4607
 
4607
4608
  function disposables() {
@@ -4997,7 +4998,7 @@ function Listbox(props) {
4997
4998
  } // ---
4998
4999
 
4999
5000
  var DEFAULT_BUTTON_TAG = 'button';
5000
- var Button$5 = /*#__PURE__*/forwardRefWithAs(function Button(props, ref) {
5001
+ var Button$6 = /*#__PURE__*/forwardRefWithAs(function Button(props, ref) {
5001
5002
  var _state$optionsRef$cur;
5002
5003
 
5003
5004
  var _useListboxContext = useListboxContext([Listbox.name, Button.name].join('.')),
@@ -5456,7 +5457,7 @@ function Option$2(props) {
5456
5457
  } // ---
5457
5458
 
5458
5459
 
5459
- Listbox.Button = Button$5;
5460
+ Listbox.Button = Button$6;
5460
5461
  Listbox.Label = Label$4;
5461
5462
  Listbox.Options = Options;
5462
5463
  Listbox.Option = Option$2;
@@ -6773,11 +6774,11 @@ var ImageSmallPreview = function (_a) {
6773
6774
  var templateObject_1$O;
6774
6775
 
6775
6776
  var Container$w = newStyled.div(templateObject_1$N || (templateObject_1$N = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n padding-right: 1.25rem;\n overflow: auto;\n"], ["\n display: flex;\n flex-direction: column;\n padding-right: 1.25rem;\n overflow: auto;\n"])));
6776
- var Button$4 = newStyled.button(templateObject_2$v || (templateObject_2$v = __makeTemplateObject(["\n padding: 0;\n border: none;\n text-decoration: none;\n background: transparent;\n"], ["\n padding: 0;\n border: none;\n text-decoration: none;\n background: transparent;\n"])));
6777
+ var Button$5 = newStyled.button(templateObject_2$v || (templateObject_2$v = __makeTemplateObject(["\n padding: 0;\n border: none;\n text-decoration: none;\n background: transparent;\n"], ["\n padding: 0;\n border: none;\n text-decoration: none;\n background: transparent;\n"])));
6777
6778
  var ImagePreviewList = function (_a) {
6778
6779
  var images = _a.images, selectedImage = _a.selectedImage, onClick = _a.onClick, dataTestId = _a.dataTestId;
6779
6780
  return (jsx(Container$w, __assign({ "data-testid": dataTestId }, { children: images.map(function (item) {
6780
- return (jsx(Button$4, __assign({ onClick: function () { return onClick(item); } }, { children: jsx(ImageSmallPreview, { css: { marginBottom: '1.25rem' }, imageUrl: item.imageUrl, alt: item.alt, selected: item.key === selectedImage.key }, void 0) }), item.key));
6781
+ return (jsx(Button$5, __assign({ onClick: function () { return onClick(item); } }, { children: jsx(ImageSmallPreview, { css: { marginBottom: '1.25rem' }, imageUrl: item.imageUrl, alt: item.alt, selected: item.key === selectedImage.key }, void 0) }), item.key));
6781
6782
  }) }), void 0));
6782
6783
  };
6783
6784
  var templateObject_1$N, templateObject_2$v;
@@ -7524,7 +7525,7 @@ var Container$k = newStyled.div(templateObject_1$y || (templateObject_1$y = __ma
7524
7525
  var color = _a.color;
7525
7526
  return color;
7526
7527
  });
7527
- var StyledInput = newStyled.input(templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\n padding: ", ";\n font-size: ", ";\n border-radius: ", ";\n border: ", ";\n line-height: ", ";\n color: ", ";\n font-weight: ", ";\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n\n &::placeholder {\n color: ", ";\n }\n\n &:focus {\n outline: none;\n border-color: ", ";\n box-shadow: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n border: 0.063rem solid ", ";\n color: ", ";\n\n &::placeholder {\n color: ", ";\n }\n }\n"], ["\n padding: ", ";\n font-size: ", ";\n border-radius: ", ";\n border: ", ";\n line-height: ", ";\n color: ", ";\n font-weight: ", ";\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n\n &::placeholder {\n color: ", ";\n }\n\n &:focus {\n outline: none;\n border-color: ", ";\n box-shadow: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n border: 0.063rem solid ", ";\n color: ", ";\n\n &::placeholder {\n color: ", ";\n }\n }\n"])), function (_a) {
7528
+ var StyledInput = newStyled.input(templateObject_2$m || (templateObject_2$m = __makeTemplateObject(["\n padding: ", ";\n font-size: ", ";\n border-radius: ", ";\n border: ", ";\n line-height: ", ";\n color: ", ";\n font-weight: ", ";\n flex: 1 1 50%;\n height: 100%;\n box-sizing: border-box;\n\n &::placeholder {\n color: ", ";\n }\n\n &:focus {\n outline: none;\n border-color: ", ";\n box-shadow: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n border: 0.063rem solid ", ";\n color: ", ";\n\n &::placeholder {\n color: ", ";\n }\n }\n"], ["\n padding: ", ";\n font-size: ", ";\n border-radius: ", ";\n border: ", ";\n line-height: ", ";\n color: ", ";\n font-weight: ", ";\n flex: 1 1 50%;\n height: 100%;\n box-sizing: border-box;\n\n &::placeholder {\n color: ", ";\n }\n\n &:focus {\n outline: none;\n border-color: ", ";\n box-shadow: ", ";\n }\n\n &:disabled {\n background-color: ", ";\n border: 0.063rem solid ", ";\n color: ", ";\n\n &::placeholder {\n color: ", ";\n }\n }\n"])), function (_a) {
7528
7529
  var padding = _a.padding;
7529
7530
  return padding;
7530
7531
  }, function (_a) {
@@ -7567,34 +7568,49 @@ var StyledInput = newStyled.input(templateObject_2$m || (templateObject_2$m = __
7567
7568
  var disabledColor = _a.disabledColor;
7568
7569
  return disabledColor;
7569
7570
  });
7570
- var InputWrapper = newStyled.div(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n position: relative;\n display: flex;\n height: 100%;\n"], ["\n position: relative;\n display: flex;\n height: 100%;\n"])));
7571
+ var InputWrapper = newStyled.div(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n position: relative;\n display: flex;\n height: ", ";\n"], ["\n position: relative;\n display: flex;\n height: ", ";\n"])), function (_a) {
7572
+ var size = _a.size;
7573
+ return (size === 'small' ? '36px' : '44px');
7574
+ });
7571
7575
  var templateObject_1$y, templateObject_2$m, templateObject_3$f;
7572
7576
 
7573
7577
  var BaseInput = function (_a) {
7574
- var onChange = _a.onChange, _b = _a.defaultValue, defaultValue = _b === void 0 ? '' : _b, label = _a.label, children = _a.children, required = _a.required, onValidation = _a.onValidation, rest = __rest(_a, ["onChange", "defaultValue", "label", "children", "required", "onValidation"]);
7578
+ var _b;
7579
+ var value = _a.value, onChange = _a.onChange, _c = _a.defaultValue, defaultValue = _c === void 0 ? '' : _c, label = _a.label, children = _a.children, required = _a.required, onValidation = _a.onValidation, size = _a.size, rest = __rest(_a, ["value", "onChange", "defaultValue", "label", "children", "required", "onValidation", "size"]);
7575
7580
  var theme = useTheme();
7576
- var _c = useState(defaultValue), value = _c[0], setValue = _c[1];
7577
- var _d = useState(InputValidationType.Empty), status = _d[0], setStatus = _d[1];
7581
+ var _d = useState((_b = value !== null && value !== void 0 ? value : defaultValue) !== null && _b !== void 0 ? _b : ''), internalValue = _d[0], setInternalValue = _d[1];
7582
+ var _e = useState(InputValidationType.Empty), status = _e[0], setStatus = _e[1];
7578
7583
  var handleChange = function (_a) {
7579
- var value = _a.target.value;
7580
- setValue(value);
7581
- onChange && onChange(value);
7584
+ var target = _a.target;
7585
+ if (onChange) {
7586
+ onChange(target.value);
7587
+ }
7588
+ if (value == null) {
7589
+ setInternalValue(target.value);
7590
+ }
7582
7591
  };
7583
7592
  var validate = function (_a) {
7584
7593
  var value = _a.target.value;
7585
- var newStatus = handleValidations(value);
7586
- setStatus(newStatus);
7587
- onValidation && onValidation(newStatus);
7588
- };
7589
- var handleValidations = function (value) {
7594
+ var status = InputValidationType.Valid;
7590
7595
  if (required && isEmpty(value)) {
7591
- return InputValidationType.Error;
7596
+ status = InputValidationType.Error;
7592
7597
  }
7593
7598
  if (!required && isEmpty(value)) {
7594
- return InputValidationType.Empty;
7599
+ status = InputValidationType.Empty;
7595
7600
  }
7596
- return InputValidationType.Valid;
7601
+ setStatus(status);
7597
7602
  };
7603
+ useEffect(function () {
7604
+ if (value == null) {
7605
+ return;
7606
+ }
7607
+ setInternalValue(value);
7608
+ }, [value]);
7609
+ useEffect(function () {
7610
+ if (onValidation != null) {
7611
+ onValidation(status);
7612
+ }
7613
+ }, [onValidation, status]);
7598
7614
  var styling = {
7599
7615
  border: theme.component.input.border,
7600
7616
  borderRadius: theme.component.input.borderRadius,
@@ -7613,39 +7629,57 @@ var BaseInput = function (_a) {
7613
7629
  ? theme.colors.shades['700'].color
7614
7630
  : status === InputValidationType.Error
7615
7631
  ? theme.colors.semantic.urgent.color
7616
- : '' }, { children: [label && (jsx$1(InputLabel, { label: label, isDisabled: rest.disabled, isRequired: Boolean(required) }, void 0)), jsxs$1(InputWrapper, __assign({ className: "inputWrapper" }, { children: [jsx$1(StyledInput, __assign({ "data-testid": "base-input", type: "text", onChange: handleChange, onBlur: validate, required: Boolean(required), value: value }, rest, styling), void 0), children] }), void 0), required && status === InputValidationType.Error && jsx$1(Error$1, { error: required }, void 0)] }), void 0));
7632
+ : '' }, { children: [label && (jsx$1(InputLabel, { label: label, isDisabled: rest.disabled, isRequired: Boolean(required) }, void 0)), jsxs$1(InputWrapper, __assign({ className: "inputWrapper", size: size }, { children: [jsx$1(StyledInput, __assign({ "data-testid": "base-input", type: "text", onChange: handleChange, onBlur: validate, required: Boolean(required), value: internalValue }, rest, styling), void 0), children] }), void 0), required && status === InputValidationType.Error && jsx$1(Error$1, { error: required }, void 0)] }), void 0));
7617
7633
  };
7618
7634
 
7619
- var Container$j = newStyled.div(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n input {\n border-radius: ", ";\n }\n"], ["\n input {\n border-radius: ", ";\n }\n"])), function (_a) {
7635
+ var Button$4 = function (_a) {
7636
+ var variant = _a.variant, props = __rest(_a, ["variant"]);
7637
+ if (variant === 'primary') {
7638
+ return jsx$1(ButtonPrimary, __assign({}, props), void 0);
7639
+ }
7640
+ if (variant === 'secondary') {
7641
+ return jsx$1(ButtonSecondary, __assign({}, props), void 0);
7642
+ }
7643
+ if (variant === 'secondary-outline') {
7644
+ return jsx$1(ButtonSecondary, __assign({}, props), void 0);
7645
+ }
7646
+ throw new Error("Invalid button variant ".concat(variant));
7647
+ };
7648
+
7649
+ var Container$j = newStyled.div(templateObject_1$x || (templateObject_1$x = __makeTemplateObject(["\n overflow: hidden;\n\n input {\n border-radius: ", ";\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-right: none;\n }\n"], ["\n overflow: hidden;\n\n input {\n border-radius: ", ";\n border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n border-right: none;\n }\n"])), function (_a) {
7620
7650
  var theme = _a.theme;
7621
7651
  return theme.component.inputCustom.input.borderRadius;
7622
7652
  });
7623
- var ButtonContainer$1 = newStyled.div(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n width: 7.125rem;\n height: 100%;\n position: absolute;\n right: 0;\n\n button {\n width: 100%;\n height: 100%;\n border-radius: ", ";\n }\n"], ["\n width: 7.125rem;\n height: 100%;\n position: absolute;\n right: 0;\n\n button {\n width: 100%;\n height: 100%;\n border-radius: ", ";\n }\n"])), function (_a) {
7653
+ var ButtonContainer$1 = newStyled.div(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n max-width: 50%;\n\n button {\n width: 100%;\n height: 100%;\n border-radius: ", ";\n }\n"], ["\n max-width: 50%;\n\n button {\n width: 100%;\n height: 100%;\n border-radius: ", ";\n }\n"])), function (_a) {
7624
7654
  var theme = _a.theme;
7625
7655
  return theme.component.inputCustom.button.borderRadius;
7626
7656
  });
7627
7657
  var Custom = function (_a) {
7628
- var onClick = _a.onClick, text = _a.text, type = _a.type, rest = __rest(_a, ["onClick", "text", "type"]);
7658
+ var onClick = _a.onClick, text = _a.text, variant = _a.variant, rest = __rest(_a, ["onClick", "text", "variant"]);
7629
7659
  var theme = useTheme();
7630
- var props = {
7660
+ var props = useMemo(function () { return ({
7661
+ variant: variant,
7631
7662
  onClick: onClick,
7632
7663
  text: text,
7633
7664
  disabled: rest.disabled,
7634
- };
7635
- return (jsx$1(Container$j, __assign({ theme: theme }, { children: jsx$1(BaseInput, __assign({}, rest, { children: jsx$1(ButtonContainer$1, __assign({ theme: theme }, { children: type === 'primary' ? jsx$1(ButtonPrimary, __assign({}, props), void 0) : jsx$1(ButtonSecondary, __assign({}, props), void 0) }), void 0) }), void 0) }), void 0));
7665
+ }); }, [variant, onClick, text, rest.disabled]);
7666
+ return (jsx$1(Container$j, __assign({ theme: theme }, { children: jsx$1(BaseInput, __assign({}, rest, { children: jsx$1(ButtonContainer$1, __assign({ theme: theme }, { children: jsx$1(Button$4, __assign({}, props), void 0) }), void 0) }), void 0) }), void 0));
7636
7667
  };
7637
7668
  var templateObject_1$x, templateObject_2$l;
7638
7669
 
7639
- var SuccessContainer = newStyled.div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n height: 3rem;\n display: flex;\n"], ["\n height: 3rem;\n display: flex;\n"])));
7640
- var SuccessMessage = newStyled.div(templateObject_2$k || (templateObject_2$k = __makeTemplateObject(["\n background-color: #dfefe0;\n border: 0.063rem solid #5ead63;\n border-radius: 0.5rem;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n padding: 0 1rem;\n box-sizing: border-box;\n"], ["\n background-color: #dfefe0;\n border: 0.063rem solid #5ead63;\n border-radius: 0.5rem;\n width: 100%;\n height: 100%;\n display: flex;\n align-items: center;\n padding: 0 1rem;\n box-sizing: border-box;\n"])));
7670
+ var SuccessContainer = newStyled.div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n height: ", ";\n display: flex;\n"], ["\n height: ", ";\n display: flex;\n"])), function (_a) {
7671
+ var size = _a.size;
7672
+ return (size === 'small' ? '36px' : '');
7673
+ });
7674
+ var SuccessMessage = newStyled.div(templateObject_2$k || (templateObject_2$k = __makeTemplateObject(["\n background-color: #dfefe0;\n border: 0.063rem solid #5ead63;\n border-radius: 0.5rem;\n width: 100%;\n flex: 1;\n display: flex;\n align-items: center;\n padding: 0 1rem;\n box-sizing: border-box;\n"], ["\n background-color: #dfefe0;\n border: 0.063rem solid #5ead63;\n border-radius: 0.5rem;\n width: 100%;\n flex: 1;\n display: flex;\n align-items: center;\n padding: 0 1rem;\n box-sizing: border-box;\n"])));
7641
7675
  var SuccessText = newStyled.span(templateObject_3$e || (templateObject_3$e = __makeTemplateObject(["\n margin: 0;\n font-size: 1rem;\n line-height: 1.5rem;\n font-weight: 600;\n margin-left: 0.313rem;\n"], ["\n margin: 0;\n font-size: 1rem;\n line-height: 1.5rem;\n font-weight: 600;\n margin-left: 0.313rem;\n"])));
7642
7676
  var Success = function (_a) {
7643
- var children = _a.children, successText = _a.successText;
7644
- return (jsxs$1(SuccessContainer, { children: [jsxs$1(SuccessMessage, { children: [jsx$1(Icon.Actions.Check, { fill: "#5EAD63", width: 1.375, height: 1.063 }, void 0), jsx$1(SuccessText, { children: successText }, void 0)] }, void 0), children] }, void 0));
7677
+ var children = _a.children, successText = _a.successText, size = _a.size;
7678
+ return (jsxs$1(SuccessContainer, __assign({ size: size }, { children: [jsxs$1(SuccessMessage, { children: [jsx$1(Icon.Actions.Check, { fill: "#5EAD63", width: 1.375, height: 1.063 }, void 0), jsx$1(SuccessText, { children: successText }, void 0)] }, void 0), children] }), void 0));
7645
7679
  };
7646
7680
  var templateObject_1$w, templateObject_2$k, templateObject_3$e;
7647
7681
 
7648
- var ButtonContainer = newStyled.div(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n margin-left: 0.625rem;\n height: 100%;\n\n button {\n width: 100%;\n height: 100%;\n background-color: ", ";\n }\n"], ["\n margin-left: 0.625rem;\n height: 100%;\n\n button {\n width: 100%;\n height: 100%;\n background-color: ", ";\n }\n"])), function (_a) {
7682
+ var ButtonContainer = newStyled.div(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n margin-left: 0.625rem;\n\n button {\n width: 100%;\n height: 100%;\n background-color: ", ";\n }\n"], ["\n margin-left: 0.625rem;\n\n button {\n width: 100%;\n height: 100%;\n background-color: ", ";\n }\n"])), function (_a) {
7649
7683
  var status = _a.status, type = _a.type, theme = _a.theme;
7650
7684
  return status === InputValidationType.Empty &&
7651
7685
  type === 'primary' &&
@@ -7654,15 +7688,18 @@ var ButtonContainer = newStyled.div(templateObject_1$v || (templateObject_1$v =
7654
7688
  var BasePlusButton = function (_a) {
7655
7689
  var onClick = _a.onClick, onClickEdit = _a.onClickEdit, text = _a.text, success = _a.success, editText = _a.editText, successText = _a.successText, rest = __rest(_a, ["onClick", "onClickEdit", "text", "success", "editText", "successText"]);
7656
7690
  var _b = useState(InputValidationType.Empty), status = _b[0], setStatus = _b[1];
7691
+ var _c = useState(''), inputValue = _c[0], setInputValue = _c[1];
7657
7692
  var theme = useTheme();
7658
- var SuccessComponent = (jsx$1(Success, __assign({ successText: successText }, { children: jsx$1(ButtonContainer, __assign({ status: status, type: "secondary", theme: theme }, { children: jsx$1(ButtonSecondaryOutline, { text: editText, onClick: onClickEdit, disabled: rest.disabled }, void 0) }), void 0) }), void 0));
7659
- var Input = (jsx$1(BaseInput, __assign({}, rest, { onValidation: setStatus }, { children: jsx$1(ButtonContainer, __assign({ status: status, type: "primary", theme: theme }, { children: jsx$1(ButtonSecondary, { text: text, onClick: onClick, disabled: rest.disabled || status === InputValidationType.Error }, void 0) }), void 0) }), void 0));
7660
- return success ? SuccessComponent : Input;
7693
+ var onChangeInput = useCallback(function (value) { return setInputValue(value); }, []);
7694
+ if (success) {
7695
+ return (jsx$1(Success, __assign({ successText: successText, size: rest.size }, { children: jsx$1(ButtonContainer, __assign({ status: status, type: "secondary", theme: theme }, { children: jsx$1(ButtonSecondaryOutline, { text: editText, onClick: onClickEdit, disabled: rest.disabled }, void 0) }), void 0) }), void 0));
7696
+ }
7697
+ return (jsx$1(BaseInput, __assign({}, rest, { onValidation: setStatus, onChange: onChangeInput }, { children: jsx$1(ButtonContainer, __assign({ status: status, type: "primary", theme: theme }, { children: jsx$1(ButtonSecondary, { text: text, onClick: function () { return onClick(inputValue); }, disabled: rest.disabled || status === InputValidationType.Error }, void 0) }), void 0) }), void 0));
7661
7698
  };
7662
7699
  var templateObject_1$v;
7663
7700
 
7664
7701
  var Container$i = newStyled.div(templateObject_1$u || (templateObject_1$u = __makeTemplateObject(["\n input {\n padding-right: 2.688rem;\n }\n"], ["\n input {\n padding-right: 2.688rem;\n }\n"])));
7665
- var IconContainer$3 = newStyled.div(templateObject_2$j || (templateObject_2$j = __makeTemplateObject(["\n position: absolute;\n right: 0.875rem;\n width: 1.125rem;\n height: 100%;\n\n svg path {\n fill: ", ";\n }\n"], ["\n position: absolute;\n right: 0.875rem;\n width: 1.125rem;\n height: 100%;\n\n svg path {\n fill: ", ";\n }\n"])), function (props) { return props.color; });
7702
+ var IconContainer$3 = newStyled.div(templateObject_2$j || (templateObject_2$j = __makeTemplateObject(["\n position: absolute;\n right: 0.875rem;\n width: 1.125rem;\n height: 100%;\n display: flex;\n align-items: center;\n\n svg path {\n fill: ", ";\n }\n"], ["\n position: absolute;\n right: 0.875rem;\n width: 1.125rem;\n height: 100%;\n display: flex;\n align-items: center;\n\n svg path {\n fill: ", ";\n }\n"])), function (props) { return props.color; });
7666
7703
  var BasePlusIcon = function (_a) {
7667
7704
  var Icon = _a.Icon, rest = __rest(_a, ["Icon"]);
7668
7705
  var theme = useTheme();
@@ -12863,5 +12900,5 @@ var ProductGalleryMobile = function (_a) {
12863
12900
  };
12864
12901
  var templateObject_1;
12865
12902
 
12866
- export { Accordion, AmazonButton, AssetsProvider, Bundle, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, Card$1 as Card, CardSectionType, CategoryTag, Checkbox, Collection, ComponentPosition, ComponentSize, index as CrossSell, DeliveryDetails, DiscountTag, Drawer, DropdownListIcons, FilteringDropdown, Tags as FilteringTags, FitPredictor, Icon, IconButton, Image$1 as Image, Input$1 as Input, InputValidationType, MultiColorPicker, OfferBanner, OrderBar, Pagination, PaymentMethod, PaypalButton, PriceLabel, ProductGallery, ProductGalleryMobile, ProgressBar, RadioGroupInput, Rating, Review, ScrollToTop, SearchBar, SeasonOfferTag, SimpleDropdown, SimpleOrderItem, SingleColorPicker, SizeFitGuide, SizeSelector, SizeTable, SliderNavigation, Spinner, StarList, Text$3 as Text, TextButton, ThemeProvider, ThemeVariables, Timer, Tooltip, Totals, useOnClickOutside, useTheme, useThemeAssets, useWindowDimensions };
12903
+ export { Accordion, AmazonButton, AssetsProvider, Bundle, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, Card$1 as Card, CardSectionType, CategoryTag, Checkbox, Collection, ComponentPosition, ComponentSize, index as CrossSell, DeliveryDetails, DiscountTag, Drawer, DropdownListIcons, FilteringDropdown, Tags as FilteringTags, FitPredictor, Icon, IconButton, Image$1 as Image, Input$1 as Input, InputValidationType, MultiColorPicker, OfferBanner, OrderBar, Pagination, PaymentMethod, PaypalButton, PriceLabel, ProductGallery, ProductGalleryMobile, ProgressBar, RadioGroupInput, RadioInput, Rating, Review, ScrollToTop, SearchBar, SeasonOfferTag, SimpleDropdown, SimpleOrderItem, SingleColorPicker, SizeFitGuide, SizeSelector, SizeTable, SliderNavigation, Spinner, StarList, Text$3 as Text, TextButton, ThemeProvider, ThemeVariables, Timer, Tooltip, Totals, useOnClickOutside, useTheme, useThemeAssets, useWindowDimensions };
12867
12904
  //# sourceMappingURL=index.esm.js.map