@faststore/components 2.0.18-alpha.0 → 2.0.19-alpha.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.0.19-alpha.0](https://github.com/vtex/faststore/compare/v2.0.18-alpha.0...v2.0.19-alpha.0) (2022-12-16)
7
+
8
+
9
+ ### Features
10
+
11
+ * Adds `Hero` component ([#1556](https://github.com/vtex/faststore/issues/1556)) ([871f35c](https://github.com/vtex/faststore/commit/871f35cdcfc85d5ec0038dcc55a9aeedcc5ff546))
12
+
13
+
14
+
6
15
  ## [2.0.18-alpha.0](https://github.com/vtex/faststore/compare/v2.0.17-alpha.0...v2.0.18-alpha.0) (2022-12-15)
7
16
 
8
17
 
@@ -0,0 +1,3 @@
1
+ import type { FC } from 'react';
2
+ declare const ArrowRight: FC;
3
+ export default ArrowRight;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ // Icon from Phosphor Icons
3
+ const ArrowRight = () => (React.createElement("svg", { id: "ArrowRight", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 256 256", strokeWidth: "16", width: 24, height: 24 },
4
+ React.createElement("rect", { width: "256", height: "256", fill: "none" }),
5
+ React.createElement("line", { x1: "40", y1: "128", x2: "216", y2: "128", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "24" }),
6
+ React.createElement("polyline", { points: "144 56 216 128 144 200", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "24" })));
7
+ export default ArrowRight;
8
+ //# sourceMappingURL=ArrowRight.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArrowRight.js","sourceRoot":"","sources":["../../src/assets/ArrowRight.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,2BAA2B;AAC3B,MAAM,UAAU,GAAO,GAAG,EAAE,CAAC,CAC3B,6BACE,EAAE,EAAC,YAAY,EACf,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,aAAa,EACrB,WAAW,EAAC,IAAI,EAChB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE;IAER,8BAAM,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,GAAQ;IAClD,8BAAM,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,KAAK,EAAC,EAAE,EAAC,KAAK,EAAC,EAAE,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,GAAQ;IAChJ,kCAAU,MAAM,EAAC,wBAAwB,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,GAAY,CACnJ,CACP,CAAA;AAED,eAAe,UAAU,CAAA"}
@@ -0,0 +1,3 @@
1
+ import type { FC } from 'react';
2
+ declare const House: FC;
3
+ export default House;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ // Icon from Phosphor Icons
3
+ const House = () => (React.createElement("svg", { id: "House", xmlns: "http://www.w3.org/2000/svg", fill: "currentColor", viewBox: "0 0 256 256", strokeWidth: "16", width: 24, height: 24 },
4
+ React.createElement("rect", { width: "256", height: "256", fill: "none" }),
5
+ React.createElement("path", { d: "M152,208V160a8,8,0,0,0-8-8H112a8,8,0,0,0-8,8v48a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V115.5a8.3,8.3,0,0,1,2.6-5.9l80-72.7a8,8,0,0,1,10.8,0l80,72.7a8.3,8.3,0,0,1,2.6,5.9V208a8,8,0,0,1-8,8H160A8,8,0,0,1,152,208Z", fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "24" })));
6
+ export default House;
7
+ //# sourceMappingURL=House.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"House.js","sourceRoot":"","sources":["../../src/assets/House.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAGzB,2BAA2B;AAC3B,MAAM,KAAK,GAAO,GAAG,EAAE,CAAC,CACtB,6BACE,EAAE,EAAC,OAAO,EACV,KAAK,EAAC,4BAA4B,EAClC,IAAI,EAAC,cAAc,EACnB,OAAO,EAAC,aAAa,EACrB,WAAW,EAAC,IAAI,EAChB,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE;IAEV,8BAAM,KAAK,EAAC,KAAK,EAAC,MAAM,EAAC,KAAK,EAAC,IAAI,EAAC,MAAM,GAAQ;IAClD,8BAAM,CAAC,EAAC,4MAA4M,EAAC,IAAI,EAAC,MAAM,EAAC,MAAM,EAAC,cAAc,EAAC,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,GAAQ,CACxT,CACP,CAAA;AAED,eAAe,KAAK,CAAA"}
@@ -1,5 +1,7 @@
1
+ export { default as ArrowRight } from './ArrowRight';
1
2
  export { default as CaretDown } from './CaretDown';
2
3
  export { default as Checked } from './Checked';
3
- export { default as X } from './X';
4
+ export { default as House } from './House';
4
5
  export { default as ShoppingCart } from './ShoppingCart';
6
+ export { default as X } from './X';
5
7
  export { default as XCircle } from './XCircle';
@@ -1,6 +1,8 @@
1
+ export { default as ArrowRight } from './ArrowRight';
1
2
  export { default as CaretDown } from './CaretDown';
2
3
  export { default as Checked } from './Checked';
3
- export { default as X } from './X';
4
+ export { default as House } from './House';
4
5
  export { default as ShoppingCart } from './ShoppingCart';
6
+ export { default as X } from './X';
5
7
  export { default as XCircle } from './XCircle';
6
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,KAAK,CAAA;AAClC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAA;AACpD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,SAAS,CAAA;AAC1C,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,OAAO,IAAI,CAAC,EAAE,MAAM,KAAK,CAAA;AAClC,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,WAAW,CAAA"}
package/dist/index.d.ts CHANGED
@@ -45,3 +45,5 @@ export { default as Toggle } from './molecules/Toggle';
45
45
  export type { ToggleProps } from './molecules/Toggle';
46
46
  export { default as ToggleField } from './molecules/ToggleField';
47
47
  export type { ToggleFieldProps } from './molecules/ToggleField';
48
+ export { default as Hero, HeroImage, HeroHeading, } from './organisms/Hero';
49
+ export type { HeroProps, HeroImageProps, HeroHeadingProps, } from './organisms/Hero';
package/dist/index.js CHANGED
@@ -26,4 +26,6 @@ export { default as SelectField } from './molecules/SelectField';
26
26
  export { default as Tag } from './molecules/Tag';
27
27
  export { default as Toggle } from './molecules/Toggle';
28
28
  export { default as ToggleField } from './molecules/ToggleField';
29
+ // Organisms
30
+ export { default as Hero, HeroImage, HeroHeading, } from './organisms/Hero';
29
31
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,cAAc,UAAU,CAAA;AAExB,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,YAAY;AACZ,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEhE,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,cAAc,UAAU,CAAA;AAExB,QAAQ;AACR,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAEtD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,cAAc,CAAA;AAE9C,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,eAAe,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAElD,YAAY;AACZ,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEpE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAE9D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAEhE,OAAO,EAAE,OAAO,IAAI,GAAG,EAAE,MAAM,iBAAiB,CAAA;AAEhD,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAEtD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAGhE,YAAY;AACZ,OAAO,EACL,OAAO,IAAI,IAAI,EACf,SAAS,EACT,WAAW,GACZ,MAAM,kBAAkB,CAAA"}
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import type { HTMLAttributes } from 'react';
3
+ declare type Variant = 'primary' | 'secondary';
4
+ declare type ColorVariant = 'main' | 'light' | 'accent';
5
+ interface HeroContext {
6
+ variant: Variant;
7
+ colorVariant: ColorVariant;
8
+ }
9
+ declare const HeroContext: React.Context<HeroContext | undefined>;
10
+ export interface HeroProps extends HTMLAttributes<HTMLDivElement> {
11
+ /**
12
+ * Specifies the component variant.
13
+ */
14
+ variant?: Variant;
15
+ /**
16
+ * Specifies the component's color variant combination.
17
+ */
18
+ colorVariant?: ColorVariant;
19
+ /**
20
+ * ID to find this component in testing tools (e.g.: cypress,
21
+ * testing-library, and jest).
22
+ */
23
+ testId?: string;
24
+ }
25
+ declare const Hero: React.ForwardRefExoticComponent<HeroProps & React.RefAttributes<HTMLDivElement>>;
26
+ export declare function useHero(): HeroContext;
27
+ export default Hero;
@@ -0,0 +1,16 @@
1
+ import React, { forwardRef, useContext, createContext } from 'react';
2
+ const HeroContext = createContext(undefined);
3
+ const Hero = forwardRef(function Hero({ children, testId = 'fs-hero', variant = 'primary', colorVariant = 'main', ...otherProps }, ref) {
4
+ const context = { variant, colorVariant };
5
+ return (React.createElement(HeroContext.Provider, { value: context },
6
+ React.createElement("article", { ref: ref, "data-fs-hero": true, "data-fs-hero-variant": variant, "data-fs-hero-color-variant": colorVariant, "data-testid": testId, ...otherProps }, children)));
7
+ });
8
+ export function useHero() {
9
+ const context = useContext(HeroContext);
10
+ if (context === undefined) {
11
+ throw new Error('Do not use Hero components outside the Hero context.');
12
+ }
13
+ return context;
14
+ }
15
+ export default Hero;
16
+ //# sourceMappingURL=Hero.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Hero.js","sourceRoot":"","sources":["../../../src/organisms/Hero/Hero.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAWpE,MAAM,WAAW,GAAG,aAAa,CAA0B,SAAS,CAAC,CAAA;AAkBrE,MAAM,IAAI,GAAG,UAAU,CAA4B,SAAS,IAAI,CAC9D,EACE,QAAQ,EACR,MAAM,GAAG,SAAS,EAClB,OAAO,GAAG,SAAS,EACnB,YAAY,GAAG,MAAM,EACrB,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,CAAA;IAEzC,OAAO,CACL,oBAAC,WAAW,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO;QAClC,iCACE,GAAG,EAAE,GAAG,gDAEc,OAAO,gCACD,YAAY,iBAC3B,MAAM,KACf,UAAU,IAEb,QAAQ,CACD,CACW,CACxB,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,UAAU,OAAO;IACrB,MAAM,OAAO,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IAEvC,IAAI,OAAO,KAAK,SAAS,EAAE;QACzB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAA;KACxE;IAED,OAAO,OAAO,CAAA;AAChB,CAAC;AAED,eAAe,IAAI,CAAA"}
@@ -0,0 +1,30 @@
1
+ import type { ReactNode, HTMLAttributes } from 'react';
2
+ import React from 'react';
3
+ export interface HeroHeadingProps extends HTMLAttributes<HTMLDivElement> {
4
+ /**
5
+ * Content for the h1 tag.
6
+ */
7
+ title: string;
8
+ /**
9
+ * Content for the p tag.
10
+ */
11
+ subtitle: string;
12
+ /**
13
+ * Icon component for additional customization.
14
+ */
15
+ icon?: ReactNode;
16
+ /**
17
+ * Specifies the URL the action button goes to.
18
+ */
19
+ link?: string;
20
+ /**
21
+ * Specifies the action button's content.
22
+ */
23
+ linkText?: string;
24
+ /**
25
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
26
+ */
27
+ testId?: string;
28
+ }
29
+ declare const HeroHeading: React.ForwardRefExoticComponent<HeroHeadingProps & React.RefAttributes<HTMLDivElement>>;
30
+ export default HeroHeading;
@@ -0,0 +1,16 @@
1
+ import React, { forwardRef } from 'react';
2
+ import { Icon, LinkButton } from '../..';
3
+ import { ArrowRight } from '../../assets';
4
+ import { useHero } from './Hero';
5
+ const HeroHeading = forwardRef(function HeroHeading({ icon, link, title, linkText, subtitle, children, testId = 'fs-hero-heading', ...otherProps }, ref) {
6
+ const { variant, colorVariant } = useHero();
7
+ return (React.createElement("header", { ref: ref, "data-fs-hero-heading": true, "data-testid": testId, ...otherProps },
8
+ React.createElement("div", { "data-fs-hero-wrapper": true, className: "layout__content" },
9
+ React.createElement("div", { "data-fs-hero-info": true },
10
+ React.createElement("h1", { "data-fs-hero-title": true }, title),
11
+ React.createElement("p", { "data-fs-hero-subtitle": true }, subtitle),
12
+ !!link && (React.createElement(LinkButton, { href: link, inverse: colorVariant === 'main', icon: React.createElement(ArrowRight, null), iconPosition: "right" }, linkText))),
13
+ icon && variant === 'secondary' && (React.createElement(Icon, { "data-fs-hero-icon": true, component: icon })))));
14
+ });
15
+ export default HeroHeading;
16
+ //# sourceMappingURL=HeroHeading.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeroHeading.js","sourceRoot":"","sources":["../../../src/organisms/Hero/HeroHeading.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AA6BhC,MAAM,WAAW,GAAG,UAAU,CAC5B,SAAS,WAAW,CAClB,EACE,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,MAAM,GAAG,iBAAiB,EAC1B,GAAG,UAAU,EACd,EACD,GAAG;IAEH,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,GAAG,OAAO,EAAE,CAAA;IAE3C,OAAO,CACL,gCACE,GAAG,EAAE,GAAG,+CAEK,MAAM,KACf,UAAU;QAEd,2DAA0B,SAAS,EAAC,iBAAiB;YACnD;gBACE,0DAAwB,KAAK,CAAM;gBACnC,4DAA0B,QAAQ,CAAK;gBACtC,CAAC,CAAC,IAAI,IAAI,CACT,oBAAC,UAAU,IACT,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,YAAY,KAAK,MAAM,EAChC,IAAI,EAAE,oBAAC,UAAU,OAAG,EACpB,YAAY,EAAC,OAAO,IAEnB,QAAQ,CACE,CACd,CACG;YACL,IAAI,IAAI,OAAO,KAAK,WAAW,IAAI,CAClC,oBAAC,IAAI,+BAAmB,SAAS,EAAE,IAAI,GAAI,CAC5C,CACG,CACC,CACV,CAAA;AACH,CAAC,CACF,CAAA;AAED,eAAe,WAAW,CAAA"}
@@ -0,0 +1,10 @@
1
+ import type { HTMLAttributes } from 'react';
2
+ import React from 'react';
3
+ export interface HeroImageProps extends HTMLAttributes<HTMLDivElement> {
4
+ /**
5
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
6
+ */
7
+ testId?: string;
8
+ }
9
+ declare const HeroImage: React.ForwardRefExoticComponent<HeroImageProps & React.RefAttributes<HTMLDivElement>>;
10
+ export default HeroImage;
@@ -0,0 +1,6 @@
1
+ import React, { forwardRef } from 'react';
2
+ const HeroImage = forwardRef(function HeroImage({ children, testId = 'fs-hero-image', ...otherProps }, ref) {
3
+ return (React.createElement("div", { ref: ref, "data-fs-hero-image": true, "data-testid": testId, ...otherProps }, children));
4
+ });
5
+ export default HeroImage;
6
+ //# sourceMappingURL=HeroImage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HeroImage.js","sourceRoot":"","sources":["../../../src/organisms/Hero/HeroImage.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AASzC,MAAM,SAAS,GAAG,UAAU,CAAiC,SAAS,SAAS,CAC7E,EAAE,QAAQ,EAAE,MAAM,GAAG,eAAe,EAAE,GAAG,UAAU,EAAE,EACrD,GAAG;IAEH,OAAO,CACL,6BAAK,GAAG,EAAE,GAAG,6CAAkC,MAAM,KAAM,UAAU,IAClE,QAAQ,CACL,CACP,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,SAAS,CAAA"}
@@ -0,0 +1,6 @@
1
+ export { default } from './Hero';
2
+ export type { HeroProps } from './Hero';
3
+ export { default as HeroImage } from './HeroImage';
4
+ export type { HeroImageProps } from './HeroImage';
5
+ export { default as HeroHeading } from './HeroHeading';
6
+ export type { HeroHeadingProps } from './HeroHeading';
@@ -0,0 +1,4 @@
1
+ export { default } from './Hero';
2
+ export { default as HeroImage } from './HeroImage';
3
+ export { default as HeroHeading } from './HeroHeading';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/organisms/Hero/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAA;AAGhC,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,aAAa,CAAA;AAGlD,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,eAAe,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/components",
3
- "version": "2.0.18-alpha.0",
3
+ "version": "2.0.19-alpha.0",
4
4
  "module": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "author": "Emerson Laurentino @emersonlaurentino",
@@ -28,5 +28,5 @@
28
28
  "node": "16.18.0",
29
29
  "yarn": "1.19.1"
30
30
  },
31
- "gitHead": "f6117ac7008ebb70368642c145bab4e1f18be831"
31
+ "gitHead": "40266ca0a2dc46a9a3da1632caf5c8a264157efd"
32
32
  }
@@ -0,0 +1,21 @@
1
+ import React from 'react'
2
+ import type { FC } from 'react'
3
+
4
+ // Icon from Phosphor Icons
5
+ const ArrowRight: FC = () => (
6
+ <svg
7
+ id="ArrowRight"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ fill="currentColor"
10
+ viewBox="0 0 256 256"
11
+ strokeWidth="16"
12
+ width={24}
13
+ height={24}
14
+ >
15
+ <rect width="256" height="256" fill="none"></rect>
16
+ <line x1="40" y1="128" x2="216" y2="128" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"></line>
17
+ <polyline points="144 56 216 128 144 200" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"></polyline>
18
+ </svg>
19
+ )
20
+
21
+ export default ArrowRight
@@ -0,0 +1,20 @@
1
+ import React from 'react'
2
+ import type { FC } from 'react'
3
+
4
+ // Icon from Phosphor Icons
5
+ const House: FC = () => (
6
+ <svg
7
+ id="House"
8
+ xmlns="http://www.w3.org/2000/svg"
9
+ fill="currentColor"
10
+ viewBox="0 0 256 256"
11
+ strokeWidth="16"
12
+ width={24}
13
+ height={24}
14
+ >
15
+ <rect width="256" height="256" fill="none"></rect>
16
+ <path d="M152,208V160a8,8,0,0,0-8-8H112a8,8,0,0,0-8,8v48a8,8,0,0,1-8,8H48a8,8,0,0,1-8-8V115.5a8.3,8.3,0,0,1,2.6-5.9l80-72.7a8,8,0,0,1,10.8,0l80,72.7a8.3,8.3,0,0,1,2.6,5.9V208a8,8,0,0,1-8,8H160A8,8,0,0,1,152,208Z" fill="none" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" strokeWidth="24"></path>
17
+ </svg>
18
+ )
19
+
20
+ export default House
@@ -1,5 +1,7 @@
1
+ export { default as ArrowRight } from './ArrowRight'
1
2
  export { default as CaretDown } from './CaretDown'
2
3
  export { default as Checked } from './Checked'
3
- export { default as X } from './X'
4
+ export { default as House } from './House'
4
5
  export { default as ShoppingCart } from './ShoppingCart'
6
+ export { default as X } from './X'
5
7
  export { default as XCircle } from './XCircle'
package/src/index.ts CHANGED
@@ -50,3 +50,15 @@ export { default as Toggle } from './molecules/Toggle'
50
50
  export type { ToggleProps } from './molecules/Toggle'
51
51
  export { default as ToggleField } from './molecules/ToggleField'
52
52
  export type { ToggleFieldProps } from './molecules/ToggleField'
53
+
54
+ // Organisms
55
+ export {
56
+ default as Hero,
57
+ HeroImage,
58
+ HeroHeading,
59
+ } from './organisms/Hero'
60
+ export type {
61
+ HeroProps,
62
+ HeroImageProps,
63
+ HeroHeadingProps,
64
+ } from './organisms/Hero'
@@ -0,0 +1,68 @@
1
+ import React, { forwardRef, useContext, createContext } from 'react'
2
+ import type { HTMLAttributes } from 'react'
3
+
4
+ type Variant = 'primary' | 'secondary'
5
+ type ColorVariant = 'main' | 'light' | 'accent'
6
+
7
+ interface HeroContext {
8
+ variant: Variant
9
+ colorVariant: ColorVariant
10
+ }
11
+
12
+ const HeroContext = createContext<HeroContext | undefined>(undefined)
13
+
14
+ export interface HeroProps extends HTMLAttributes<HTMLDivElement> {
15
+ /**
16
+ * Specifies the component variant.
17
+ */
18
+ variant?: Variant
19
+ /**
20
+ * Specifies the component's color variant combination.
21
+ */
22
+ colorVariant?: ColorVariant
23
+ /**
24
+ * ID to find this component in testing tools (e.g.: cypress,
25
+ * testing-library, and jest).
26
+ */
27
+ testId?: string
28
+ }
29
+
30
+ const Hero = forwardRef<HTMLDivElement, HeroProps>(function Hero(
31
+ {
32
+ children,
33
+ testId = 'fs-hero',
34
+ variant = 'primary',
35
+ colorVariant = 'main',
36
+ ...otherProps
37
+ },
38
+ ref
39
+ ) {
40
+ const context = { variant, colorVariant }
41
+
42
+ return (
43
+ <HeroContext.Provider value={context}>
44
+ <article
45
+ ref={ref}
46
+ data-fs-hero
47
+ data-fs-hero-variant={variant}
48
+ data-fs-hero-color-variant={colorVariant}
49
+ data-testid={testId}
50
+ {...otherProps}
51
+ >
52
+ {children}
53
+ </article>
54
+ </HeroContext.Provider>
55
+ )
56
+ })
57
+
58
+ export function useHero() {
59
+ const context = useContext(HeroContext)
60
+
61
+ if (context === undefined) {
62
+ throw new Error('Do not use Hero components outside the Hero context.')
63
+ }
64
+
65
+ return context
66
+ }
67
+
68
+ export default Hero
@@ -0,0 +1,82 @@
1
+ import type { ReactNode, HTMLAttributes } from 'react'
2
+ import React, { forwardRef } from 'react'
3
+ import { Icon, LinkButton } from '../..'
4
+ import { ArrowRight } from '../../assets'
5
+
6
+ import { useHero } from './Hero'
7
+
8
+ export interface HeroHeadingProps extends HTMLAttributes<HTMLDivElement> {
9
+ /**
10
+ * Content for the h1 tag.
11
+ */
12
+ title: string
13
+ /**
14
+ * Content for the p tag.
15
+ */
16
+ subtitle: string
17
+ /**
18
+ * Icon component for additional customization.
19
+ */
20
+ icon?: ReactNode
21
+ /**
22
+ * Specifies the URL the action button goes to.
23
+ */
24
+ link?: string
25
+ /**
26
+ * Specifies the action button's content.
27
+ */
28
+ linkText?: string
29
+ /**
30
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
31
+ */
32
+ testId?: string
33
+ }
34
+
35
+ const HeroHeading = forwardRef<HTMLDivElement, HeroHeadingProps>(
36
+ function HeroHeading(
37
+ {
38
+ icon,
39
+ link,
40
+ title,
41
+ linkText,
42
+ subtitle,
43
+ children,
44
+ testId = 'fs-hero-heading',
45
+ ...otherProps
46
+ },
47
+ ref
48
+ ) {
49
+ const { variant, colorVariant } = useHero()
50
+
51
+ return (
52
+ <header
53
+ ref={ref}
54
+ data-fs-hero-heading
55
+ data-testid={testId}
56
+ {...otherProps}
57
+ >
58
+ <div data-fs-hero-wrapper className="layout__content">
59
+ <div data-fs-hero-info>
60
+ <h1 data-fs-hero-title>{title}</h1>
61
+ <p data-fs-hero-subtitle>{subtitle}</p>
62
+ {!!link && (
63
+ <LinkButton
64
+ href={link}
65
+ inverse={colorVariant === 'main'}
66
+ icon={<ArrowRight />}
67
+ iconPosition="right"
68
+ >
69
+ {linkText}
70
+ </LinkButton>
71
+ )}
72
+ </div>
73
+ {icon && variant === 'secondary' && (
74
+ <Icon data-fs-hero-icon component={icon} />
75
+ )}
76
+ </div>
77
+ </header>
78
+ )
79
+ }
80
+ )
81
+
82
+ export default HeroHeading
@@ -0,0 +1,22 @@
1
+ import type { HTMLAttributes } from 'react'
2
+ import React, { forwardRef } from 'react'
3
+
4
+ export interface HeroImageProps extends HTMLAttributes<HTMLDivElement> {
5
+ /**
6
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
7
+ */
8
+ testId?: string
9
+ }
10
+
11
+ const HeroImage = forwardRef<HTMLDivElement, HeroImageProps>(function HeroImage(
12
+ { children, testId = 'fs-hero-image', ...otherProps },
13
+ ref
14
+ ) {
15
+ return (
16
+ <div ref={ref} data-fs-hero-image data-testid={testId} {...otherProps}>
17
+ {children}
18
+ </div>
19
+ )
20
+ })
21
+
22
+ export default HeroImage
@@ -0,0 +1,8 @@
1
+ export { default } from './Hero'
2
+ export type { HeroProps } from './Hero'
3
+
4
+ export { default as HeroImage } from './HeroImage'
5
+ export type { HeroImageProps } from './HeroImage'
6
+
7
+ export { default as HeroHeading } from './HeroHeading'
8
+ export type { HeroHeadingProps } from './HeroHeading'