@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,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'