@trafilea/afrodita-components 2.1.0 → 2.3.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.
Files changed (28) hide show
  1. package/README.md +90 -1
  2. package/build/dts/components/collection/index.d.ts +5 -0
  3. package/build/dts/components/collection/product/mobile/ProductItemMobile.d.ts +1 -1
  4. package/build/dts/components/collection/product/mobile/ProductItemMobile.stories.d.ts +1 -1
  5. package/build/dts/components/collection/product/types.d.ts +1 -0
  6. package/build/dts/components/color/selector/PatternSelector.d.ts +8 -0
  7. package/build/dts/components/color/selector/PatternSelector.test.d.ts +1 -0
  8. package/build/dts/components/cross-sell/Checkbox/CrossSellCheckbox.d.ts +13 -0
  9. package/build/dts/components/cross-sell/Checkbox/CrossSellCheckbox.stories.d.ts +9 -0
  10. package/build/dts/components/cross-sell/Checkbox/CrossSellCheckbox.test.d.ts +1 -0
  11. package/build/dts/components/cross-sell/index.d.ts +1 -0
  12. package/build/dts/components/icon-button/IconButton.stories.d.ts +1 -1
  13. package/build/dts/components/icon-button/amazonAndPaypal/AmazonPaypalButtons.d.ts +6 -0
  14. package/build/dts/components/icon-button/amazonAndPaypal/AmazonPaypalButtons.stories.d.ts +7 -0
  15. package/build/dts/components/icon-button/amazonAndPaypal/AmazonPaypalButtons.test.d.ts +1 -0
  16. package/build/dts/components/icons/Payment/Amazon.d.ts +3 -0
  17. package/build/dts/components/icons/Payment/index.d.ts +1 -0
  18. package/build/dts/components/index.d.ts +4 -1
  19. package/build/dts/components/slider/StyledSlider.d.ts +2 -2
  20. package/build/dts/config/breakpoints.d.ts +5 -0
  21. package/build/dts/hooks/WindowDimensions.d.ts +7 -0
  22. package/build/dts/types/types.d.ts +5 -1
  23. package/build/index.d.ts +78 -5
  24. package/build/index.esm.js +1168 -1410
  25. package/build/index.esm.js.map +1 -1
  26. package/build/index.js +1171 -1410
  27. package/build/index.js.map +1 -1
  28. package/package.json +2 -2
package/README.md CHANGED
@@ -1,2 +1,91 @@
1
- # afrodita-components
1
+ # Afrodita Components · ![npm (tag)](https://img.shields.io/npm/v/@trafilea/afrodita-components/latest) ![npm (tag)](https://img.shields.io/npm/v/@trafilea/afrodita-components/beta)
2
+
2
3
  Reusable ReactJS components for Afrodita Design System.
4
+
5
+ ## Installation
6
+
7
+ Afrodita Components is avaiable as an [npm package](https://www.npmjs.com/package/@trafilea/afrodita-components):
8
+
9
+ ```bash
10
+ npm install @trafilea/afrodita-components
11
+ ```
12
+
13
+ ## Usage/Examples
14
+
15
+ ```javascript
16
+ import { ButtonPrimary } from '@trafilea/afrodita-components';
17
+
18
+ function App() {
19
+ return <ButtonPrimary text="Click me!" onClick={() => console.log('Button clicked')} />;
20
+ }
21
+ ```
22
+
23
+ ## Run Locally
24
+
25
+ Clone the project
26
+
27
+ ```bash
28
+ git clone https://github.com/trafilea/afrodita-components.git
29
+ ```
30
+
31
+ Go to the project directory
32
+
33
+ ```bash
34
+ cd afrodita-components
35
+ ```
36
+
37
+ Install dependencies
38
+
39
+ ```bash
40
+ npm install
41
+ ```
42
+
43
+ Start storybook
44
+
45
+ ```bash
46
+ npm run storybook
47
+ ```
48
+
49
+ ## Demo
50
+
51
+ Visit our [Storybook](https://613911030091d9003a28fa18-hjstxthflc.chromatic.com/) deployed in [Chromatic](https://www.chromatic.com/).
52
+
53
+ ## Releases
54
+
55
+ ### Versioning policy
56
+
57
+ In this section we define what versioning policy we’re using for this project. We follow [Semantic Versioning](https://semver.org/spec/v2.0.0.html) principles, a well known and simple way of software versioning.
58
+
59
+ #### Summary
60
+
61
+ Given a version number MAJOR.MINOR.PATCH, increment the:
62
+
63
+ - MAJOR version when you make incompatible API changes,
64
+ - MINOR version when you add functionality in a backwards compatible manner, and
65
+ - PATCH version when you make backwards compatible bug fixes.
66
+
67
+ Additional labels for pre-release are available as extensions to the MAJOR.MINOR.PATCH format.
68
+
69
+ Major releases can also contain new features, and any release can include bug fixes.
70
+
71
+ For more information, visit this [confluence document](https://trafilea.atlassian.net/wiki/spaces/TRAF/pages/3023962113/Releasing).
72
+
73
+ ### Releasing process
74
+
75
+ Note: In this project we’re using the Gitflow workflow.
76
+
77
+ #### Beta versions
78
+
79
+ Beta versions target the **develop** branch and they are not required. We’ll release new beta versions on demand. The CI/CD pipelines will take care of the deployment to the NPM repository every time a new version increment is detected.
80
+
81
+ 1. When the feature or bugfix is finished in its corresponding branch, increment the version number following the versioning policy. You can do it manually by updating the ‘version’ key in package.json or using [npm-version](https://docs.npmjs.com/cli/v7/commands/npm-version) that will increment the version number in package.json (major, minor or patch depending on the parameters), commit the change and create a tag with the same version number. For example: starting with 6.1.2 and running ‘npm version minor’, will increment to 6.2.0
82
+ 2. Start a pull request to develop and once merged the CI/CD pipelines will build and deploy the new version to the NPM repository, with the ‘beta’ tag.
83
+
84
+ #### Production versions
85
+
86
+ Production versions target the **main** branch. Ideally, we want to release new prod versions between medium or small intervals of time to let our consumers adopt the latest versions frequently. The CI/CD pipelines will take care of the deployment to the NPM repository every time a new version increment is detected.
87
+
88
+ 1. When we have a considerable amount of features or bugfixes ready to ship with the new version, increment the version number following the versioning policy. We can achieve this by incrementing the version number previously in the develop branch, or by creating a release (release/x.y.z) branch from develop and updating the version number in it. If opting for the second option, remember the [Gitflow workflow for release branches](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow).
89
+ 2. Create a tag with the version number.
90
+ 3. Start a pull request to main and once merged the CI/CD pipelines will build and deploy the new version to the NPM repository.
91
+ 4. Create a new Release in the github repository. Create the title following: **vx.y.z** (example: v1.0.1), choose the right tag, select the target branch and write a description with all the changes shipped with this new version.
@@ -0,0 +1,5 @@
1
+ import withProductGrid from './grid/WithProductGrid';
2
+ export declare const Collection: {
3
+ ProductItemMobile: ({ title, image, price, rating, size, tags, alignName, }: import("./product/mobile/ProductItemMobile").ProductItemSmallMobileProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
4
+ withProductGrid: typeof withProductGrid;
5
+ };
@@ -3,5 +3,5 @@ import { ProductItemProps } from '../types';
3
3
  export interface ProductItemSmallMobileProps extends ProductItemProps {
4
4
  size: ComponentSize.Medium | ComponentSize.Small;
5
5
  }
6
- declare const ProductItemMobile: ({ title, image, price, rating, size, tags, }: ProductItemSmallMobileProps) => import("@emotion/react/jsx-runtime").JSX.Element;
6
+ declare const ProductItemMobile: ({ title, image, price, rating, size, tags, alignName, }: ProductItemSmallMobileProps) => import("@emotion/react/jsx-runtime").JSX.Element;
7
7
  export default ProductItemMobile;
@@ -3,7 +3,7 @@ import { ProductItemSmallMobileProps } from './ProductItemMobile';
3
3
  import { ComponentSize } from '../../../../types/enums';
4
4
  declare const _default: {
5
5
  title: string;
6
- component: ({ title, image, price, rating, size, tags, }: ProductItemSmallMobileProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
6
+ component: ({ title, image, price, rating, size, tags, alignName, }: ProductItemSmallMobileProps) => import("@emotion/react/types/jsx-namespace").EmotionJSX.Element;
7
7
  argTypes: {
8
8
  size: {
9
9
  options: ComponentSize[];
@@ -10,4 +10,5 @@ export interface ProductItemProps {
10
10
  categoryTagText: string;
11
11
  seasonOfferTagText: string;
12
12
  };
13
+ alignName?: 'left' | 'center';
13
14
  }
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ interface PatternSelectorProps {
3
+ url: string;
4
+ selected: boolean;
5
+ dataTestId?: string;
6
+ }
7
+ export declare const PatternSelector: ({ url, selected, dataTestId }: PatternSelectorProps) => JSX.Element;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export interface CrossSellCheckboxProps extends rightToLeftProps {
3
+ imageURL: string;
4
+ title: string;
5
+ description: string;
6
+ freeShippingText: string;
7
+ onChange: (checked: Boolean) => void;
8
+ }
9
+ interface rightToLeftProps {
10
+ rightToLeft: boolean;
11
+ }
12
+ export declare const CrossSellCheckbox: ({ imageURL, title, description, freeShippingText, rightToLeft, onChange, }: CrossSellCheckboxProps) => JSX.Element;
13
+ export {};
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { Story } from '@storybook/react';
3
+ import { CrossSellCheckboxProps } from './CrossSellCheckbox';
4
+ declare const _default: {
5
+ title: string;
6
+ component: ({ imageURL, title, description, freeShippingText, rightToLeft, onChange, }: CrossSellCheckboxProps) => JSX.Element;
7
+ };
8
+ export default _default;
9
+ export declare const Example: Story<CrossSellCheckboxProps>;
@@ -0,0 +1 @@
1
+ export * from './Checkbox/CrossSellCheckbox';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { Story } from '@storybook/react';
3
3
  import { IconButtonProps } from './IconButton';
4
- import { ComponentSize } from '../..';
4
+ import { ComponentSize } from '../../types/enums';
5
5
  declare const _default: {
6
6
  title: string;
7
7
  component: ({ children, disabled, size, onClick, }: IconButtonProps) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export interface AmazonPaypalBtnProps {
3
+ onClick: () => void;
4
+ }
5
+ export declare const AmazonButton: ({ onClick }: AmazonPaypalBtnProps) => JSX.Element;
6
+ export declare const PaypalButton: ({ onClick }: AmazonPaypalBtnProps) => JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { Story } from '@storybook/react';
2
+ declare const _default: {
3
+ title: string;
4
+ };
5
+ export default _default;
6
+ export declare const Paypal: Story;
7
+ export declare const Amazon: Story;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { IconProps } from '../../../types/types';
3
+ export declare const Amazon: ({ height, width }: IconProps) => JSX.Element;
@@ -4,3 +4,4 @@ export * from './Amex';
4
4
  export * from './JCB';
5
5
  export * from './Paypal';
6
6
  export * from './Klarna';
7
+ export * from './Amazon';
@@ -36,4 +36,7 @@ import Review from './review/Review';
36
36
  import SliderNavigation from './slider/SliderNavigation';
37
37
  import { DropdownListIcons } from './dropdown-list-icons/DropdownListIcons';
38
38
  import Image from './shared/image/Image';
39
- export { ThemeProvider, Icon, Card, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, SimpleDropdown, SizeSelector, SizeFitGuide, TextButton, DiscountTag, PriceLabel, SingleColorPicker, MultiColorPicker, ProductGallery, Rating, FitPredictor, ProgressBar, IconButton, Tooltip, Accordion, AccordionBox, AccordionIcon, Checkbox, RadioGroupInput, Bundle, CategoryTag, SeasonOfferTag, Timer, Input, PaymentMethod, OfferBanner, Totals, DeliveryDetails, ScrollToTop, OrderBar, SizeTable, SimpleOrderItem, Review, SliderNavigation, DropdownListIcons, Image, };
39
+ import * as AmazonAndPaypalButtons from './icon-button/amazonAndPaypal/AmazonPaypalButtons';
40
+ import * as CrossSell from './cross-sell';
41
+ import { Collection } from './collection/index';
42
+ export { ThemeProvider, Icon, Card, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, SimpleDropdown, SizeSelector, SizeFitGuide, TextButton, DiscountTag, PriceLabel, SingleColorPicker, MultiColorPicker, ProductGallery, Rating, FitPredictor, ProgressBar, IconButton, Tooltip, Accordion, AccordionBox, AccordionIcon, Checkbox, RadioGroupInput, Bundle, CategoryTag, SeasonOfferTag, Timer, Input, PaymentMethod, OfferBanner, Totals, DeliveryDetails, ScrollToTop, OrderBar, SizeTable, SimpleOrderItem, Review, SliderNavigation, DropdownListIcons, Image, AmazonAndPaypalButtons, CrossSell, Collection, };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import Slider from 'react-slick';
2
+ import Slider from '@ant-design/react-slick';
3
3
  import 'slick-carousel/slick/slick.css';
4
4
  import 'slick-carousel/slick/slick-theme.css';
5
5
  interface StyledSliderProps {
@@ -8,7 +8,7 @@ interface StyledSliderProps {
8
8
  dotsSpacing: number;
9
9
  arrowPaddingOffset: number;
10
10
  }
11
- declare const StyledSlider: import("@emotion/styled").StyledComponent<import("react-slick").Settings & {
11
+ declare const StyledSlider: import("@emotion/styled").StyledComponent<import("@ant-design/react-slick").Settings & {
12
12
  theme?: import("@emotion/react").Theme | undefined;
13
13
  } & StyledSliderProps, {}, {
14
14
  ref?: import("react").Ref<Slider> | undefined;
@@ -0,0 +1,5 @@
1
+ export declare const Breakpoints: {
2
+ desktop: number;
3
+ tablet: number;
4
+ phone: number;
5
+ };
@@ -0,0 +1,7 @@
1
+ export declare const useWindowDimensions: () => {
2
+ isMobile: boolean;
3
+ windowDimensions: {
4
+ width: number;
5
+ height: number;
6
+ };
7
+ };
@@ -75,9 +75,13 @@ export declare type Color = {
75
75
  secondaryColor?: string;
76
76
  tertiaryColor?: string;
77
77
  };
78
+ export declare type Pattern = {
79
+ url: string;
80
+ };
78
81
  export declare type ColorPickerOption = {
79
82
  label: string;
80
- color: Color;
83
+ color?: Color;
84
+ pattern?: Pattern;
81
85
  };
82
86
  export declare type RadioGroupOption = {
83
87
  value: string;
package/build/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import React, { ReactNode, ElementType } from 'react';
3
3
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
4
+ import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
4
5
 
5
6
  declare const SixtyDaysGuarantee: ({ height, width, fill, title }: IconProps) => JSX.Element;
6
7
 
@@ -232,12 +233,15 @@ declare const Paypal: ({ height, width }: IconProps) => JSX.Element;
232
233
 
233
234
  declare const Klarna: ({ height, width }: IconProps) => JSX.Element;
234
235
 
236
+ declare const Amazon: ({ height, width }: IconProps) => JSX.Element;
237
+
235
238
  declare const Payment_Visa: typeof Visa;
236
239
  declare const Payment_MasterCard: typeof MasterCard;
237
240
  declare const Payment_AMEX: typeof AMEX;
238
241
  declare const Payment_JCB: typeof JCB;
239
242
  declare const Payment_Paypal: typeof Paypal;
240
243
  declare const Payment_Klarna: typeof Klarna;
244
+ declare const Payment_Amazon: typeof Amazon;
241
245
  declare namespace Payment {
242
246
  export {
243
247
  Payment_Visa as Visa,
@@ -246,6 +250,7 @@ declare namespace Payment {
246
250
  Payment_JCB as JCB,
247
251
  Payment_Paypal as Paypal,
248
252
  Payment_Klarna as Klarna,
253
+ Payment_Amazon as Amazon,
249
254
  };
250
255
  }
251
256
 
@@ -370,9 +375,13 @@ declare type Color = {
370
375
  secondaryColor?: string;
371
376
  tertiaryColor?: string;
372
377
  };
378
+ declare type Pattern = {
379
+ url: string;
380
+ };
373
381
  declare type ColorPickerOption = {
374
382
  label: string;
375
- color: Color;
383
+ color?: Color;
384
+ pattern?: Pattern;
376
385
  };
377
386
  declare type RadioGroupOption = {
378
387
  value: string;
@@ -747,10 +756,10 @@ declare const Input: {
747
756
  SimplePlusIcon: ({ Icon, ...rest }: BasePlusIconProps) => JSX.Element;
748
757
  };
749
758
 
750
- declare const index_d_Input: typeof Input;
751
- declare namespace index_d {
759
+ declare const index_d$1_Input: typeof Input;
760
+ declare namespace index_d$1 {
752
761
  export {
753
- index_d_Input as Input,
762
+ index_d$1_Input as Input,
754
763
  };
755
764
  }
756
765
 
@@ -913,4 +922,68 @@ interface ImageProps extends ImageStyleProps {
913
922
  }
914
923
  declare const Image: ({ src, alt, height, width, borderRadius, objectFit, objectPosition, }: ImageProps) => JSX.Element;
915
924
 
916
- export { _default as Accordion, AccordionBox, AccordionIcon, Bundle, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, ButtonType, CTAProps, _default$1 as Card, CardSectionType, CategoryTag, Checkbox, Color, ColorPickerOption, ComponentPosition, ComponentSize, DeliveryDetails, DiscountTag, DropdownListIcons, DropdownListIconsItem, DropdownListIconsSubItem, DropdownOption, FitPredictor, Icon, IconButton, IconProps, IconWithOpacityProps, Image, ImageType, index_d as Input, InputValidationType, MultiColorPicker, OfferBanner, OrderBar, PaymentMethod, PriceLabel, ProductGallery, ProgressBar, RadioGroupInput, RadioGroupOption, Rating, Review, ScrollToTop, SeasonOfferTag, SimpleDropdown, SimpleOrderItem, SingleColorPicker, SizeFitGuide, SizeOption, SizeSelector, SizeTable, SliderNavigation, TextButton, Theme, ThemeProvider, Timer, Tooltip, Totals, WithTestId };
925
+ interface AmazonPaypalBtnProps {
926
+ onClick: () => void;
927
+ }
928
+ declare const AmazonButton: ({ onClick }: AmazonPaypalBtnProps) => JSX.Element;
929
+ declare const PaypalButton: ({ onClick }: AmazonPaypalBtnProps) => JSX.Element;
930
+
931
+ type AmazonPaypalButtons_d_AmazonPaypalBtnProps = AmazonPaypalBtnProps;
932
+ declare const AmazonPaypalButtons_d_AmazonButton: typeof AmazonButton;
933
+ declare const AmazonPaypalButtons_d_PaypalButton: typeof PaypalButton;
934
+ declare namespace AmazonPaypalButtons_d {
935
+ export {
936
+ AmazonPaypalButtons_d_AmazonPaypalBtnProps as AmazonPaypalBtnProps,
937
+ AmazonPaypalButtons_d_AmazonButton as AmazonButton,
938
+ AmazonPaypalButtons_d_PaypalButton as PaypalButton,
939
+ };
940
+ }
941
+
942
+ interface CrossSellCheckboxProps extends rightToLeftProps {
943
+ imageURL: string;
944
+ title: string;
945
+ description: string;
946
+ freeShippingText: string;
947
+ onChange: (checked: Boolean) => void;
948
+ }
949
+ interface rightToLeftProps {
950
+ rightToLeft: boolean;
951
+ }
952
+ declare const CrossSellCheckbox: ({ imageURL, title, description, freeShippingText, rightToLeft, onChange, }: CrossSellCheckboxProps) => JSX.Element;
953
+
954
+ type index_d_CrossSellCheckboxProps = CrossSellCheckboxProps;
955
+ declare const index_d_CrossSellCheckbox: typeof CrossSellCheckbox;
956
+ declare namespace index_d {
957
+ export {
958
+ index_d_CrossSellCheckboxProps as CrossSellCheckboxProps,
959
+ index_d_CrossSellCheckbox as CrossSellCheckbox,
960
+ };
961
+ }
962
+
963
+ interface ProductItemProps {
964
+ title: string;
965
+ image: ImageProps;
966
+ price: Pick<PriceLabelProps, 'finalPrice' | 'originalPrice' | 'color'>;
967
+ rating: Pick<RatingProps, 'rating' | 'reviews'>;
968
+ tags?: {
969
+ categoryTagText: string;
970
+ seasonOfferTagText: string;
971
+ };
972
+ alignName?: 'left' | 'center';
973
+ }
974
+
975
+ interface ProductItemSmallMobileProps extends ProductItemProps {
976
+ size: ComponentSize.Medium | ComponentSize.Small;
977
+ }
978
+
979
+ declare function withProductGrid<P extends ProductItemProps>(ProductItemComponent: React.FC<P>, data: ProductItemProps[]): {
980
+ (props: Omit<P, 'title' | 'image' | 'price' | 'rating'>): JSX.Element;
981
+ displayName: string;
982
+ };
983
+
984
+ declare const Collection: {
985
+ ProductItemMobile: ({ title, image, price, rating, size, tags, alignName, }: ProductItemSmallMobileProps) => _emotion_react_types_jsx_namespace.EmotionJSX.Element;
986
+ withProductGrid: typeof withProductGrid;
987
+ };
988
+
989
+ export { _default as Accordion, AccordionBox, AccordionIcon, AmazonPaypalButtons_d as AmazonAndPaypalButtons, Bundle, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, ButtonType, CTAProps, _default$1 as Card, CardSectionType, CategoryTag, Checkbox, Collection, Color, ColorPickerOption, ComponentPosition, ComponentSize, index_d as CrossSell, DeliveryDetails, DiscountTag, DropdownListIcons, DropdownListIconsItem, DropdownListIconsSubItem, DropdownOption, FitPredictor, Icon, IconButton, IconProps, IconWithOpacityProps, Image, ImageType, index_d$1 as Input, InputValidationType, MultiColorPicker, OfferBanner, OrderBar, Pattern, PaymentMethod, PriceLabel, ProductGallery, ProgressBar, RadioGroupInput, RadioGroupOption, Rating, Review, ScrollToTop, SeasonOfferTag, SimpleDropdown, SimpleOrderItem, SingleColorPicker, SizeFitGuide, SizeOption, SizeSelector, SizeTable, SliderNavigation, TextButton, Theme, ThemeProvider, Timer, Tooltip, Totals, WithTestId };