@faststore/core 0.3.15 → 0.3.17

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 (57) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/cypress/integration/analytics.test.js +3 -3
  3. package/cypress/integration/plp.test.js +1 -1
  4. package/package.json +4 -4
  5. package/src/Layout.tsx +6 -1
  6. package/src/components/cart/CartItem/CartItem.tsx +2 -2
  7. package/src/components/cart/CartSidebar/CartSidebar.tsx +5 -6
  8. package/src/components/cart/CartSidebar/cart-sidebar.module.scss +2 -0
  9. package/src/components/common/Alert/Alert.tsx +6 -22
  10. package/src/components/common/Footer/Footer.stories.mdx +1 -1
  11. package/src/components/common/Footer/FooterLinks.tsx +16 -12
  12. package/src/components/search/Filter/Facets.stories.mdx +9 -9
  13. package/src/components/search/Filter/Facets.tsx +69 -61
  14. package/src/components/search/Filter/facets.module.scss +16 -16
  15. package/src/components/search/Search.stories.mdx +28 -24
  16. package/src/components/search/SearchDropdown/SearchDropdown.stories.mdx +0 -1
  17. package/src/components/search/SearchInput/SearchInput.stories.mdx +0 -1
  18. package/src/components/search/SearchTop/SearchTop.stories.mdx +0 -1
  19. package/src/components/sections/ProducDetailsContent/ProductDetailsContent.tsx +147 -149
  20. package/src/components/sections/ProductDetails/ProductDetails.tsx +2 -2
  21. package/src/components/ui/Breadcrumb/Breadcrumb.tsx +17 -16
  22. package/src/components/ui/Gift/Gift.tsx +7 -13
  23. package/src/components/ui/ShippingSimulation/ShippingSimulation.stories.mdx +0 -27
  24. package/src/components/ui/ShippingSimulation/ShippingSimulation.tsx +6 -13
  25. package/src/components/ui/ShippingSimulation/shipping-simulation.module.scss +0 -39
  26. package/src/components/ui/SkuSelector/sku-selector.module.scss +1 -1
  27. package/tsconfig.json +1 -1
  28. package/src/components/sections/ProducDetailsContent/product-details-content.module.scss +0 -41
  29. package/src/components/ui/Accordion/Accordion.stories.mdx +0 -222
  30. package/src/components/ui/Accordion/Accordion.tsx +0 -39
  31. package/src/components/ui/Accordion/AccordionItem.stories.mdx +0 -116
  32. package/src/components/ui/Accordion/AccordionItem.tsx +0 -82
  33. package/src/components/ui/Accordion/accordion.module.scss +0 -65
  34. package/src/components/ui/Accordion/index.ts +0 -2
  35. package/src/components/ui/Alert/Alert.stories.mdx +0 -164
  36. package/src/components/ui/Alert/Alert.tsx +0 -81
  37. package/src/components/ui/Alert/alert.module.scss +0 -93
  38. package/src/components/ui/Alert/index.ts +0 -1
  39. package/src/components/ui/Dropdown/Dropdown.stories.mdx +0 -232
  40. package/src/components/ui/Dropdown/Dropdown.tsx +0 -12
  41. package/src/components/ui/Dropdown/DropdownButton.tsx +0 -20
  42. package/src/components/ui/Dropdown/DropdownItem.stories.mdx +0 -139
  43. package/src/components/ui/Dropdown/DropdownItem.tsx +0 -26
  44. package/src/components/ui/Dropdown/DropdownMenu.stories.mdx +0 -115
  45. package/src/components/ui/Dropdown/DropdownMenu.tsx +0 -34
  46. package/src/components/ui/Dropdown/dropdown.module.scss +0 -101
  47. package/src/components/ui/Dropdown/index.ts +0 -4
  48. package/src/components/ui/Gift/Gift.stories.mdx +0 -99
  49. package/src/components/ui/Gift/gift.module.scss +0 -94
  50. package/src/components/ui/PriceRange/PriceRange.stories.mdx +0 -192
  51. package/src/components/ui/PriceRange/PriceRange.tsx +0 -140
  52. package/src/components/ui/PriceRange/index.ts +0 -1
  53. package/src/components/ui/PriceRange/price-range.module.scss +0 -176
  54. package/src/components/ui/QuantitySelector/QuantitySelector.stories.mdx +0 -246
  55. package/src/components/ui/QuantitySelector/QuantitySelector.tsx +0 -103
  56. package/src/components/ui/QuantitySelector/index.ts +0 -1
  57. package/src/components/ui/QuantitySelector/quantity-selector.module.scss +0 -155
package/CHANGELOG.md CHANGED
@@ -5,6 +5,35 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Conventional Changelog](https://github.com/conventional-changelog/conventional-changelog),
6
6
  and this project adheres to [Calendar Versioning](https://calver.org/).
7
7
 
8
+ ### [0.3.17](https://github.com/vtex-sites/nextjs.store/compare/0.3.16...0.3.17) (2023-01-23)
9
+
10
+
11
+ ### Features
12
+
13
+ * Replace `Accordion` FSUI ([#336](https://github.com/vtex-sites/nextjs.store/issues/336)) ([1ebe103](https://github.com/vtex-sites/nextjs.store/commit/1ebe1039a92ab977ba5de1b91f112342973706eb))
14
+ * Replace `Dropdown` FSUI ([#339](https://github.com/vtex-sites/nextjs.store/issues/339)) ([3a541a4](https://github.com/vtex-sites/nextjs.store/commit/3a541a4aab72a1e289a6716ba9c742771905fa7a))
15
+ * Replace `RadioGroup` FSUI ([#345](https://github.com/vtex-sites/nextjs.store/issues/345)) ([2af5559](https://github.com/vtex-sites/nextjs.store/commit/2af5559a8e4b005b78075edecf9c40da1e7e1a2b))
16
+ * Replaces `PriceRange` FSUI ([#348](https://github.com/vtex-sites/nextjs.store/issues/348)) ([546ee17](https://github.com/vtex-sites/nextjs.store/commit/546ee17c0a00e3094f82d8e05c3e38b84114488f))
17
+ * Replaces `QuantitySelector` FSUI ([#344](https://github.com/vtex-sites/nextjs.store/issues/344)) ([6b896fc](https://github.com/vtex-sites/nextjs.store/commit/6b896fcff3e5fdb4841194b05b2a310518eb3857))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * Evergreen `starter.store` build errors. ([#349](https://github.com/vtex-sites/nextjs.store/issues/349)) ([0eedd76](https://github.com/vtex-sites/nextjs.store/commit/0eedd76c65edae710971e3a985065dc30f4de19d))
23
+
24
+
25
+ ### Chores
26
+
27
+ * Replaces `Alert` FSUI ([#343](https://github.com/vtex-sites/nextjs.store/issues/343)) ([8b3d6b2](https://github.com/vtex-sites/nextjs.store/commit/8b3d6b268da572614334554400ea03129445f787))
28
+ * Replaces `Gift` FSUI ([#347](https://github.com/vtex-sites/nextjs.store/issues/347)) ([7fa049e](https://github.com/vtex-sites/nextjs.store/commit/7fa049e890b0bc6c9e4c3a4911c376014b239321))
29
+
30
+ ### [0.3.16](https://github.com/vtex-sites/nextjs.store/compare/0.3.15...0.3.16) (2023-01-09)
31
+
32
+
33
+ ### Chores
34
+
35
+ * Replace `Table` using FSUI ([#341](https://github.com/vtex-sites/nextjs.store/issues/341)) ([cccf3d5](https://github.com/vtex-sites/nextjs.store/commit/cccf3d5cb1fccc1440b2b019ebc06ddc474fb25f))
36
+
8
37
  ### 0.3.15 (2023-01-03)
9
38
 
10
39
 
@@ -104,7 +104,7 @@ describe('add_to_cart event', () => {
104
104
  testAddToCartEvent({ skuId, numberOfEvents: 1 })
105
105
 
106
106
  cy.get(
107
- '[data-testid=cart-item] [data-testid=store-quantity-selector-right]'
107
+ '[data-testid=cart-item] [data-testid=fs-quantity-selector-right-button]'
108
108
  )
109
109
  .click()
110
110
  .then(() => {
@@ -193,7 +193,7 @@ describe('remove_from_cart event', () => {
193
193
  cy.itemsInCart(0)
194
194
 
195
195
  // Add item to cart
196
- cy.get('[data-testid=store-quantity-selector-right]')
196
+ cy.get('[data-testid=fs-quantity-selector-right-button]')
197
197
  .click()
198
198
  .then(() => {
199
199
  cy.getById('buy-button')
@@ -209,7 +209,7 @@ describe('remove_from_cart event', () => {
209
209
 
210
210
  // Remove the added item
211
211
  cy.get(
212
- '[data-testid=cart-item] [data-testid=store-quantity-selector-left]'
212
+ '[data-testid=cart-item] [data-testid=fs-quantity-selector-left-button]'
213
213
  )
214
214
  .click()
215
215
  .then(() => {
@@ -23,7 +23,7 @@ describe('Search page Filters and Sorting options', () => {
23
23
  cy.getById('open-filter-button')
24
24
  .click()
25
25
  .get(
26
- `[data-testid=mobile-store-filter-accordion-item][data-type=StoreFacetBoolean]>[data-testid=mobile-store-filter-accordion-button]`
26
+ `[data-testid=mobile-store-filter-accordion][data-type=StoreFacetBoolean]>[data-testid=mobile-store-filter-accordion-button]`
27
27
  )
28
28
  .first()
29
29
  .click()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/core",
3
- "version": "0.3.15",
3
+ "version": "0.3.17",
4
4
  "license": "MIT",
5
5
  "browserslist": "supports es6-module and not dead",
6
6
  "scripts": {
@@ -31,10 +31,10 @@
31
31
  "@envelop/parser-cache": "^2.2.0",
32
32
  "@envelop/validation-cache": "^2.2.0",
33
33
  "@faststore/api": "^2.0.3-alpha.0",
34
- "@faststore/components": "2.0.30-alpha.0",
34
+ "@faststore/components": "^2.0.54-alpha.0",
35
35
  "@faststore/graphql-utils": "^2.0.3-alpha.0",
36
36
  "@faststore/sdk": "^2.0.3-alpha.0",
37
- "@faststore/ui": "2.0.30-alpha.0",
37
+ "@faststore/ui": "^2.0.54-alpha.0",
38
38
  "@types/react": "^18.0.14",
39
39
  "@vtex/client-cms": "^0.2.12",
40
40
  "autoprefixer": "^10.4.0",
@@ -80,7 +80,7 @@
80
80
  "cypress-axe": "^0.13.0",
81
81
  "cypress-wait-until": "^1.7.2",
82
82
  "dotenv": "^8.2.0",
83
- "eslint": "^8.30.0",
83
+ "eslint": "^7.32.0",
84
84
  "eslint-config-next": "^13.0.7",
85
85
  "husky": "^5.2.0",
86
86
  "is-ci": "^3.0.0",
package/src/Layout.tsx CHANGED
@@ -7,6 +7,7 @@ import Navbar from 'src/components/common/Navbar'
7
7
  import Toast from 'src/components/common/Toast'
8
8
  import RegionalizationBar from 'src/components/regionalization/RegionalizationBar'
9
9
  import { useUI } from 'src/sdk/ui/Provider'
10
+ import Icon from 'src/components/ui/Icon'
10
11
 
11
12
  const CartSidebar = lazy(() => import('src/components/cart/CartSidebar'))
12
13
  const RegionModal = lazy(
@@ -18,7 +19,11 @@ function Layout({ children }: PropsWithChildren) {
18
19
 
19
20
  return (
20
21
  <>
21
- <Alert icon="Bell" link={{ text: 'Buy now', to: '/office' }} dismissible>
22
+ <Alert
23
+ icon={<Icon name="Bell" />}
24
+ link={{ children: 'Buy now', href: '/office', target: '_self' }}
25
+ dismissible
26
+ >
22
27
  Get 10% off today:&nbsp;<span>NEW10</span>
23
28
  </Alert>
24
29
 
@@ -8,6 +8,7 @@ import {
8
8
  CartItemContent as UICartItemContent,
9
9
  CartItemImage as UICartItemImage,
10
10
  Button as UIButton,
11
+ QuantitySelector as UIQuantitySelector,
11
12
  } from '@faststore/ui'
12
13
  import { useCallback, useMemo } from 'react'
13
14
  import type {
@@ -19,7 +20,6 @@ import type {
19
20
  import Icon from 'src/components/ui/Icon'
20
21
  import { Image } from 'src/components/ui/Image'
21
22
  import Price from 'src/components/ui/Price'
22
- import QuantitySelector from 'src/components/ui/QuantitySelector'
23
23
  import { cartStore } from 'src/sdk/cart'
24
24
  import { useRemoveButton } from 'src/sdk/cart/useRemoveButton'
25
25
  import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
@@ -144,7 +144,7 @@ function CartItem({ item, gift = false }: Props) {
144
144
  >
145
145
  Remove
146
146
  </UIButton>
147
- <QuantitySelector
147
+ <UIQuantitySelector
148
148
  min={1}
149
149
  initial={item.quantity}
150
150
  onChange={onQuantityChange}
@@ -4,11 +4,12 @@ import {
4
4
  IconButton as UIIconButton,
5
5
  Button as UIButton,
6
6
  Badge as UIBadge,
7
+ Alert as UIAlert,
7
8
  } from '@faststore/ui'
9
+
8
10
  import { useEffect } from 'react'
9
11
  import type { ViewCartEvent, CurrencyCode } from '@faststore/sdk'
10
12
 
11
- import Alert from 'src/components/ui/Alert'
12
13
  import Icon from 'src/components/ui/Icon'
13
14
  import SlideOver from 'src/components/ui/SlideOver'
14
15
  import { useCart } from 'src/sdk/cart'
@@ -81,9 +82,9 @@ function CartSidebar() {
81
82
  onClick={fadeOut}
82
83
  />
83
84
  </header>
84
- <Alert icon={<Icon name="Truck" width={24} height={24} />}>
85
+ <UIAlert icon={<Icon name="Truck" />}>
85
86
  Free shipping starts at $300
86
- </Alert>
87
+ </UIAlert>
87
88
 
88
89
  {isEmpty ? (
89
90
  <EmptyCart onDismiss={fadeOut} />
@@ -99,9 +100,7 @@ function CartSidebar() {
99
100
 
100
101
  {gifts.length > 0 && (
101
102
  <>
102
- <Alert icon={<Icon name="Gift" width={24} height={24} />}>
103
- Gifts
104
- </Alert>
103
+ <UIAlert icon={<Icon name="Gift" />}>Gifts</UIAlert>
105
104
  <UIList data-fs-cart-sidebar-list>
106
105
  {gifts.map((item) => (
107
106
  <li key={item.id}>
@@ -28,6 +28,8 @@
28
28
  overflow: auto;
29
29
  background-color: var(--fs-cart-sidebar-bkg-color);
30
30
 
31
+ > * { flex-shrink: 0; }
32
+
31
33
  [data-fs-cart-sidebar-header] {
32
34
  display: flex;
33
35
  align-items: center;
@@ -1,30 +1,17 @@
1
1
  import { useCallback, useState } from 'react'
2
2
  import type { ReactNode, PropsWithChildren } from 'react'
3
3
 
4
- import UIAlert from 'src/components/ui/Alert'
4
+ import { Alert as UIAlert, AlertProps } from '@faststore/ui'
5
5
  import { mark } from 'src/sdk/tests/mark'
6
- import Icon from 'src/components/ui/Icon'
7
6
 
8
- interface Props {
9
- icon: string
7
+ interface Props extends AlertProps {
10
8
  /**
11
9
  * For CMS integration purposes, should be used to pass content through it
12
10
  * instead pass through children
13
11
  */
14
12
  content?: ReactNode
15
- link?: {
16
- to: string
17
- text: string
18
- }
19
- dismissible: boolean
20
13
  }
21
- function Alert({
22
- icon,
23
- content,
24
- link,
25
- dismissible = false,
26
- children,
27
- }: PropsWithChildren<Props>) {
14
+ function Alert(args: PropsWithChildren<Props>) {
28
15
  const [displayAlert, setDisplayAlert] = useState(true)
29
16
 
30
17
  const onAlertClose = useCallback(
@@ -36,13 +23,10 @@ function Alert({
36
23
  return null
37
24
  }
38
25
 
26
+ const { content, children, ...otherProps } = args
27
+
39
28
  return (
40
- <UIAlert
41
- icon={<Icon name={icon} width={24} height={24} />}
42
- dismissible={dismissible}
43
- onClose={onAlertClose}
44
- link={link}
45
- >
29
+ <UIAlert onClose={onAlertClose} {...otherProps}>
46
30
  {content ?? children}
47
31
  </UIAlert>
48
32
  )
@@ -35,7 +35,7 @@ The `Footer` is the final section of every page and has all the meaningful links
35
35
 
36
36
  ## Overview
37
37
 
38
- Footer section is made with `FooterLinks`, [Incentives](?path=/docs/organisms-incentives--incentives), [Links](?path=/docs/atoms-link--default), [Accordion](?path=/docs/molecules-accordion-overview--default-story), and [PaymentMethods](https://www.faststore.dev/reference/ui/molecules/PaymentMethods) (from FastStore UI).
38
+ Footer section is made with `FooterLinks`, [Incentives](?path=/docs/organisms-incentives--incentives), [Links](?path=/docs/atoms-link--default), Accordion, and [PaymentMethods](https://www.faststore.dev/reference/ui/molecules/PaymentMethods) (from FastStore UI).
39
39
 
40
40
  ---
41
41
 
@@ -1,8 +1,13 @@
1
1
  import { useState } from 'react'
2
- import { List as UIList } from '@faststore/ui'
2
+ import {
3
+ List as UIList,
4
+ Accordion as UIAccordion,
5
+ AccordionItem as UIAccordionItem,
6
+ AccordionButton as UIAccordionButton,
7
+ AccordionPanel as UIAccordionPanel,
8
+ } from '@faststore/ui'
3
9
 
4
10
  import Link from 'src/components/ui/Link'
5
- import Accordion, { AccordionItem } from 'src/components/ui/Accordion'
6
11
 
7
12
  import styles from './footer.module.scss'
8
13
 
@@ -125,17 +130,16 @@ function FooterLinks() {
125
130
  return (
126
131
  <section className={styles.fsFooter} data-fs-footer-links>
127
132
  <div className="display-mobile">
128
- <Accordion expandedIndices={indicesExpanded} onChange={onChange}>
129
- {links.map((section, index) => (
130
- <AccordionItem
131
- key={section.title}
132
- isExpanded={indicesExpanded.has(index)}
133
- buttonLabel={section.title}
134
- >
135
- <LinksList items={section.items} />
136
- </AccordionItem>
133
+ <UIAccordion indices={indicesExpanded} onChange={onChange}>
134
+ {links.map((section) => (
135
+ <UIAccordionItem key={section.title}>
136
+ <UIAccordionButton>{section.title}</UIAccordionButton>
137
+ <UIAccordionPanel>
138
+ <LinksList items={section.items} />
139
+ </UIAccordionPanel>
140
+ </UIAccordionItem>
137
141
  ))}
138
- </Accordion>
142
+ </UIAccordion>
139
143
  </div>
140
144
 
141
145
  <div className="hidden-mobile">
@@ -134,7 +134,7 @@ Facets represent the <code>Filter</code> details and allow users to refine their
134
134
 
135
135
  ## Overview
136
136
 
137
- The `Facets` component uses the [Accordion](?path=/docs/molecules-accordion-overview--default-story), [Checkbox](?path=/docs/atoms-checkbox--overview-default), [PriceRange](?path=/docs/molecules-pricerange--overview-default), and [Badge](?path=/docs/molecules-badge--default) components.
137
+ The `Facets` component uses the Accordion, [Checkbox](?path=/docs/atoms-checkbox--overview-default), PriceRange, and [Badge](?path=/docs/molecules-badge--default) components.
138
138
 
139
139
  ---
140
140
 
@@ -194,30 +194,30 @@ The `Facets` component uses the [Accordion](?path=/docs/molecules-accordion-over
194
194
 
195
195
  <TokenTable>
196
196
  <TokenRow
197
- token="--fs-facets-accordion-item-button-text-size"
197
+ token="--fs-facets-accordion-button-text-size"
198
198
  value="var(--fs-text-size-lead)"
199
199
  />
200
200
  <TokenRow
201
- token="--fs-facets-accordion-item-button-text-weight"
201
+ token="--fs-facets-accordion-button-text-weight"
202
202
  value="var(--fs-text-weight-regular)"
203
203
  />
204
- <TokenRow token="--fs-facets-accordion-item-button-line-height" value="1.5" />
204
+ <TokenRow token="--fs-facets-accordion-button-line-height" value="1.5" />
205
205
  <TokenDivider />
206
206
  <TokenRow
207
- token="--fs-facets-accordion-item-button-text-weight-notebook"
207
+ token="--fs-facets-accordion-button-text-weight-notebook"
208
208
  value="var(--fs-text-size-2)"
209
209
  />
210
210
  <TokenRow
211
- token="--fs-facets-accordion-item-button-line-height-notebook"
211
+ token="--fs-facets-accordion-button-line-height-notebook"
212
212
  value="1.25"
213
213
  />
214
214
  <TokenRow
215
- token="--fs-facets-accordion-item-button-padding-right-notebook"
215
+ token="--fs-facets-accordion-button-padding-right-notebook"
216
216
  value="var(--fs-spacing-4)"
217
217
  />
218
218
  <TokenRow
219
- token="--fs-facets-accordion-item-button-padding-left-notebook"
220
- value="var(--fs-facets-accordion-item-button-padding-right-notebook)"
219
+ token="--fs-facets-accordion-button-padding-left-notebook"
220
+ value="var(--fs-facets-accordion-button-padding-right-notebook)"
221
221
  />
222
222
  </TokenTable>
223
223
 
@@ -3,14 +3,19 @@ import {
3
3
  Label as UILabel,
4
4
  List as UIList,
5
5
  Badge as UIBadge,
6
+ Accordion as UIAccordion,
7
+ AccordionItem as UIAccordionItem,
8
+ AccordionButton as UIAccordionButton,
9
+ AccordionPanel as UIAccordionPanel,
10
+ PriceRange as UIPriceRange,
6
11
  } from '@faststore/ui'
7
12
 
13
+ import { useFormattedPrice } from 'src/sdk/product/useFormattedPrice'
14
+
8
15
  import type {
9
16
  Filter_FacetsFragment,
10
17
  IStoreSelectedFacet,
11
18
  } from '@generated/graphql'
12
- import Accordion, { AccordionItem } from 'src/components/ui/Accordion'
13
- import PriceRange from 'src/components/ui/PriceRange'
14
19
 
15
20
  import styles from './facets.module.scss'
16
21
 
@@ -58,80 +63,83 @@ function Facets({
58
63
  <h2 className="text__title-mini-alt" data-fs-facets-title>
59
64
  Filters
60
65
  </h2>
61
- <Accordion
62
- expandedIndices={indicesExpanded}
66
+ <UIAccordion
67
+ indices={indicesExpanded}
63
68
  onChange={onAccordionChange}
64
69
  data-fs-facets-accordion
65
70
  >
66
71
  {facets.map((facet, index) => {
67
72
  const isExpanded = indicesExpanded.has(index)
68
73
  const { __typename: type, label } = facet
69
-
70
74
  return (
71
- <AccordionItem
75
+ <UIAccordionItem
72
76
  key={`${label}-${index}`}
73
77
  prefixId={testId}
74
78
  testId={`${testId}-accordion`}
75
- isExpanded={isExpanded}
76
- buttonLabel={label}
77
79
  data-type={type}
78
80
  data-fs-facets-accordion-item
79
81
  >
80
- {type === 'StoreFacetBoolean' && isExpanded && (
81
- <UIList data-fs-facets-list>
82
- {facet.values.map((item) => {
83
- const id = `${testId}-${facet.label}-${item.label}`
84
-
85
- return (
86
- <li key={id} data-fs-facets-list-item>
87
- <UICheckbox
88
- id={id}
89
- checked={item.selected}
90
- onChange={() =>
91
- onFacetChange(
92
- { key: facet.key, value: item.value },
93
- 'BOOLEAN'
94
- )
95
- }
96
- data-fs-facets-list-item-checkbox
97
- data-testid={`${testId}-accordion-panel-checkbox`}
98
- data-value={item.value}
99
- data-quantity={item.quantity}
100
- />
101
- <UILabel
102
- htmlFor={id}
103
- className="text__title-mini-alt"
104
- data-fs-facets-list-item-label
105
- >
106
- {item.label}{' '}
107
- <UIBadge data-fs-facets-list-item-badge>
108
- {item.quantity}
109
- </UIBadge>
110
- </UILabel>
111
- </li>
112
- )
113
- })}
114
- </UIList>
115
- )}
116
- {type === 'StoreFacetRange' && isExpanded && (
117
- <PriceRange
118
- min={facet.min}
119
- max={facet.max}
120
- onEnd={(v) =>
121
- onFacetChange(
122
- {
123
- key: facet.key,
124
- value: formatRange(v.min, v.max),
125
- },
126
- 'RANGE'
127
- )
128
- }
129
- />
130
- )}
131
- </AccordionItem>
82
+ <UIAccordionButton testId={`${testId}-accordion-button`}>
83
+ {label}
84
+ </UIAccordionButton>
85
+ <UIAccordionPanel>
86
+ {type === 'StoreFacetBoolean' && isExpanded && (
87
+ <UIList data-fs-facets-list>
88
+ {facet.values.map((item) => {
89
+ const id = `${testId}-${facet.label}-${item.label}`
90
+ return (
91
+ <li key={id} data-fs-facets-list-item>
92
+ <UICheckbox
93
+ id={id}
94
+ checked={item.selected}
95
+ onChange={() =>
96
+ onFacetChange(
97
+ { key: facet.key, value: item.value },
98
+ 'BOOLEAN'
99
+ )
100
+ }
101
+ data-fs-facets-list-item-checkbox
102
+ data-testid={`${testId}-accordion-panel-checkbox`}
103
+ data-value={item.value}
104
+ data-quantity={item.quantity}
105
+ />
106
+ <UILabel
107
+ htmlFor={id}
108
+ className="text__title-mini-alt"
109
+ data-fs-facets-list-item-label
110
+ >
111
+ {item.label}{' '}
112
+ <UIBadge data-fs-facets-list-item-badge>
113
+ {item.quantity}
114
+ </UIBadge>
115
+ </UILabel>
116
+ </li>
117
+ )
118
+ })}
119
+ </UIList>
120
+ )}
121
+ {type === 'StoreFacetRange' && isExpanded && (
122
+ <UIPriceRange
123
+ min={facet.min}
124
+ max={facet.max}
125
+ formatter={useFormattedPrice}
126
+ step={1}
127
+ onEnd={(v) =>
128
+ onFacetChange(
129
+ {
130
+ key: facet.key,
131
+ value: formatRange(v.min, v.max),
132
+ },
133
+ 'RANGE'
134
+ )
135
+ }
136
+ />
137
+ )}
138
+ </UIAccordionPanel>
139
+ </UIAccordionItem>
132
140
  )
133
141
  })}
134
- </Accordion>
142
+ </UIAccordion>
135
143
  </div>
136
144
  )
137
145
  }
@@ -15,14 +15,14 @@
15
15
  --fs-facets-accordion-border-radius-notebook : var(--fs-border-radius);
16
16
 
17
17
  // Accordion Item Button
18
- --fs-facets-accordion-item-button-text-size : var(--fs-text-size-lead);
19
- --fs-facets-accordion-item-button-text-weight : var(--fs-text-weight-regular);
20
- --fs-facets-accordion-item-button-line-height : 1.5;
21
- --fs-facets-accordion-item-button-padding-right-notebook : var(--fs-spacing-4);
22
- --fs-facets-accordion-item-button-padding-left-notebook : var(--fs-facets-accordion-item-button-padding-right-notebook);
18
+ --fs-facets-accordion-button-text-size : var(--fs-text-size-lead);
19
+ --fs-facets-accordion-button-text-weight : var(--fs-text-weight-regular);
20
+ --fs-facets-accordion-button-line-height : 1.5;
21
+ --fs-facets-accordion-button-padding-right-notebook : var(--fs-spacing-4);
22
+ --fs-facets-accordion-button-padding-left-notebook : var(--fs-facets-accordion-button-padding-right-notebook);
23
23
 
24
- --fs-facets-accordion-item-button-text-weight-notebook : var(--fs-text-size-2);
25
- --fs-facets-accordion-item-button-line-height-notebook : 1.25;
24
+ --fs-facets-accordion-button-text-weight-notebook : var(--fs-text-size-2);
25
+ --fs-facets-accordion-button-line-height-notebook : 1.25;
26
26
 
27
27
  // Accordion Item Panel
28
28
  --fs-facets-accordion-item-panel-padding-right-notebook : var(--fs-spacing-4);
@@ -64,20 +64,20 @@
64
64
  }
65
65
 
66
66
  [data-fs-facets-accordion-item] {
67
- [data-fs-accordion-item-button] {
68
- font-size: var(--fs-facets-accordion-item-button-text-size);
69
- font-weight: var(--fs-facets-accordion-item-button-text-weight);
70
- line-height: var(--fs-facets-accordion-item-button-line-height);
67
+ [data-fs-accordion-button] {
68
+ font-size: var(--fs-facets-accordion-button-text-size);
69
+ font-weight: var(--fs-facets-accordion-button-text-weight);
70
+ line-height: var(--fs-facets-accordion-button-line-height);
71
71
 
72
72
  @include media(">=notebook") {
73
- padding-right: var(--fs-facets-accordion-item-button-padding-right-notebook);
74
- padding-left: var(--fs-facets-accordion-item-button-padding-left-notebook);
75
- font-size: var(--fs-facets-accordion-item-button-text-weight-notebook);
76
- line-height: var(--fs-facets-accordion-item-button-line-height-notebook);
73
+ padding-right: var(--fs-facets-accordion-button-padding-right-notebook);
74
+ padding-left: var(--fs-facets-accordion-button-padding-left-notebook);
75
+ font-size: var(--fs-facets-accordion-button-text-weight-notebook);
76
+ line-height: var(--fs-facets-accordion-button-line-height-notebook);
77
77
  }
78
78
  }
79
79
 
80
- [data-fs-accordion-item-panel] {
80
+ [data-fs-accordion-panel] {
81
81
  @include media(">=notebook") {
82
82
  padding-right: var(--fs-facets-accordion-item-panel-padding-right-notebook);
83
83
  padding-left: var(--fs-facets-accordion-item-panel-padding-left-notebook);