@faststore/components 2.0.18-alpha.0 → 2.0.24-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.
Files changed (93) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/assets/ArrowRight.d.ts +3 -0
  3. package/dist/assets/ArrowRight.js +8 -0
  4. package/dist/assets/ArrowRight.js.map +1 -0
  5. package/dist/assets/House.d.ts +3 -0
  6. package/dist/assets/House.js +7 -0
  7. package/dist/assets/House.js.map +1 -0
  8. package/dist/assets/index.d.ts +3 -1
  9. package/dist/assets/index.js +3 -1
  10. package/dist/assets/index.js.map +1 -1
  11. package/dist/atoms/Badge/Badge.js +1 -1
  12. package/dist/atoms/Badge/Badge.js.map +1 -1
  13. package/dist/atoms/Button/Button.js +1 -1
  14. package/dist/atoms/Button/Button.js.map +1 -1
  15. package/dist/atoms/Icon/Icon.d.ts +4 -4
  16. package/dist/atoms/Link/Link.d.ts +4 -4
  17. package/dist/atoms/Link/Link.js +1 -1
  18. package/dist/atoms/Link/Link.js.map +1 -1
  19. package/dist/atoms/List/List.js +1 -1
  20. package/dist/atoms/List/List.js.map +1 -1
  21. package/dist/atoms/Overlay/Overlay.js +1 -1
  22. package/dist/atoms/Overlay/Overlay.js.map +1 -1
  23. package/dist/atoms/Price/Price.d.ts +4 -4
  24. package/dist/atoms/Price/Price.js +1 -1
  25. package/dist/atoms/Price/Price.js.map +1 -1
  26. package/dist/atoms/Radio/Radio.js +1 -1
  27. package/dist/atoms/Radio/Radio.js.map +1 -1
  28. package/dist/atoms/SROnly/SROnly.d.ts +2 -2
  29. package/dist/atoms/SROnly/SROnly.js.map +1 -1
  30. package/dist/atoms/Select/Select.d.ts +4 -4
  31. package/dist/atoms/Select/Select.js +1 -1
  32. package/dist/atoms/Select/Select.js.map +1 -1
  33. package/dist/index.d.ts +2 -0
  34. package/dist/index.js +2 -0
  35. package/dist/index.js.map +1 -1
  36. package/dist/molecules/BuyButton/BuyButton.d.ts +2 -2
  37. package/dist/molecules/BuyButton/BuyButton.js +2 -2
  38. package/dist/molecules/BuyButton/BuyButton.js.map +1 -1
  39. package/dist/molecules/DiscountBadge/DiscountBadge.d.ts +5 -5
  40. package/dist/molecules/DiscountBadge/DiscountBadge.js +2 -2
  41. package/dist/molecules/DiscountBadge/DiscountBadge.js.map +1 -1
  42. package/dist/molecules/IconButton/IconButton.js +1 -1
  43. package/dist/molecules/IconButton/IconButton.js.map +1 -1
  44. package/dist/molecules/InputField/InputField.d.ts +5 -1
  45. package/dist/molecules/InputField/InputField.js +2 -2
  46. package/dist/molecules/InputField/InputField.js.map +1 -1
  47. package/dist/molecules/LinkButton/LinkButton.js +1 -1
  48. package/dist/molecules/LinkButton/LinkButton.js.map +1 -1
  49. package/dist/molecules/SelectField/SelectField.js +2 -2
  50. package/dist/molecules/SelectField/SelectField.js.map +1 -1
  51. package/dist/molecules/Tag/Tag.js +1 -1
  52. package/dist/molecules/Tag/Tag.js.map +1 -1
  53. package/dist/molecules/Toggle/Toggle.js +1 -1
  54. package/dist/molecules/Toggle/Toggle.js.map +1 -1
  55. package/dist/organisms/Hero/Hero.d.ts +27 -0
  56. package/dist/organisms/Hero/Hero.js +16 -0
  57. package/dist/organisms/Hero/Hero.js.map +1 -0
  58. package/dist/organisms/Hero/HeroHeading.d.ts +30 -0
  59. package/dist/organisms/Hero/HeroHeading.js +16 -0
  60. package/dist/organisms/Hero/HeroHeading.js.map +1 -0
  61. package/dist/organisms/Hero/HeroImage.d.ts +10 -0
  62. package/dist/organisms/Hero/HeroImage.js +6 -0
  63. package/dist/organisms/Hero/HeroImage.js.map +1 -0
  64. package/dist/organisms/Hero/index.d.ts +6 -0
  65. package/dist/organisms/Hero/index.js +4 -0
  66. package/dist/organisms/Hero/index.js.map +1 -0
  67. package/package.json +2 -2
  68. package/src/assets/ArrowRight.tsx +21 -0
  69. package/src/assets/House.tsx +20 -0
  70. package/src/assets/index.ts +3 -1
  71. package/src/atoms/Badge/Badge.tsx +1 -1
  72. package/src/atoms/Button/Button.tsx +1 -1
  73. package/src/atoms/Icon/Icon.tsx +4 -4
  74. package/src/atoms/Link/Link.tsx +19 -14
  75. package/src/atoms/List/List.tsx +1 -1
  76. package/src/atoms/Overlay/Overlay.tsx +2 -2
  77. package/src/atoms/Price/Price.tsx +5 -5
  78. package/src/atoms/Radio/Radio.tsx +1 -1
  79. package/src/atoms/SROnly/SROnly.tsx +2 -2
  80. package/src/atoms/Select/Select.tsx +6 -6
  81. package/src/index.ts +12 -0
  82. package/src/molecules/BuyButton/BuyButton.tsx +8 -3
  83. package/src/molecules/DiscountBadge/DiscountBadge.tsx +6 -6
  84. package/src/molecules/IconButton/IconButton.tsx +1 -1
  85. package/src/molecules/InputField/InputField.tsx +6 -0
  86. package/src/molecules/LinkButton/LinkButton.tsx +2 -2
  87. package/src/molecules/SelectField/SelectField.tsx +2 -2
  88. package/src/molecules/Tag/Tag.tsx +1 -1
  89. package/src/molecules/Toggle/Toggle.tsx +1 -1
  90. package/src/organisms/Hero/Hero.tsx +68 -0
  91. package/src/organisms/Hero/HeroHeading.tsx +82 -0
  92. package/src/organisms/Hero/HeroImage.tsx +22 -0
  93. package/src/organisms/Hero/index.tsx +8 -0
@@ -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.24-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": "b59392c361cae99ef9b261125b561860b59ee6cd"
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'
@@ -49,11 +49,11 @@ const Badge = forwardRef<HTMLDivElement, BadgeProps>(function Badge(
49
49
  <div
50
50
  ref={ref}
51
51
  data-fs-badge
52
- data-testid={testId}
53
52
  aria-label={ariaLabel}
54
53
  data-fs-badge-variant={counter ? null : variant}
55
54
  data-fs-badge-size={size}
56
55
  data-fs-badge-counter={counter}
56
+ data-testid={testId}
57
57
  {...otherProps}
58
58
  >
59
59
  <div data-fs-badge-wrapper>{children}</div>
@@ -54,12 +54,12 @@ const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(
54
54
  return (
55
55
  <button
56
56
  ref={ref}
57
- data-testid={testId}
58
57
  data-fs-button
59
58
  data-fs-button-inverse={inverse}
60
59
  data-fs-button-size={size}
61
60
  data-fs-button-variant={variant}
62
61
  disabled={disabled}
62
+ data-testid={testId}
63
63
  {...otherProps}
64
64
  >
65
65
  {icon && iconPosition === 'left' && <Icon component={icon} />}
@@ -2,14 +2,14 @@ import type { HTMLAttributes, ReactNode } from 'react'
2
2
  import React, { forwardRef } from 'react'
3
3
 
4
4
  export interface IconProps extends HTMLAttributes<HTMLSpanElement> {
5
- /**
6
- * A React component that will be rendered as an icon.
7
- */
8
- component: ReactNode
9
5
  /**
10
6
  * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
11
7
  */
12
8
  testId?: string
9
+ /**
10
+ * A React component that will be rendered as an icon.
11
+ */
12
+ component: ReactNode
13
13
  }
14
14
 
15
15
  const Icon = forwardRef<HTMLSpanElement, IconProps>(function Button(
@@ -8,12 +8,12 @@ type LinkBaseProps = {
8
8
  */
9
9
  testId?: string
10
10
  /**
11
- * Specifies the component variant.
12
- */
11
+ * Specifies the component variant.
12
+ */
13
13
  variant?: 'default' | 'display' | 'inline'
14
14
  /**
15
- * Defines use of inverted color.
16
- */
15
+ * Defines use of inverted color.
16
+ */
17
17
  inverse?: boolean
18
18
  /**
19
19
  * Defines size os element
@@ -23,10 +23,8 @@ type LinkBaseProps = {
23
23
 
24
24
  export type LinkElementType = ElementType
25
25
 
26
- export type LinkProps<C extends LinkElementType = 'a'> = PolymorphicComponentPropsWithRef<
27
- C,
28
- LinkBaseProps
29
- >
26
+ export type LinkProps<C extends LinkElementType = 'a'> =
27
+ PolymorphicComponentPropsWithRef<C, LinkBaseProps>
30
28
 
31
29
  type LinkComponent = <C extends LinkElementType = 'a'>(
32
30
  props: LinkProps<C>
@@ -35,20 +33,27 @@ type LinkComponent = <C extends LinkElementType = 'a'>(
35
33
  const Link: LinkComponent = forwardRef(function Link<
36
34
  C extends LinkElementType = 'a'
37
35
  >(
38
- { as, children, variant = 'default', size="regular", inverse, testId = 'fs-link', ...otherProps }: LinkProps<C>,
36
+ {
37
+ as,
38
+ children,
39
+ variant = 'default',
40
+ size = 'regular',
41
+ inverse,
42
+ testId = 'fs-link',
43
+ ...otherProps
44
+ }: LinkProps<C>,
39
45
  ref?: PolymorphicRef<C>
40
46
  ) {
41
-
42
47
  const Component = as ?? 'a'
43
48
 
44
49
  return (
45
- <Component
46
- ref={ref}
47
- data-fs-link
50
+ <Component
51
+ ref={ref}
52
+ data-fs-link
48
53
  data-fs-link-variant={variant}
49
54
  data-fs-link-inverse={inverse}
50
55
  data-fs-link-size={size}
51
- data-testid={testId}
56
+ data-testid={testId}
52
57
  {...otherProps}
53
58
  >
54
59
  {children}
@@ -36,8 +36,8 @@ const List: ListComponent = forwardRef(function List<
36
36
  <Component
37
37
  ref={ref}
38
38
  data-fs-list
39
- data-testid={testId}
40
39
  data-fs-list-marker={marker}
40
+ data-testid={testId}
41
41
  {...otherProps}
42
42
  />
43
43
  )
@@ -14,10 +14,10 @@ const Overlay = forwardRef<HTMLDivElement, Props>(function Overlay(
14
14
  ) {
15
15
  return (
16
16
  <div
17
- role="presentation"
17
+ ref={ref}
18
18
  data-fs-overlay
19
+ role="presentation"
19
20
  data-testid={testId}
20
- ref={ref}
21
21
  {...otherProps}
22
22
  />
23
23
  )
@@ -12,14 +12,14 @@ export type PriceFormatter = (price: number, variant: PriceVariant) => ReactNode
12
12
 
13
13
  export interface PriceProps
14
14
  extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
15
- /**
16
- * Set the HTML element tag of this component.
17
- */
18
- as?: ElementType
19
15
  /**
20
16
  * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
21
17
  */
22
18
  testId?: string
19
+ /**
20
+ * Set the HTML element tag of this component.
21
+ */
22
+ as?: ElementType
23
23
  /**
24
24
  * The raw price value.
25
25
  */
@@ -52,8 +52,8 @@ const Price = forwardRef<Omit<HTMLSpanElement, 'children'>, PriceProps>(
52
52
  <Component
53
53
  ref={ref}
54
54
  data-fs-price
55
- data-testid={testId}
56
55
  data-fs-price-variant={variant}
56
+ data-testid={testId}
57
57
  {...otherProps}
58
58
  >
59
59
  {formattedPrice}
@@ -17,8 +17,8 @@ const Radio = forwardRef<HTMLInputElement, RadioProps>(function Radio(
17
17
  <input
18
18
  ref={ref}
19
19
  data-fs-radio
20
- data-testid={testId}
21
20
  type="radio"
21
+ data-testid={testId}
22
22
  {...otherProps}
23
23
  />
24
24
  )
@@ -1,12 +1,12 @@
1
1
  import React from 'react'
2
2
  import type { ElementType } from 'react'
3
3
 
4
- interface Props {
4
+ interface SROnlyProps {
5
5
  text: string
6
6
  as?: ElementType
7
7
  }
8
8
 
9
- function SROnly({ text, as }: Props) {
9
+ function SROnly({ text, as }: SROnlyProps) {
10
10
  const Component = as ?? 'span'
11
11
 
12
12
  return <Component data-fs-sr-only>{text}</Component>
@@ -4,6 +4,10 @@ import { Icon } from '../..'
4
4
  import { CaretDown } from '../../assets'
5
5
 
6
6
  export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
7
+ /**
8
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
9
+ */
10
+ testId?: string
7
11
  /**
8
12
  * Assigns an identifier to link the UISelect component and its label.
9
13
  */
@@ -14,10 +18,6 @@ export interface SelectProps extends SelectHTMLAttributes<HTMLSelectElement> {
14
18
  * will be displayed in the UI.
15
19
  */
16
20
  options: Record<string, string>
17
- /**
18
- * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
19
- */
20
- testId?: string
21
21
  }
22
22
 
23
23
  const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(
@@ -26,14 +26,14 @@ const Select = forwardRef<HTMLSelectElement, SelectProps>(function Select(
26
26
  ) {
27
27
  return (
28
28
  <div data-fs-select>
29
- <select id={id} ref={ref} data-testid={testId} {...otherProps}>
29
+ <select ref={ref} id={id} data-testid={testId} {...otherProps}>
30
30
  {Object.keys(options).map((key) => (
31
31
  <option key={key} value={key}>
32
32
  {options[key]}
33
33
  </option>
34
34
  ))}
35
35
  </select>
36
- <Icon data-fs-select-icon component={<CaretDown />}/>
36
+ <Icon data-fs-select-icon component={<CaretDown />} />
37
37
  </div>
38
38
  )
39
39
  })
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'
@@ -4,11 +4,16 @@ import { Button, Icon } from '../../index'
4
4
  import type { ButtonProps } from '../../index'
5
5
  import { ShoppingCart } from '../../assets'
6
6
 
7
- type Props = ButtonProps
7
+ type BuyButtonProps = ButtonProps
8
8
 
9
- function BuyButton({ icon, children, ...otherProps }: Props) {
9
+ function BuyButton({
10
+ testId = 'fs-buy-button',
11
+ icon,
12
+ children,
13
+ ...otherProps
14
+ }: BuyButtonProps) {
10
15
  return (
11
- <Button data-fs-buy-button {...otherProps}>
16
+ <Button data-fs-buy-button data-testid={testId} {...otherProps}>
12
17
  <Icon component={<ShoppingCart />} />
13
18
  {children}
14
19
  </Button>
@@ -4,6 +4,10 @@ import { Badge } from '../..'
4
4
  import { useDiscountPercent } from '../DiscountBadge/useDiscountPercent'
5
5
 
6
6
  export type DiscountBadgeProps = {
7
+ /**
8
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
9
+ */
10
+ testId?: string
7
11
  /**
8
12
  * Specifies price without discount applied.
9
13
  */
@@ -12,10 +16,6 @@ export type DiscountBadgeProps = {
12
16
  * Specifies current price with discount applied.
13
17
  */
14
18
  spotPrice: number
15
- /**
16
- * Sets the component's size.
17
- */
18
- size?: 'small' | 'big'
19
19
  /**
20
20
  * Sets the limit percentage value to consider a low discount.
21
21
  */
@@ -29,9 +29,9 @@ export type DiscountBadgeProps = {
29
29
  const DiscountBadge = ({
30
30
  listPrice,
31
31
  spotPrice,
32
- size = 'small',
33
32
  thresholdLow = 15,
34
33
  thresholdHigh = 40,
34
+ testId = 'fs-discount-badge',
35
35
  }: DiscountBadgeProps) => {
36
36
  const discountPercent = useDiscountPercent(listPrice, spotPrice)
37
37
 
@@ -48,9 +48,9 @@ const DiscountBadge = ({
48
48
 
49
49
  return (
50
50
  <Badge
51
- size={size}
52
51
  data-fs-discount-badge
53
52
  data-fs-discount-badge-variant={discountVariant}
53
+ data-testid={testId}
54
54
  >
55
55
  {discountPercent}% off
56
56
  </Badge>
@@ -36,9 +36,9 @@ const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(
36
36
  ref={ref}
37
37
  data-fs-button
38
38
  data-fs-icon-button
39
- testId={testId}
40
39
  variant={variant ?? 'tertiary'}
41
40
  aria-label={ariaLabel}
41
+ testId={testId}
42
42
  {...otherProps}
43
43
  >
44
44
  {children}
@@ -6,6 +6,10 @@ import type { InputProps } from '../../index'
6
6
  import { XCircle } from '../../assets'
7
7
 
8
8
  type DefaultProps = {
9
+ /**
10
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
11
+ */
12
+ testId?: string
9
13
  /**
10
14
  * ID to identify input and corresponding label.
11
15
  */
@@ -77,6 +81,7 @@ const InputField = ({
77
81
  inputRef,
78
82
  disabled,
79
83
  value,
84
+ testId = 'fs-input-field',
80
85
  ...otherProps
81
86
  }: InputFieldProps) => {
82
87
  const shouldDisplayError = !disabled && error && error !== ''
@@ -87,6 +92,7 @@ const InputField = ({
87
92
  data-fs-input-field
88
93
  data-fs-input-field-actionable={actionable}
89
94
  data-fs-input-field-error={error && error !== ''}
95
+ data-testid={testId}
90
96
  >
91
97
  <Input
92
98
  id={id}
@@ -31,14 +31,14 @@ function LinkButton({
31
31
  return (
32
32
  <a
33
33
  ref={linkRef}
34
- onFocus={onFocus}
35
34
  data-fs-button
36
35
  data-fs-link-button
37
- data-testid={testId}
38
36
  data-fs-button-size={size}
39
37
  data-fs-button-variant={variant}
40
38
  data-fs-button-inverse={inverse}
41
39
  data-fs-button-disabled={disabled}
40
+ onFocus={onFocus}
41
+ data-testid={testId}
42
42
  {...otherProps}
43
43
  >
44
44
  {iconPosition === 'left' && <Icon component={icon} />}
@@ -19,11 +19,11 @@ const SelectField = forwardRef<
19
19
  ref
20
20
  ) {
21
21
  return (
22
- <div ref={ref} data-fs-select-field>
22
+ <div ref={ref} data-fs-select-field data-testid={testId}>
23
23
  <Label data-fs-select-field-label htmlFor={id}>
24
24
  {label}
25
25
  </Label>
26
- <Select id={id} options={options} data-testid={testId} {...otherProps} />
26
+ <Select id={id} options={options} {...otherProps} />
27
27
  </div>
28
28
  )
29
29
  })
@@ -35,8 +35,8 @@ const Tag = forwardRef<HTMLDivElement, TagProps>(function Tag(
35
35
  <Badge
36
36
  ref={ref}
37
37
  data-fs-tag
38
- data-testid={testId}
39
38
  size="big"
39
+ data-testid={testId}
40
40
  {...otherProps}
41
41
  >
42
42
  <span data-fs-tag-label>{label}</span>
@@ -36,8 +36,8 @@ const Toggle = forwardRef<HTMLInputElement, ToggleProps>(function Toggle(
36
36
  return (
37
37
  <div data-fs-toggle data-fs-toggle-variant={variant} data-testid={testId}>
38
38
  <Input
39
- id={id}
40
39
  ref={ref}
40
+ id={id}
41
41
  role="switch"
42
42
  type="checkbox"
43
43
  disabled={disabled}