@trafilea/afrodita-components 4.0.2-beta.8 → 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.
- package/build/dts/components/index.d.ts +2 -1
- package/build/dts/components/input/base/BaseInput.d.ts +12 -3
- package/build/dts/components/input/base/BaseInput.stories.d.ts +3 -4
- package/build/dts/components/input/base/Styled.d.ts +2 -1
- package/build/dts/components/input/basePlusButton/BasePlusButton.d.ts +4 -5
- package/build/dts/components/input/basePlusButton/Success.d.ts +4 -3
- package/build/dts/components/input/basePlusIcon/BasePlusIcon.d.ts +2 -2
- package/build/dts/components/input/custom/Custom.d.ts +5 -4
- package/build/dts/components/input/custom/Custom.stories.d.ts +2 -2
- package/build/dts/components/input/index.d.ts +2 -2
- package/build/dts/components/shared/button/Button.d.ts +6 -0
- package/build/index.d.ts +37 -15
- package/build/index.esm.js +75 -39
- package/build/index.esm.js.map +1 -1
- package/build/index.js +75 -38
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
4
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
3
|
+
import { ButtonProps } from 'src/components/shared/button/Button';
|
|
4
|
+
export declare type CustomProps = BaseInputProps & {
|
|
4
5
|
onClick: () => void;
|
|
5
6
|
text: string;
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
export declare const Custom: ({ onClick, text,
|
|
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,
|
|
6
|
+
component: ({ onClick, text, variant, ...rest }: CustomProps) => JSX.Element;
|
|
7
7
|
};
|
|
8
8
|
export default _default;
|
|
9
|
-
export declare const
|
|
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,
|
|
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
|
};
|
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';
|
|
@@ -675,41 +676,50 @@ interface TimerProps extends TimeProps {
|
|
|
675
676
|
}
|
|
676
677
|
declare const Timer: ({ onTimeUp, ...rest }: TimerProps) => JSX.Element;
|
|
677
678
|
|
|
678
|
-
interface
|
|
679
|
+
interface BaseInputCommmonProps {
|
|
679
680
|
defaultValue?: string;
|
|
680
681
|
maxLength?: number;
|
|
681
682
|
placeholder?: string;
|
|
682
683
|
label?: string;
|
|
683
|
-
onChange?: (value: string) => void;
|
|
684
684
|
onValidation?: (status: InputValidationType) => void;
|
|
685
685
|
disabled?: boolean;
|
|
686
686
|
required?: string;
|
|
687
687
|
children?: React.ReactNode;
|
|
688
|
-
|
|
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;
|
|
689
699
|
|
|
690
|
-
|
|
700
|
+
declare type BasePlusIconProps = BaseInputProps & {
|
|
691
701
|
Icon: IconType;
|
|
692
|
-
}
|
|
702
|
+
};
|
|
693
703
|
|
|
694
|
-
declare type
|
|
695
|
-
|
|
696
|
-
onClick: () => void;
|
|
704
|
+
declare type BasePlusButtonProps = BaseInputProps & {
|
|
705
|
+
label?: undefined;
|
|
706
|
+
onClick: (value: string) => void;
|
|
697
707
|
onClickEdit: () => void;
|
|
698
708
|
text: string;
|
|
699
709
|
success: boolean;
|
|
700
710
|
editText: string;
|
|
701
711
|
successText: string;
|
|
702
|
-
}
|
|
712
|
+
};
|
|
703
713
|
|
|
704
|
-
|
|
714
|
+
declare type CustomProps = BaseInputProps & {
|
|
705
715
|
onClick: () => void;
|
|
706
716
|
text: string;
|
|
707
|
-
|
|
708
|
-
}
|
|
717
|
+
variant: ButtonProps['variant'];
|
|
718
|
+
};
|
|
709
719
|
|
|
710
720
|
declare const Input: {
|
|
711
|
-
Simple: ({ onChange, defaultValue, label, children, required, onValidation, ...rest }: BaseInputProps) => JSX.Element;
|
|
712
|
-
Custom: ({ onClick, text,
|
|
721
|
+
Simple: ({ value, onChange, defaultValue, label, children, required, onValidation, size, ...rest }: BaseInputProps) => JSX.Element;
|
|
722
|
+
Custom: ({ onClick, text, variant, ...rest }: CustomProps) => JSX.Element;
|
|
713
723
|
SimplePlusButton: ({ onClick, onClickEdit, text, success, editText, successText, ...rest }: BasePlusButtonProps) => JSX.Element;
|
|
714
724
|
SimplePlusIcon: ({ Icon, ...rest }: BasePlusIconProps) => JSX.Element;
|
|
715
725
|
};
|
|
@@ -1102,6 +1112,18 @@ interface ProductGalleryMobileProps {
|
|
|
1102
1112
|
}
|
|
1103
1113
|
declare const ProductGalleryMobile: ({ images, selectedValue, DiscountTagElement, BestSellerTagElement, productImageDataTestId, slideDotsDataTestId, }: ProductGalleryMobileProps) => JSX.Element;
|
|
1104
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
|
+
|
|
1105
1127
|
declare const ThemeProvider: FC<{
|
|
1106
1128
|
theme: Theme;
|
|
1107
1129
|
children: ReactNode;
|
|
@@ -1493,4 +1515,4 @@ declare const useWindowDimensions: (breakpoints: ThemeBreakpoints$1) => {
|
|
|
1493
1515
|
};
|
|
1494
1516
|
};
|
|
1495
1517
|
|
|
1496
|
-
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 };
|
package/build/index.esm.js
CHANGED
|
@@ -4439,7 +4439,7 @@ function Disclosure(props) {
|
|
|
4439
4439
|
} // ---
|
|
4440
4440
|
|
|
4441
4441
|
var DEFAULT_BUTTON_TAG$1 = 'button';
|
|
4442
|
-
var Button$
|
|
4442
|
+
var Button$7 = /*#__PURE__*/forwardRefWithAs(function Button(props, ref) {
|
|
4443
4443
|
var _useDisclosureContext = useDisclosureContext([Disclosure.name, Button.name].join('.')),
|
|
4444
4444
|
state = _useDisclosureContext[0],
|
|
4445
4445
|
dispatch = _useDisclosureContext[1];
|
|
@@ -4602,7 +4602,7 @@ var Panel = /*#__PURE__*/forwardRefWithAs(function Panel(props, ref) {
|
|
|
4602
4602
|
}));
|
|
4603
4603
|
}); // ---
|
|
4604
4604
|
|
|
4605
|
-
Disclosure.Button = Button$
|
|
4605
|
+
Disclosure.Button = Button$7;
|
|
4606
4606
|
Disclosure.Panel = Panel;
|
|
4607
4607
|
|
|
4608
4608
|
function disposables() {
|
|
@@ -4998,7 +4998,7 @@ function Listbox(props) {
|
|
|
4998
4998
|
} // ---
|
|
4999
4999
|
|
|
5000
5000
|
var DEFAULT_BUTTON_TAG = 'button';
|
|
5001
|
-
var Button$
|
|
5001
|
+
var Button$6 = /*#__PURE__*/forwardRefWithAs(function Button(props, ref) {
|
|
5002
5002
|
var _state$optionsRef$cur;
|
|
5003
5003
|
|
|
5004
5004
|
var _useListboxContext = useListboxContext([Listbox.name, Button.name].join('.')),
|
|
@@ -5457,7 +5457,7 @@ function Option$2(props) {
|
|
|
5457
5457
|
} // ---
|
|
5458
5458
|
|
|
5459
5459
|
|
|
5460
|
-
Listbox.Button = Button$
|
|
5460
|
+
Listbox.Button = Button$6;
|
|
5461
5461
|
Listbox.Label = Label$4;
|
|
5462
5462
|
Listbox.Options = Options;
|
|
5463
5463
|
Listbox.Option = Option$2;
|
|
@@ -6774,11 +6774,11 @@ var ImageSmallPreview = function (_a) {
|
|
|
6774
6774
|
var templateObject_1$O;
|
|
6775
6775
|
|
|
6776
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"])));
|
|
6777
|
-
var Button$
|
|
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"])));
|
|
6778
6778
|
var ImagePreviewList = function (_a) {
|
|
6779
6779
|
var images = _a.images, selectedImage = _a.selectedImage, onClick = _a.onClick, dataTestId = _a.dataTestId;
|
|
6780
6780
|
return (jsx(Container$w, __assign({ "data-testid": dataTestId }, { children: images.map(function (item) {
|
|
6781
|
-
return (jsx(Button$
|
|
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));
|
|
6782
6782
|
}) }), void 0));
|
|
6783
6783
|
};
|
|
6784
6784
|
var templateObject_1$N, templateObject_2$v;
|
|
@@ -7525,7 +7525,7 @@ var Container$k = newStyled.div(templateObject_1$y || (templateObject_1$y = __ma
|
|
|
7525
7525
|
var color = _a.color;
|
|
7526
7526
|
return color;
|
|
7527
7527
|
});
|
|
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
|
|
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) {
|
|
7529
7529
|
var padding = _a.padding;
|
|
7530
7530
|
return padding;
|
|
7531
7531
|
}, function (_a) {
|
|
@@ -7568,34 +7568,49 @@ var StyledInput = newStyled.input(templateObject_2$m || (templateObject_2$m = __
|
|
|
7568
7568
|
var disabledColor = _a.disabledColor;
|
|
7569
7569
|
return disabledColor;
|
|
7570
7570
|
});
|
|
7571
|
-
var InputWrapper = newStyled.div(templateObject_3$f || (templateObject_3$f = __makeTemplateObject(["\n position: relative;\n display: flex;\n height:
|
|
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
|
+
});
|
|
7572
7575
|
var templateObject_1$y, templateObject_2$m, templateObject_3$f;
|
|
7573
7576
|
|
|
7574
7577
|
var BaseInput = function (_a) {
|
|
7575
|
-
var
|
|
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"]);
|
|
7576
7580
|
var theme = useTheme();
|
|
7577
|
-
var
|
|
7578
|
-
var
|
|
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];
|
|
7579
7583
|
var handleChange = function (_a) {
|
|
7580
|
-
var
|
|
7581
|
-
|
|
7582
|
-
|
|
7584
|
+
var target = _a.target;
|
|
7585
|
+
if (onChange) {
|
|
7586
|
+
onChange(target.value);
|
|
7587
|
+
}
|
|
7588
|
+
if (value == null) {
|
|
7589
|
+
setInternalValue(target.value);
|
|
7590
|
+
}
|
|
7583
7591
|
};
|
|
7584
7592
|
var validate = function (_a) {
|
|
7585
7593
|
var value = _a.target.value;
|
|
7586
|
-
var
|
|
7587
|
-
setStatus(newStatus);
|
|
7588
|
-
onValidation && onValidation(newStatus);
|
|
7589
|
-
};
|
|
7590
|
-
var handleValidations = function (value) {
|
|
7594
|
+
var status = InputValidationType.Valid;
|
|
7591
7595
|
if (required && isEmpty(value)) {
|
|
7592
|
-
|
|
7596
|
+
status = InputValidationType.Error;
|
|
7593
7597
|
}
|
|
7594
7598
|
if (!required && isEmpty(value)) {
|
|
7595
|
-
|
|
7599
|
+
status = InputValidationType.Empty;
|
|
7596
7600
|
}
|
|
7597
|
-
|
|
7601
|
+
setStatus(status);
|
|
7598
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]);
|
|
7599
7614
|
var styling = {
|
|
7600
7615
|
border: theme.component.input.border,
|
|
7601
7616
|
borderRadius: theme.component.input.borderRadius,
|
|
@@ -7614,39 +7629,57 @@ var BaseInput = function (_a) {
|
|
|
7614
7629
|
? theme.colors.shades['700'].color
|
|
7615
7630
|
: status === InputValidationType.Error
|
|
7616
7631
|
? theme.colors.semantic.urgent.color
|
|
7617
|
-
: '' }, { 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:
|
|
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));
|
|
7633
|
+
};
|
|
7634
|
+
|
|
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));
|
|
7618
7647
|
};
|
|
7619
7648
|
|
|
7620
|
-
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) {
|
|
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) {
|
|
7621
7650
|
var theme = _a.theme;
|
|
7622
7651
|
return theme.component.inputCustom.input.borderRadius;
|
|
7623
7652
|
});
|
|
7624
|
-
var ButtonContainer$1 = newStyled.div(templateObject_2$l || (templateObject_2$l = __makeTemplateObject(["\n width:
|
|
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) {
|
|
7625
7654
|
var theme = _a.theme;
|
|
7626
7655
|
return theme.component.inputCustom.button.borderRadius;
|
|
7627
7656
|
});
|
|
7628
7657
|
var Custom = function (_a) {
|
|
7629
|
-
var onClick = _a.onClick, text = _a.text,
|
|
7658
|
+
var onClick = _a.onClick, text = _a.text, variant = _a.variant, rest = __rest(_a, ["onClick", "text", "variant"]);
|
|
7630
7659
|
var theme = useTheme();
|
|
7631
|
-
var props = {
|
|
7660
|
+
var props = useMemo(function () { return ({
|
|
7661
|
+
variant: variant,
|
|
7632
7662
|
onClick: onClick,
|
|
7633
7663
|
text: text,
|
|
7634
7664
|
disabled: rest.disabled,
|
|
7635
|
-
};
|
|
7636
|
-
return (jsx$1(Container$j, __assign({ theme: theme }, { children: jsx$1(BaseInput, __assign({}, rest, { children: jsx$1(ButtonContainer$1, __assign({ theme: theme }, { children:
|
|
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));
|
|
7637
7667
|
};
|
|
7638
7668
|
var templateObject_1$x, templateObject_2$l;
|
|
7639
7669
|
|
|
7640
|
-
var SuccessContainer = newStyled.div(templateObject_1$w || (templateObject_1$w = __makeTemplateObject(["\n height:
|
|
7641
|
-
var
|
|
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"])));
|
|
7642
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"])));
|
|
7643
7676
|
var Success = function (_a) {
|
|
7644
|
-
var children = _a.children, successText = _a.successText;
|
|
7645
|
-
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));
|
|
7646
7679
|
};
|
|
7647
7680
|
var templateObject_1$w, templateObject_2$k, templateObject_3$e;
|
|
7648
7681
|
|
|
7649
|
-
var ButtonContainer = newStyled.div(templateObject_1$v || (templateObject_1$v = __makeTemplateObject(["\n margin-left: 0.625rem;\n
|
|
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) {
|
|
7650
7683
|
var status = _a.status, type = _a.type, theme = _a.theme;
|
|
7651
7684
|
return status === InputValidationType.Empty &&
|
|
7652
7685
|
type === 'primary' &&
|
|
@@ -7655,15 +7688,18 @@ var ButtonContainer = newStyled.div(templateObject_1$v || (templateObject_1$v =
|
|
|
7655
7688
|
var BasePlusButton = function (_a) {
|
|
7656
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"]);
|
|
7657
7690
|
var _b = useState(InputValidationType.Empty), status = _b[0], setStatus = _b[1];
|
|
7691
|
+
var _c = useState(''), inputValue = _c[0], setInputValue = _c[1];
|
|
7658
7692
|
var theme = useTheme();
|
|
7659
|
-
var
|
|
7660
|
-
|
|
7661
|
-
|
|
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));
|
|
7662
7698
|
};
|
|
7663
7699
|
var templateObject_1$v;
|
|
7664
7700
|
|
|
7665
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"])));
|
|
7666
|
-
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; });
|
|
7667
7703
|
var BasePlusIcon = function (_a) {
|
|
7668
7704
|
var Icon = _a.Icon, rest = __rest(_a, ["Icon"]);
|
|
7669
7705
|
var theme = useTheme();
|
|
@@ -12864,5 +12900,5 @@ var ProductGalleryMobile = function (_a) {
|
|
|
12864
12900
|
};
|
|
12865
12901
|
var templateObject_1;
|
|
12866
12902
|
|
|
12867
|
-
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 };
|
|
12868
12904
|
//# sourceMappingURL=index.esm.js.map
|