@faststore/components 2.0.70-alpha.0 → 2.0.73-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 (69) hide show
  1. package/dist/assets/ClockClockwise.d.ts +3 -0
  2. package/dist/assets/ClockClockwise.js +10 -0
  3. package/dist/assets/ClockClockwise.js.map +1 -0
  4. package/dist/assets/index.d.ts +1 -0
  5. package/dist/assets/index.js +1 -0
  6. package/dist/assets/index.js.map +1 -1
  7. package/dist/index.d.ts +9 -3
  8. package/dist/index.js +5 -2
  9. package/dist/index.js.map +1 -1
  10. package/dist/molecules/CartItem/CartItem.js +2 -2
  11. package/dist/molecules/CartItem/CartItem.js.map +1 -1
  12. package/dist/molecules/Gift/GiftContent.d.ts +23 -0
  13. package/dist/molecules/Gift/GiftContent.js +10 -2
  14. package/dist/molecules/Gift/GiftContent.js.map +1 -1
  15. package/dist/molecules/Modal/ModalHeader.d.ts +2 -2
  16. package/dist/molecules/Modal/ModalHeader.js +2 -2
  17. package/dist/molecules/Modal/ModalHeader.js.map +1 -1
  18. package/dist/molecules/SearchHistory/SearchHistory.d.ts +21 -0
  19. package/dist/molecules/SearchHistory/SearchHistory.js +11 -0
  20. package/dist/molecules/SearchHistory/SearchHistory.js.map +1 -0
  21. package/dist/molecules/SearchHistory/SearchHistoryTerm.d.ts +23 -0
  22. package/dist/molecules/SearchHistory/SearchHistoryTerm.js +11 -0
  23. package/dist/molecules/SearchHistory/SearchHistoryTerm.js.map +1 -0
  24. package/dist/molecules/SearchHistory/index.d.ts +4 -0
  25. package/dist/molecules/SearchHistory/index.js +3 -0
  26. package/dist/molecules/SearchHistory/index.js.map +1 -0
  27. package/dist/molecules/SearchTop/SearchTop.d.ts +22 -0
  28. package/dist/molecules/SearchTop/SearchTop.js +11 -0
  29. package/dist/molecules/SearchTop/SearchTop.js.map +1 -0
  30. package/dist/molecules/SearchTop/SearchTopTerm.d.ts +23 -0
  31. package/dist/molecules/SearchTop/SearchTopTerm.js +11 -0
  32. package/dist/molecules/SearchTop/SearchTopTerm.js.map +1 -0
  33. package/dist/molecules/SearchTop/index.d.ts +4 -0
  34. package/dist/molecules/SearchTop/index.js +3 -0
  35. package/dist/molecules/SearchTop/index.js.map +1 -0
  36. package/dist/organisms/Hero/{HeroHeading.d.ts → HeroHeader.d.ts} +3 -3
  37. package/dist/organisms/Hero/{HeroHeading.js → HeroHeader.js} +3 -3
  38. package/dist/organisms/Hero/HeroHeader.js.map +1 -0
  39. package/dist/organisms/Hero/index.d.ts +2 -2
  40. package/dist/organisms/Hero/index.js +1 -1
  41. package/dist/organisms/Hero/index.js.map +1 -1
  42. package/dist/organisms/SlideOver/SlideOver.d.ts +34 -0
  43. package/dist/organisms/SlideOver/SlideOver.js +7 -0
  44. package/dist/organisms/SlideOver/SlideOver.js.map +1 -0
  45. package/dist/organisms/SlideOver/SlideOverHeader.d.ts +16 -0
  46. package/dist/organisms/SlideOver/SlideOverHeader.js +10 -0
  47. package/dist/organisms/SlideOver/SlideOverHeader.js.map +1 -0
  48. package/dist/organisms/SlideOver/index.d.ts +4 -0
  49. package/dist/organisms/SlideOver/index.js +3 -0
  50. package/dist/organisms/SlideOver/index.js.map +1 -0
  51. package/package.json +4 -4
  52. package/src/assets/ClockClockwise.tsx +56 -0
  53. package/src/assets/index.ts +1 -0
  54. package/src/index.ts +19 -6
  55. package/src/molecules/CartItem/CartItem.tsx +2 -0
  56. package/src/molecules/Gift/GiftContent.tsx +48 -2
  57. package/src/molecules/Modal/ModalHeader.tsx +3 -3
  58. package/src/molecules/SearchHistory/SearchHistory.tsx +44 -0
  59. package/src/molecules/SearchHistory/SearchHistoryTerm.tsx +44 -0
  60. package/src/molecules/SearchHistory/index.ts +5 -0
  61. package/src/molecules/SearchTop/SearchTop.tsx +53 -0
  62. package/src/molecules/SearchTop/SearchTopTerm.tsx +46 -0
  63. package/src/molecules/SearchTop/index.ts +5 -0
  64. package/src/organisms/Hero/{HeroHeading.tsx → HeroHeader.tsx} +4 -4
  65. package/src/organisms/Hero/index.tsx +2 -2
  66. package/src/organisms/SlideOver/SlideOver.tsx +65 -0
  67. package/src/organisms/SlideOver/SlideOverHeader.tsx +40 -0
  68. package/src/organisms/SlideOver/index.ts +5 -0
  69. package/dist/organisms/Hero/HeroHeading.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/components",
3
- "version": "2.0.70-alpha.0",
3
+ "version": "2.0.73-alpha.0",
4
4
  "module": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
6
6
  "author": "Emerson Laurentino @emersonlaurentino",
@@ -21,8 +21,8 @@
21
21
  "src"
22
22
  ],
23
23
  "devDependencies": {
24
- "@faststore/eslint-config": "^2.0.66-alpha.0",
25
- "@faststore/shared": "^2.0.66-alpha.0",
24
+ "@faststore/eslint-config": "^2.0.73-alpha.0",
25
+ "@faststore/shared": "^2.0.73-alpha.0",
26
26
  "eslint": "7.32.0",
27
27
  "typescript": "^4.8.4"
28
28
  },
@@ -30,5 +30,5 @@
30
30
  "node": "16.18.0",
31
31
  "yarn": "1.19.1"
32
32
  },
33
- "gitHead": "5718a199c16ee52a9446cd4090a4f564863c4243"
33
+ "gitHead": "6ea74fc2ff1eaa78550e8801304eeac29e7d5938"
34
34
  }
@@ -0,0 +1,56 @@
1
+ import React from 'react'
2
+ import type { FC } from 'react'
3
+
4
+ // Icon from Phosphor Icons
5
+ const ClockClockwise: FC = () => (
6
+ <svg
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ fill="currentColor"
9
+ viewBox="0 0 256 256"
10
+ strokeWidth="16"
11
+ width={24}
12
+ height={24}
13
+ >
14
+ <rect width="256" height="256" fill="none"></rect>
15
+ <line
16
+ x1="128"
17
+ y1="80"
18
+ x2="128"
19
+ y2="128"
20
+ fill="none"
21
+ stroke="currentColor"
22
+ stroke-linecap="round"
23
+ stroke-linejoin="round"
24
+ stroke-width="16"
25
+ ></line>
26
+ <line
27
+ x1="169.6"
28
+ y1="152"
29
+ x2="128"
30
+ y2="128"
31
+ fill="none"
32
+ stroke="currentColor"
33
+ stroke-linecap="round"
34
+ stroke-linejoin="round"
35
+ stroke-width="16"
36
+ ></line>
37
+ <polyline
38
+ points="184.2 99.7 224.2 99.7 224.2 59.7"
39
+ fill="none"
40
+ stroke="currentColor"
41
+ stroke-linecap="round"
42
+ stroke-linejoin="round"
43
+ stroke-width="16"
44
+ ></polyline>
45
+ <path
46
+ d="M190.2,190.2a88,88,0,1,1,0-124.4l34,33.9"
47
+ fill="none"
48
+ stroke="currentColor"
49
+ stroke-linecap="round"
50
+ stroke-linejoin="round"
51
+ stroke-width="16"
52
+ ></path>
53
+ </svg>
54
+ )
55
+
56
+ export default ClockClockwise
@@ -5,6 +5,7 @@ export { default as ArrowElbowDownRight } from './ArrowElbowDownRight'
5
5
  export { default as ArrowRight } from './ArrowRight'
6
6
  export { default as CaretDown } from './CaretDown'
7
7
  export { default as Checked } from './Checked'
8
+ export { default as ClockClockwise } from './ClockClockwise'
8
9
  export { default as DotsThree } from './DotsThree'
9
10
  export { default as Heart } from './Heart'
10
11
  export { default as House } from './House'
package/src/index.ts CHANGED
@@ -52,10 +52,7 @@ export type {
52
52
  } from './molecules/Accordion'
53
53
  export { default as Alert } from './molecules/Alert'
54
54
  export type { AlertProps } from './molecules/Alert'
55
- export {
56
- BreadcrumbPure,
57
- Breadcrumb,
58
- } from './molecules/Breadcrumb'
55
+ export { BreadcrumbPure, Breadcrumb } from './molecules/Breadcrumb'
59
56
  export type {
60
57
  BreadcrumbPureProps,
61
58
  BreadcrumbProps,
@@ -119,6 +116,14 @@ export { default as RadioGroup, RadioOption } from './molecules/RadioGroup'
119
116
  export type { RadioGroupProps, RadioOptionProps } from './molecules/RadioGroup'
120
117
  export { default as Rating } from './molecules/Rating'
121
118
  export type { RatingProps } from './molecules/Rating'
119
+ export {
120
+ default as SearchHistory,
121
+ SearchHistoryTerm,
122
+ } from './molecules/SearchHistory'
123
+ export type {
124
+ SearchHistoryProps,
125
+ SearchHistoryTermProps,
126
+ } from './molecules/SearchHistory'
122
127
  export {
123
128
  default as SearchProductCard,
124
129
  SearchProductCardImage,
@@ -129,6 +134,8 @@ export type {
129
134
  SearchProductCardImageProps,
130
135
  SearchProductCardContentProps,
131
136
  } from './molecules/SearchProductCard'
137
+ export { default as SearchTop, SearchTopTerm } from './molecules/SearchTop'
138
+ export type { SearchTopProps, SearchTopTermProps } from './molecules/SearchTop'
132
139
  export { default as SelectField } from './molecules/SelectField'
133
140
  export type { SelectFieldProps } from './molecules/SelectField'
134
141
  export {
@@ -157,11 +164,11 @@ export { default as QuantitySelector } from './molecules/QuantitySelector'
157
164
  export type { QuantitySelectorProps } from './molecules/QuantitySelector'
158
165
 
159
166
  // Organisms
160
- export { default as Hero, HeroImage, HeroHeading } from './organisms/Hero'
167
+ export { default as Hero, HeroImage, HeroHeader } from './organisms/Hero'
161
168
  export type {
162
169
  HeroProps,
163
170
  HeroImageProps,
164
- HeroHeadingProps,
171
+ HeroHeaderProps,
165
172
  } from './organisms/Hero'
166
173
 
167
174
  export { default as PaymentMethods } from './organisms/PaymentMethods'
@@ -169,3 +176,9 @@ export type { PaymentMethodsProps } from './organisms/PaymentMethods'
169
176
 
170
177
  export { default as PriceRange } from './organisms/PriceRange'
171
178
  export type { PriceRangeProps } from './organisms/PriceRange'
179
+
180
+ export { default as SlideOver, SlideOverHeader } from './organisms/SlideOver'
181
+ export type {
182
+ SlideOverProps,
183
+ SlideOverHeaderProps,
184
+ } from './organisms/SlideOver'
@@ -77,11 +77,13 @@ const CartItem = forwardRef<HTMLDivElement, CartItemProps>(function CartItem(
77
77
  value={price?.listPrice ? price.listPrice : 0}
78
78
  formatter={price?.formatter}
79
79
  variant="listing"
80
+ SRText="Original price:"
80
81
  />
81
82
  <Price
82
83
  value={price?.value ? price.value : 0}
83
84
  formatter={price?.formatter}
84
85
  variant="spot"
86
+ SRText="Price:"
85
87
  />
86
88
  </span>
87
89
  </div>
@@ -1,16 +1,49 @@
1
1
  import type { HTMLAttributes } from 'react'
2
2
  import React, { forwardRef } from 'react'
3
3
 
4
+ import type { PriceFormatter } from '../../atoms/Price/Price'
5
+
6
+ import { Price, Badge } from '../../'
7
+
8
+ interface Price {
9
+ value: number
10
+ listPrice: number
11
+ formatter: PriceFormatter
12
+ }
13
+
4
14
  export interface GiftContentProps extends HTMLAttributes<HTMLElement> {
5
15
  /**
6
16
  * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
7
17
  */
8
18
  testId?: string
19
+ /**
20
+ * Specifies the product's name.
21
+ */
22
+ productName: string
23
+ /**
24
+ * Specifies product's prices.
25
+ */
26
+ price: Price
27
+ /**
28
+ * Badge's label
29
+ */
30
+ badgeLabel?: string
31
+ /**
32
+ * Additional message in the title
33
+ */
34
+ titleMessage?: string
9
35
  }
10
36
 
11
37
  const GiftContent = forwardRef<HTMLElement, GiftContentProps>(
12
38
  function GiftContent(
13
- { testId = 'fs-gift-content', children, ...otherProps },
39
+ {
40
+ price,
41
+ productName,
42
+ titleMessage = 'Get a',
43
+ badgeLabel = 'Free',
44
+ testId = 'fs-gift-content',
45
+ ...otherProps
46
+ },
14
47
  ref
15
48
  ) {
16
49
  return (
@@ -20,7 +53,20 @@ const GiftContent = forwardRef<HTMLElement, GiftContentProps>(
20
53
  data-testid={testId}
21
54
  {...otherProps}
22
55
  >
23
- {children}
56
+ <h3 data-fs-gift-product-title>
57
+ {titleMessage} {productName}
58
+ </h3>
59
+ <span data-fs-gift-product-summary>
60
+ <Price
61
+ value={price?.listPrice ? price.listPrice : 0}
62
+ formatter={price?.formatter}
63
+ testId="list-price"
64
+ data-value={price?.listPrice}
65
+ variant="listing"
66
+ SRText="Original price:"
67
+ />
68
+ <Badge>{badgeLabel}</Badge>
69
+ </span>
24
70
  </section>
25
71
  )
26
72
  }
@@ -16,7 +16,7 @@ export interface ModalHeaderProps extends HTMLAttributes<HTMLDivElement> {
16
16
  /**
17
17
  * Props for the Close Button component.
18
18
  */
19
- closeButtonProps?: Partial<Omit<IconButtonProps, 'onClick'>>
19
+ closeBtnProps?: Partial<Omit<IconButtonProps, 'onClick'>>
20
20
 
21
21
  onClose?: () => void
22
22
  }
@@ -24,7 +24,7 @@ export interface ModalHeaderProps extends HTMLAttributes<HTMLDivElement> {
24
24
  const ModalHeader = ({
25
25
  onClose,
26
26
  title,
27
- closeButtonProps = {},
27
+ closeBtnProps = {},
28
28
  description,
29
29
  }: ModalHeaderProps) => {
30
30
  return (
@@ -35,7 +35,7 @@ const ModalHeader = ({
35
35
  data-fs-modal-header-close-button
36
36
  icon={<X />}
37
37
  aria-label="Close modal"
38
- {...closeButtonProps}
38
+ {...closeBtnProps}
39
39
  />
40
40
  )}
41
41
  <p data-fs-modal-header-title>{title}</p>
@@ -0,0 +1,44 @@
1
+ import React, { HTMLAttributes } from 'react'
2
+ import { List, Button } from '../..'
3
+
4
+ export interface SearchHistoryProps 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
+ * Title attribute for the <section> tag rendered by this component.
11
+ */
12
+ title: string
13
+ /**
14
+ * Defines the text displayed in clear history button.
15
+ */
16
+ clearLabel?: string
17
+ /**
18
+ * Event handler for click on clear history button.
19
+ */
20
+ onClear?: () => void
21
+ }
22
+
23
+ const SearchHistory = ({
24
+ testId = 'fs-search-history',
25
+ title = 'History',
26
+ clearLabel = 'Clear History',
27
+ onClear,
28
+ children,
29
+ ...otherProps
30
+ }: SearchHistoryProps) => {
31
+ return (
32
+ <section data-testid={testId} data-fs-search-history {...otherProps}>
33
+ <header data-fs-search-history-header>
34
+ <p data-fs-search-history-title>{title}</p>
35
+ <Button variant="tertiary" onClick={onClear} size="small">
36
+ {clearLabel}
37
+ </Button>
38
+ </header>
39
+ <List as="ol">{children}</List>
40
+ </section>
41
+ )
42
+ }
43
+
44
+ export default SearchHistory
@@ -0,0 +1,44 @@
1
+ import type { ReactNode } from 'react'
2
+ import React, { HTMLAttributes } from 'react'
3
+ import { Icon, ClockClockwise, Link, LinkProps, LinkElementType } from '../..'
4
+
5
+ export interface SearchHistoryTermProps extends HTMLAttributes<HTMLDivElement> {
6
+ /**
7
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
8
+ */
9
+ testId?: string
10
+ /**
11
+ * Defines the text displayed in history term item.
12
+ */
13
+ value: string
14
+ /**
15
+ * Props for the link from term component.
16
+ */
17
+ linkProps?: Partial<LinkProps<LinkElementType>>
18
+ /**
19
+ * A React component that will be rendered as an icon.
20
+ */
21
+ icon?: ReactNode
22
+ }
23
+
24
+ const SearchHistoryTerm = ({
25
+ testId = 'fs-search-history-term',
26
+ value,
27
+ linkProps,
28
+ icon,
29
+ }: SearchHistoryTermProps) => {
30
+ const historyIcon = icon ? icon : <ClockClockwise />
31
+
32
+ return (
33
+ <li data-fs-search-history-item data-testid={testId}>
34
+ <Link {...linkProps} data-fs-search-history-item-link variant="display">
35
+ {historyIcon && (
36
+ <Icon component={historyIcon} data-fs-search-history-item-icon />
37
+ )}
38
+ <span>{value}</span>
39
+ </Link>
40
+ </li>
41
+ )
42
+ }
43
+
44
+ export default SearchHistoryTerm
@@ -0,0 +1,5 @@
1
+ export { default } from './SearchHistory'
2
+ export type { SearchHistoryProps } from './SearchHistory'
3
+
4
+ export { default as SearchHistoryTerm } from './SearchHistoryTerm'
5
+ export type { SearchHistoryTermProps } from './SearchHistoryTerm'
@@ -0,0 +1,53 @@
1
+ import React from 'react'
2
+ import { forwardRef } from 'react'
3
+ import type { HTMLAttributes } from 'react'
4
+
5
+ import { List } from '../../'
6
+
7
+ export interface SearchTopProps extends HTMLAttributes<HTMLDivElement> {
8
+ /**
9
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
10
+ */
11
+ testId?: string
12
+ /**
13
+ * Title attribute for the <section> tag rendered by this component.
14
+ */
15
+ title: string
16
+ /**
17
+ * Defines the the message displayed while loading.
18
+ */
19
+ loadingMessage?: string
20
+ /**
21
+ * Enables a loading state.
22
+ */
23
+ isLoading?: boolean
24
+ }
25
+
26
+ const SearchTop = forwardRef<HTMLDivElement, SearchTopProps>(function SearchTop(
27
+ {
28
+ testId = 'fs-top-search',
29
+ title = 'Top Search',
30
+ loadingMessage = 'Loading...',
31
+ isLoading,
32
+ children,
33
+ ...otherProps
34
+ },
35
+ ref
36
+ ) {
37
+ return (
38
+ <section ref={ref} data-testid={testId} data-fs-search-top {...otherProps}>
39
+ {isLoading ? (
40
+ <p data-fs-search-top-input-loading-text>{loadingMessage}</p>
41
+ ) : (
42
+ <>
43
+ <header data-fs-search-top-header>
44
+ <p data-fs-search-top-title>{title}</p>
45
+ </header>
46
+ <List as="ol">{children}</List>
47
+ </>
48
+ )}
49
+ </section>
50
+ )
51
+ })
52
+
53
+ export default SearchTop
@@ -0,0 +1,46 @@
1
+ import React from 'react'
2
+ import { forwardRef } from 'react'
3
+ import type { HTMLAttributes } from 'react'
4
+
5
+ import { Badge, Link, LinkProps, LinkElementType } from '../../'
6
+
7
+ export interface SearchTopTermProps extends HTMLAttributes<HTMLDivElement> {
8
+ /**
9
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
10
+ */
11
+ testId?: string
12
+ /**
13
+ * Search term to be shown.
14
+ */
15
+ value: string
16
+ /**
17
+ * Props for the `<Link>` rendered by this component.
18
+ */
19
+ linkProps?: Partial<LinkProps<LinkElementType>>
20
+ /**
21
+ * Current term's position in a list of search terms.
22
+ */
23
+ index: number
24
+ }
25
+
26
+ const SearchTopTerm = forwardRef<HTMLDivElement, SearchTopTermProps>(
27
+ function SearchTopTerm({
28
+ testId = 'fs-top-search-term',
29
+ value,
30
+ linkProps,
31
+ index,
32
+ }) {
33
+ return (
34
+ <li data-fs-search-top-item data-testid={testId}>
35
+ <Link {...linkProps} data-fs-search-top-item-link variant="display">
36
+ <Badge data-fs-search-top-item-badge variant="info">
37
+ {index + 1}
38
+ </Badge>
39
+ {value}
40
+ </Link>
41
+ </li>
42
+ )
43
+ }
44
+ )
45
+
46
+ export default SearchTopTerm
@@ -0,0 +1,5 @@
1
+ export { default } from './SearchTop'
2
+ export type { SearchTopProps } from './SearchTop'
3
+
4
+ export { default as SearchTopTerm } from './SearchTopTerm'
5
+ export type { SearchTopTermProps } from './SearchTopTerm'
@@ -5,7 +5,7 @@ import { ArrowRight } from '../../assets'
5
5
 
6
6
  import { useHero } from './Hero'
7
7
 
8
- export interface HeroHeadingProps extends HTMLAttributes<HTMLDivElement> {
8
+ export interface HeroHeaderProps extends HTMLAttributes<HTMLDivElement> {
9
9
  /**
10
10
  * Content for the h1 tag.
11
11
  */
@@ -32,8 +32,8 @@ export interface HeroHeadingProps extends HTMLAttributes<HTMLDivElement> {
32
32
  testId?: string
33
33
  }
34
34
 
35
- const HeroHeading = forwardRef<HTMLDivElement, HeroHeadingProps>(
36
- function HeroHeading(
35
+ const HeroHeader = forwardRef<HTMLDivElement, HeroHeaderProps>(
36
+ function HeroHeader(
37
37
  {
38
38
  icon,
39
39
  link,
@@ -79,4 +79,4 @@ const HeroHeading = forwardRef<HTMLDivElement, HeroHeadingProps>(
79
79
  }
80
80
  )
81
81
 
82
- export default HeroHeading
82
+ export default HeroHeader
@@ -4,5 +4,5 @@ export type { HeroProps } from './Hero'
4
4
  export { default as HeroImage } from './HeroImage'
5
5
  export type { HeroImageProps } from './HeroImage'
6
6
 
7
- export { default as HeroHeading } from './HeroHeading'
8
- export type { HeroHeadingProps } from './HeroHeading'
7
+ export { default as HeroHeader } from './HeroHeader'
8
+ export type { HeroHeaderProps } from './HeroHeader'
@@ -0,0 +1,65 @@
1
+ import React from 'react'
2
+ import type { ReactNode } from 'react'
3
+
4
+ import { Modal } from '../../'
5
+ import type { ModalProps } from '../../'
6
+
7
+ type Direction = 'leftSide' | 'rightSide'
8
+ type WidthSize = 'full' | 'partial'
9
+
10
+ export type SlideOverProps = Omit<ModalProps, 'title'> & {
11
+ /**
12
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
13
+ */
14
+ testId?: string
15
+ /**
16
+ * A boolean value that represents the state of the SlideOver
17
+ */
18
+ isOpen: boolean
19
+ /**
20
+ * Represents the side that the SlideOver comes from.
21
+ */
22
+ direction: Direction
23
+ /**
24
+ * Represents the size of the SlideOver.
25
+ */
26
+ size: WidthSize
27
+ /**
28
+ * Represents the fade effect of the SlideOver.
29
+ */
30
+ fade: 'in' | 'out'
31
+ /**
32
+ * This function is called whenever the user clicks outside.
33
+ * the modal content
34
+ */
35
+ onDismiss?: () => void
36
+ children: ReactNode
37
+ }
38
+
39
+ function SlideOver({
40
+ isOpen,
41
+ direction = 'leftSide',
42
+ size = 'full',
43
+ fade = 'out',
44
+ children,
45
+ onDismiss,
46
+ testId = 'fs-slide-over',
47
+ ...otherProps
48
+ }: SlideOverProps) {
49
+ return (
50
+ <Modal
51
+ data-fs-modal={null}
52
+ data-fs-slide-over
53
+ data-fs-slide-over-direction={direction}
54
+ data-fs-slide-over-size={size}
55
+ data-fs-slide-over-state={fade}
56
+ isOpen={isOpen}
57
+ onDismiss={onDismiss}
58
+ {...otherProps}
59
+ >
60
+ {children}
61
+ </Modal>
62
+ )
63
+ }
64
+
65
+ export default SlideOver
@@ -0,0 +1,40 @@
1
+ import React, { HTMLAttributes } from 'react'
2
+ import type { ReactNode } from 'react'
3
+ import { X } from '../../assets'
4
+ import { IconButton } from '../../'
5
+ import type { IconButtonProps } from '../../'
6
+
7
+ export interface SlideOverHeaderProps
8
+ extends Omit<HTMLAttributes<HTMLDivElement>, 'title'> {
9
+ /**
10
+ * A react component to be used as the title in the header.
11
+ */
12
+ children: ReactNode
13
+ /**
14
+ * Props for the Close Button component.
15
+ */
16
+ closeBtnProps?: Partial<Omit<IconButtonProps, 'onClick'>>
17
+
18
+ onClose: () => void
19
+ }
20
+
21
+ const SlideOverHeader = ({
22
+ onClose,
23
+ children,
24
+ closeBtnProps = {},
25
+ }: SlideOverHeaderProps) => {
26
+ return (
27
+ <header data-fs-slide-over-header>
28
+ {children}
29
+ <IconButton
30
+ data-fs-slide-over-header-icon
31
+ aria-label="Close"
32
+ icon={<X />}
33
+ onClick={onClose}
34
+ {...closeBtnProps}
35
+ />
36
+ </header>
37
+ )
38
+ }
39
+
40
+ export default SlideOverHeader
@@ -0,0 +1,5 @@
1
+ export { default } from './SlideOver'
2
+ export type { SlideOverProps } from './SlideOver'
3
+
4
+ export { default as SlideOverHeader } from './SlideOverHeader'
5
+ export type { SlideOverHeaderProps } from './SlideOverHeader'
@@ -1 +0,0 @@
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"}