@trafilea/afrodita-components 2.0.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +90 -1
  2. package/build/dts/components/color/selector/PatternSelector.d.ts +8 -0
  3. package/build/dts/components/color/selector/PatternSelector.test.d.ts +1 -0
  4. package/build/dts/components/cross-sell/Checkbox/CrossSellCheckbox.d.ts +13 -0
  5. package/build/dts/components/cross-sell/Checkbox/CrossSellCheckbox.stories.d.ts +9 -0
  6. package/build/dts/components/cross-sell/Checkbox/CrossSellCheckbox.test.d.ts +1 -0
  7. package/build/dts/components/cross-sell/index.d.ts +1 -0
  8. package/build/dts/components/dropdown-list-icons/DropdownListIcons.d.ts +6 -0
  9. package/build/dts/components/dropdown-list-icons/DropdownListIcons.stories.d.ts +9 -0
  10. package/build/dts/components/dropdown-list-icons/DropdownListIcons.test.d.ts +1 -0
  11. package/build/dts/components/dropdown-list-icons/Styled.d.ts +34 -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/Actions/Question.d.ts +3 -0
  17. package/build/dts/components/icons/Actions/index.d.ts +1 -0
  18. package/build/dts/components/icons/Messaging/Comment.d.ts +3 -0
  19. package/build/dts/components/icons/Messaging/index.d.ts +1 -0
  20. package/build/dts/components/icons/PDP/Shipping.d.ts +3 -0
  21. package/build/dts/components/icons/PDP/index.d.ts +1 -0
  22. package/build/dts/components/icons/Payment/Amazon.d.ts +3 -0
  23. package/build/dts/components/icons/Payment/index.d.ts +1 -0
  24. package/build/dts/components/index.d.ts +5 -1
  25. package/build/dts/components/product/order/item/SimpleOrderItem.d.ts +5 -1
  26. package/build/dts/components/product/order/item/SimpleOrderItem.stories.d.ts +2 -1
  27. package/build/dts/components/shared/image/Image.d.ts +3 -1
  28. package/build/dts/config/breakpoints.d.ts +5 -0
  29. package/build/dts/hooks/WindowDimensions.d.ts +7 -0
  30. package/build/dts/types/types.d.ts +14 -1
  31. package/build/index.d.ts +216 -128
  32. package/build/index.esm.js +353 -218
  33. package/build/index.esm.js.map +1 -1
  34. package/build/index.js +357 -218
  35. package/build/index.js.map +1 -1
  36. package/package.json +1 -1
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,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';
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { DropdownListIconsItem } from '../../types/types';
3
+ export interface DropdownListIconsProps {
4
+ items: DropdownListIconsItem[];
5
+ }
6
+ export declare const DropdownListIcons: ({ items }: DropdownListIconsProps) => JSX.Element;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { Story } from '@storybook/react';
3
+ import { DropdownListIconsProps } from './DropdownListIcons';
4
+ declare const _default: {
5
+ title: string;
6
+ component: ({ items }: DropdownListIconsProps) => JSX.Element;
7
+ };
8
+ export default _default;
9
+ export declare const Base: Story<DropdownListIconsProps>;
@@ -0,0 +1,34 @@
1
+ /// <reference types="react" />
2
+ export declare const List: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: import("react").ElementType<any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
6
+ export declare const Item: import("@emotion/styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ as?: import("react").ElementType<any> | undefined;
9
+ }, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
10
+ export declare const DropdownWrapper: import("@emotion/styled").StyledComponent<{
11
+ theme?: import("@emotion/react").Theme | undefined;
12
+ as?: import("react").ElementType<any> | undefined;
13
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
14
+ export declare const ArrowContainer: import("@emotion/styled").StyledComponent<{
15
+ theme?: import("@emotion/react").Theme | undefined;
16
+ as?: import("react").ElementType<any> | undefined;
17
+ }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
18
+ interface StyledDropdownProps {
19
+ borderColor: string;
20
+ }
21
+ export declare const StyledDropdown: import("@emotion/styled").StyledComponent<{
22
+ theme?: import("@emotion/react").Theme | undefined;
23
+ as?: import("react").ElementType<any> | undefined;
24
+ } & StyledDropdownProps, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
25
+ interface DropdownItemProps {
26
+ borderColor: string;
27
+ color: string;
28
+ hoverColor: string;
29
+ }
30
+ export declare const DropdownItem: import("@emotion/styled").StyledComponent<{
31
+ theme?: import("@emotion/react").Theme | undefined;
32
+ as?: import("react").ElementType<any> | undefined;
33
+ } & DropdownItemProps, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
34
+ export {};
@@ -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 Question: ({ height, width, fill }: IconProps) => JSX.Element;
@@ -2,3 +2,4 @@ export * from './Check';
2
2
  export * from './ClearLight';
3
3
  export * from './LightExclamation';
4
4
  export * from './LightCheck';
5
+ export * from './Question';
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { IconProps } from '../../../types/types';
3
+ export declare const Comment: ({ height, width, fill }: IconProps) => JSX.Element;
@@ -1,2 +1,3 @@
1
1
  export * from './QuestionCircle';
2
2
  export * from './Messenger';
3
+ export * from './Comment';
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { IconProps } from '../../../types/types';
3
+ export declare const Shipping: ({ height, width, fill }: IconProps) => JSX.Element;
@@ -7,3 +7,4 @@ export * from './Star';
7
7
  export * from './StarEmpty';
8
8
  export * from './StarHalf';
9
9
  export * from './Stopwatch';
10
+ export * from './Shipping';
@@ -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';
@@ -34,4 +34,8 @@ import { SizeTable } from './size-table/SizeTable';
34
34
  import SimpleOrderItem from './product/order/item/SimpleOrderItem';
35
35
  import Review from './review/Review';
36
36
  import SliderNavigation from './slider/SliderNavigation';
37
- 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, };
37
+ import { DropdownListIcons } from './dropdown-list-icons/DropdownListIcons';
38
+ import Image from './shared/image/Image';
39
+ import * as AmazonAndPaypalButtons from './icon-button/amazonAndPaypal/AmazonPaypalButtons';
40
+ import * as CrossSell from './cross-sell';
41
+ 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, };
@@ -11,6 +11,10 @@ export interface ProductOrderItemProps {
11
11
  alt: string;
12
12
  };
13
13
  price: Price;
14
+ tag?: {
15
+ text: string;
16
+ backgroundColor: string;
17
+ };
14
18
  }
15
- declare const SimpleOrderItem: ({ title, subtitle, image, price }: ProductOrderItemProps) => JSX.Element;
19
+ declare const SimpleOrderItem: ({ title, subtitle, image, price, tag }: ProductOrderItemProps) => JSX.Element;
16
20
  export default SimpleOrderItem;
@@ -3,8 +3,9 @@ import { Story } from '@storybook/react';
3
3
  import { ProductOrderItemProps } from './SimpleOrderItem';
4
4
  declare const _default: {
5
5
  title: string;
6
- component: ({ title, subtitle, image, price }: ProductOrderItemProps) => JSX.Element;
6
+ component: ({ title, subtitle, image, price, tag }: ProductOrderItemProps) => JSX.Element;
7
7
  };
8
8
  export default _default;
9
9
  export declare const Default: Story<ProductOrderItemProps>;
10
10
  export declare const PriceColor: Story<ProductOrderItemProps>;
11
+ export declare const WithTag: Story<ProductOrderItemProps>;
@@ -3,10 +3,12 @@ interface ImageStyleProps {
3
3
  height?: string;
4
4
  width?: string;
5
5
  borderRadius?: string;
6
+ objectFit?: string;
7
+ objectPosition?: string;
6
8
  }
7
9
  export interface ImageProps extends ImageStyleProps {
8
10
  src: string;
9
11
  alt: string;
10
12
  }
11
- declare const Image: ({ src, alt, height, width, borderRadius }: ImageProps) => JSX.Element;
13
+ declare const Image: ({ src, alt, height, width, borderRadius, objectFit, objectPosition, }: ImageProps) => JSX.Element;
12
14
  export default Image;
@@ -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
+ };
@@ -1,3 +1,4 @@
1
+ import { IconType } from '../components/icons';
1
2
  import { ComponentSize } from './enums';
2
3
  export interface Theme {
3
4
  palette: {
@@ -74,9 +75,13 @@ export declare type Color = {
74
75
  secondaryColor?: string;
75
76
  tertiaryColor?: string;
76
77
  };
78
+ export declare type Pattern = {
79
+ url: string;
80
+ };
77
81
  export declare type ColorPickerOption = {
78
82
  label: string;
79
- color: Color;
83
+ color?: Color;
84
+ pattern?: Pattern;
80
85
  };
81
86
  export declare type RadioGroupOption = {
82
87
  value: string;
@@ -93,3 +98,11 @@ export interface IconWithOpacityProps extends IconProps {
93
98
  export interface WithTestId {
94
99
  dataTestId?: string;
95
100
  }
101
+ export declare type DropdownListIconsItem = {
102
+ Icon: IconType;
103
+ items: DropdownListIconsSubItem[];
104
+ };
105
+ export declare type DropdownListIconsSubItem = {
106
+ description: string;
107
+ callback: () => void;
108
+ };