{HeadingChild}
@@ -353,34 +404,52 @@ const PricingOptionsFeatureList = forwardRef
))
+ React.useEffect(() => {
+ if (!runOnce.current) {
+ if (typeof expanded === 'boolean') {
+ return setIsAccordionOpen(expanded)
+ } else if (typeof expanded === 'object') {
+ const {narrow, regular, wide} = expanded
+ if (isRegular) return setIsAccordionOpen(regular)
+ if (isWide) return setIsAccordionOpen(wide)
+ return setIsAccordionOpen(narrow)
+ }
+ runOnce.current = true
+ }
+ }, [expanded, isRegular, isWide])
+
+ React.useEffect(() => {
+ if (isAccordionOpen && !runOnce.current) {
+ updateFeatureListExpanded(true)
+ runOnce.current = true
+ }
+ }, [isAccordionOpen, updateFeatureListExpanded])
+
return (
- {!isLarge ? (
-
-
-
- What's included
-
-
- {FeatureListItems}
-
-
- ) : (
- <>
-
- What's included:
-
+
{
+ updateFeatureListExpanded(newState)
+ }}
+ >
+
+
+ What's included
+
+
{FeatureListItems}
- >
- )}
+
+
)
},
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts
index 09cec7573..4933ff4ad 100644
--- a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts
+++ b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts
@@ -88,6 +88,36 @@ test.describe('Visual Comparison: PricingOptions', () => {
expect(await page.screenshot()).toMatchSnapshot()
})
+ test('PricingOptions / Collapsed Features', async ({page}) => {
+ await page.goto(
+ 'http://localhost:6006/iframe.html?args=&id=components-pricingoptions-features--collapsed-features&viewMode=story',
+ )
+
+ await page.waitForTimeout(500)
+ expect(await page.screenshot()).toMatchSnapshot()
+ })
+
+ test('PricingOptions / Collapsed Features No Dividers', async ({page}) => {
+ await page.goto(
+ 'http://localhost:6006/iframe.html?args=&id=components-pricingoptions-features--collapsed-features-no-dividers&viewMode=story',
+ )
+
+ await page.waitForTimeout(500)
+ expect(await page.screenshot()).toMatchSnapshot()
+ })
+
+ // eslint-disable-next-line i18n-text/no-en
+ test.describe('Mobile viewport test for Expanded Narrow', () => {
+ test.use({viewport: {width: 360, height: 800}})
+ test('PricingOptions / Expanded Narrow', async ({page}) => {
+ await page.goto(
+ 'http://localhost:6006/iframe.html?args=&id=components-pricingoptions-features--expanded-narrow&viewMode=story',
+ )
+
+ await page.waitForTimeout(500)
+ expect(await page.screenshot()).toMatchSnapshot()
+ })
+ })
test('PricingOptions / Default', async ({page}) => {
await page.goto('http://localhost:6006/iframe.html?args=&id=components-pricingoptions--default&viewMode=story')
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-Mobile-viewp-6e07a-anded-Narrow-PricingOptions-Expanded-Narrow-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-Mobile-viewp-6e07a-anded-Narrow-PricingOptions-Expanded-Narrow-1-linux.png
new file mode 100644
index 000000000..92a155ee5
Binary files /dev/null and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-Mobile-viewp-6e07a-anded-Narrow-PricingOptions-Expanded-Narrow-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Cards-Variant-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Cards-Variant-1-linux.png
index 7ce9ec5b7..8597c980b 100644
Binary files a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Cards-Variant-1-linux.png and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Cards-Variant-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Collapsed-Features-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Collapsed-Features-1-linux.png
new file mode 100644
index 000000000..d5370872c
Binary files /dev/null and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Collapsed-Features-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Collapsed-Features-No-Dividers-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Collapsed-Features-No-Dividers-1-linux.png
new file mode 100644
index 000000000..3f9c7ac8f
Binary files /dev/null and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Collapsed-Features-No-Dividers-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Default-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Default-1-linux.png
index 9f3baa711..736c0629d 100644
Binary files a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Default-1-linux.png and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Default-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Default-Variant-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Default-Variant-1-linux.png
index e36577cc0..bacc0d4cc 100644
Binary files a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Default-Variant-1-linux.png and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Default-Variant-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Leading-Component-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Leading-Component-1-linux.png
index 86b066e76..90c363d8f 100644
Binary files a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Leading-Component-1-linux.png and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Leading-Component-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Three-Options-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Three-Options-1-linux.png
index e36577cc0..bacc0d4cc 100644
Binary files a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Three-Options-1-linux.png and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Three-Options-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Two-Options-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Two-Options-1-linux.png
index 024283fa4..07d7c57d5 100644
Binary files a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Two-Options-1-linux.png and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Two-Options-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-With-Feature-Sets-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-With-Feature-Sets-1-linux.png
index baafb0708..f48f3d252 100644
Binary files a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-With-Feature-Sets-1-linux.png and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-With-Feature-Sets-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-With-Included-And-Excluded-Features-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-With-Included-And-Excluded-Features-1-linux.png
index b6d009589..f4f86a36d 100644
Binary files a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-With-Included-And-Excluded-Features-1-linux.png and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-With-Included-And-Excluded-Features-1-linux.png differ
diff --git a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Without-Features-1-linux.png b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Without-Features-1-linux.png
index 9a3df4463..e2462ea53 100644
Binary files a/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Without-Features-1-linux.png and b/packages/react/src/PricingOptions/PricingOptions.visual.spec.ts-snapshots/Visual-Comparison-PricingOptions-PricingOptions-Without-Features-1-linux.png differ