@arc-ui/community-components 3.15.0 → 3.17.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.
- package/.turbo/turbo-build.log +14 -14
- package/CHANGELOG.md +27 -0
- package/lib/ArticleCarousel/ArticleCarousel.cjs +1 -1
- package/lib/ArticleCarousel/ArticleCarousel.mjs +1 -1
- package/lib/ComparisonTable/ComparisonTable.cjs +317 -0
- package/lib/ComparisonTable/ComparisonTable.mjs +310 -0
- package/lib/ComparisonTable/styles.css +1 -0
- package/lib/CopyLead/CopyLead.cjs +1 -1
- package/lib/CopyLead/CopyLead.mjs +1 -1
- package/lib/FeaturePost/FeaturePost.cjs +13 -12
- package/lib/FeaturePost/FeaturePost.mjs +13 -12
- package/lib/FeaturePost/styles.css +1 -1
- package/lib/Highlights/Highlights.cjs +7 -7
- package/lib/Highlights/Highlights.mjs +7 -7
- package/lib/ProductCard/ProductCard.cjs +13 -35
- package/lib/ProductCard/ProductCard.mjs +12 -34
- package/lib/ProductNavigation/ProductNavigation.cjs +1 -1
- package/lib/ProductNavigation/ProductNavigation.mjs +1 -1
- package/lib/PromoListing/PromoListing.cjs +1 -1
- package/lib/PromoListing/PromoListing.mjs +1 -1
- package/lib/Summary/Summary.cjs +1 -1
- package/lib/Summary/Summary.mjs +1 -1
- package/lib/_shared/cjs/ProductCardPriceIncrease-BP39clav.cjs +38 -0
- package/lib/_shared/cjs/{index.es-C-y6aRIY.cjs → index.es-oEhoU2Bd.cjs} +1 -1
- package/lib/_shared/esm/ProductCardPriceIncrease-CJyG2wv-.mjs +35 -0
- package/lib/_shared/esm/{index.es-YxZ1vAot.mjs → index.es-DujqqZXe.mjs} +1 -1
- package/lib/index.cjs +508 -200
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +213 -22
- package/lib/index.d.mts +213 -22
- package/lib/index.mjs +503 -201
- package/lib/index.mjs.map +1 -1
- package/lib/styles.css +1 -1
- package/package.json +16 -16
- package/src/components/ComparisonTable/ComparisonTable.module.css +503 -0
- package/src/components/ComparisonTable/ComparisonTable.tsx +104 -0
- package/src/components/ComparisonTable/components/Cell/Cell.tsx +44 -0
- package/src/components/ComparisonTable/components/ControlCell/ControlCell.tsx +21 -0
- package/src/components/ComparisonTable/components/DesktopRow/DesktopRow.tsx +59 -0
- package/src/components/ComparisonTable/components/DesktopTable/DesktopTable.tsx +150 -0
- package/src/components/ComparisonTable/components/FeatureCell/FeatureCell.module.css +56 -0
- package/src/components/ComparisonTable/components/FeatureCell/FeatureCell.tsx +96 -0
- package/src/components/ComparisonTable/components/HeaderCell/HeaderCell.tsx +59 -0
- package/src/components/ComparisonTable/components/MobileRow/MobileRow.tsx +77 -0
- package/src/components/ComparisonTable/components/MobileTable/MobileTable.tsx +103 -0
- package/src/components/ComparisonTable/components/Section/Section.tsx +75 -0
- package/src/components/ComparisonTable/components/SectionToggle/SectionToggle.tsx +63 -0
- package/src/components/ComparisonTable/components/SubHeaderCell/SubHeaderCell.tsx +62 -0
- package/src/components/ComparisonTable/index.ts +22 -0
- package/src/components/ComparisonTable/types/comparison-column.ts +22 -0
- package/src/components/ComparisonTable/types/comparison-row.ts +23 -0
- package/src/components/ComparisonTable/types/comparison-section.ts +39 -0
- package/src/components/ComparisonTable/types/comparison-sub-row.ts +8 -0
- package/src/components/ComparisonTable/utils/group-rows.ts +69 -0
- package/src/components/ComparisonTable/utils/use-section-state.ts +45 -0
- package/src/components/FeaturePost/FeaturePost.module.css +24 -2
- package/src/components/FeaturePost/FeaturePost.tsx +26 -25
- package/src/components/FeaturePost/types/feature-post-cta-footer.ts +4 -3
- package/src/components/Highlights/Highlights.tsx +5 -32
- package/src/components/ProductCard/ProductCard.tsx +14 -14
- package/src/components/ProductCard/ProductCardPrice/ProductCardPrice.tsx +11 -3
- package/src/components/ProductCard/ProductCardPriceIncrease/ProductCardPriceIncrease.module.css +1 -2
- package/src/components/ProductCard/ProductCardPriceIncrease/ProductCardPriceIncrease.tsx +14 -3
- package/src/components/ProductCardGrid/ProductCardGrid.tsx +8 -8
- package/src/components/ProductCardGrid/components/CardGrid/CardGrid.tsx +6 -6
- package/src/components/index.ts +1 -0
- package/versions.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
|
|
2
|
-
> @arc-ui/community-components@3.
|
|
2
|
+
> @arc-ui/community-components@3.17.0 build /builds/enterprise/frontend/arc-community/packages/components
|
|
3
3
|
> rimraf lib dist && rollup -c && generate-subpath-css && pnpm run build:clean
|
|
4
4
|
|
|
5
|
-
Browserslist: browsers data (caniuse-lite) is
|
|
5
|
+
Browserslist: browsers data (caniuse-lite) is 15 months old. Please run:
|
|
6
6
|
npx update-browserslist-db@latest
|
|
7
7
|
Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
8
8
|
[36m
|
|
9
9
|
[1msrc/index.ts[22m → [1mlib/index.cjs, lib/index.mjs[22m...[39m
|
|
10
|
-
[32mcreated [1mlib/index.cjs, lib/index.mjs[22m in [1m6.
|
|
10
|
+
[32mcreated [1mlib/index.cjs, lib/index.mjs[22m in [1m6.6s[22m[39m
|
|
11
11
|
[36m
|
|
12
12
|
[1m./lib/types/index.d.ts[22m → [1mlib/index.d.mts, lib/index.d.cts[22m...[39m
|
|
13
13
|
[1m[33m(!) Unresolved dependencies[39m[22m
|
|
14
14
|
[90mhttps://rollupjs.org/troubleshooting/#warning-treating-module-as-external-dependency[39m
|
|
15
15
|
[1m@arc-ui/components/NavigationHeader[22m (imported by "lib/types/components/HeaderBarNotification/HeaderBarNotification.d.ts")
|
|
16
16
|
[1m@arc-ui/components/Avatar[22m (imported by "lib/types/components/Author/Author.d.ts")
|
|
17
|
+
[1m@arc-ui/components/Heading[22m (imported by "lib/types/components/CopyLead/CopyLead.d.ts", "lib/types/components/FeaturePost/FeaturePost.d.ts", "lib/types/components/PromoListing/PromoListing.d.ts", "lib/types/components/Summary/Summary.d.ts", "lib/types/components/BannerWithTabs/BannerWithTabs.d.ts", "lib/types/components/SectionHeading/SectionHeading.d.ts", "lib/types/components/VideoPortraitCard/VideoPortraitCard.d.ts", "lib/types/components/PartnerBrandLogos/PartnerBrandLogos.d.ts", "lib/types/components/ProductCard/ProductCard.d.ts", "lib/types/components/ComparisonTable/types/comparison-section.d.ts", "lib/types/components/Accordion/components/AccordionHeading/AccordionHeading.d.ts", "lib/types/components/ArticleSidebar/types/text-section.d.ts", "lib/types/components/ArticleSidebar/types/link-section.d.ts", "lib/types/components/ArticleSidebar/types/topic.d.ts", "lib/types/components/ArticleSidebar/types/share.d.ts", "lib/types/components/PartnerBrandLogos/components/PartnerLogoSubgroup/PartnerLogoSubgroup.d.ts", "lib/types/components/ProductCard/ProductCardBenefits/ProductCardBenefits.d.ts", "lib/types/components/ProductCard/ProductCardPriceIncrease/ProductCardPriceIncrease.d.ts" and "lib/types/components/VideoHeroCard/components/VideoHeroCardContent/VideoHeroCardContent.d.ts")
|
|
18
|
+
[1m@arc-ui/components/VideoPlayer[22m (imported by "lib/types/components/CopyLead/CopyLead.d.ts" and "lib/types/components/FeaturePost/FeaturePost.d.ts")
|
|
17
19
|
[1m@arc-ui/components/MediaCard[22m (imported by "lib/types/components/ArticleCarousel/ArticleCarousel.d.ts", "lib/types/components/PromoListing/PromoListing.d.ts" and "lib/types/components/BusinessSegmentSwitcher/types/types.d.ts")
|
|
18
20
|
[1m@arc-ui/components/Download[22m (imported by "lib/types/components/DownloadList/DownloadList.d.ts")
|
|
19
|
-
[1m@arc-ui/components/
|
|
20
|
-
[1m@arc-ui/components/VideoPlayer[22m (imported by "lib/types/components/CopyLead/CopyLead.d.ts" and "lib/types/components/FeaturePost/FeaturePost.d.ts")
|
|
21
|
-
[1m@arc-ui/components/ButtonV2[22m (imported by "lib/types/components/Highlights/Highlights.d.ts", "lib/types/components/PromoListing/PromoListing.d.ts" and "lib/types/components/ProductCard/ProductCard.d.ts")
|
|
21
|
+
[1m@arc-ui/components/ButtonV2[22m (imported by "lib/types/components/Highlights/Highlights.d.ts", "lib/types/components/PromoListing/PromoListing.d.ts", "lib/types/components/ProductCard/ProductCard.d.ts", "lib/types/components/ComparisonTable/components/SubHeaderCell/SubHeaderCell.d.ts" and "lib/types/components/FeaturePost/types/feature-post-cta-footer.d.ts")
|
|
22
22
|
[1m@arc-ui/components/ImpactCard[22m (imported by "lib/types/components/PromoListing/PromoListing.d.ts")
|
|
23
23
|
[1m@arc-ui/components/InformationCard[22m (imported by "lib/types/components/PromoListing/PromoListing.d.ts", "lib/types/components/BusinessSegmentSwitcher/types/types.d.ts" and "lib/types/components/ProductNavigation/types/product-list.d.ts")
|
|
24
24
|
[1m@arc-ui/components/TypographyCard[22m (imported by "lib/types/components/PromoListing/PromoListing.d.ts" and "lib/types/components/BusinessSegmentSwitcher/types/types.d.ts")
|
|
@@ -29,21 +29,21 @@ Browserslist: browsers data (caniuse-lite) is 13 months old. Please run:
|
|
|
29
29
|
[1m@arc-ui/components/Tabs[22m (imported by "lib/types/components/ProductCardGrid/ProductCardGrid.d.ts")
|
|
30
30
|
[1m@arc-ui/components/Disclosure[22m (imported by "lib/types/components/Accordion/components/AccordionDisclosureList/AccordionDisclosureList.d.ts")
|
|
31
31
|
[1m@arc-ui/components/Tag[22m (imported by "lib/types/components/ArticleSidebar/types/topic.d.ts")
|
|
32
|
-
[1m@arc-ui/components/Button[22m (imported by "lib/types/components/CopyLead/types/copy-lead-button.d.ts"
|
|
32
|
+
[1m@arc-ui/components/Button[22m (imported by "lib/types/components/CopyLead/types/copy-lead-button.d.ts")
|
|
33
33
|
[1m@arc-ui/components/AppButton[22m (imported by "lib/types/components/FeaturePost/types/feature-post-app-button-footer.d.ts")
|
|
34
34
|
[1mreact-player/types[22m (imported by "lib/types/internal/VideoCardPlayer/VideoCardPlayer.d.ts" and "lib/types/internal/VideoCardPlayer/types/player-props.d.ts")
|
|
35
35
|
[1m@arc-ui/components/Visible[22m (imported by "lib/types/internal/VideoCardPlayer/components/VideoCardThumbnail/VideoCardThumbnail.d.ts")
|
|
36
|
-
[32mcreated [1mlib/index.d.mts, lib/index.d.cts[22m in [
|
|
36
|
+
[32mcreated [1mlib/index.d.mts, lib/index.d.cts[22m in [1m191ms[22m[39m
|
|
37
37
|
[36m
|
|
38
|
-
[1m./src/components/Accordion/index.ts, ./src/components/ActionTile/index.ts, ./src/components/ArticleCarousel/index.ts, ./src/components/ArticleSidebar/index.ts, ./src/components/Author/index.ts, ./src/components/BannerWithTabs/index.ts, ./src/components/BusinessSegmentSwitcher/index.ts, ./src/components/ContentInfoWidget/index.ts, ./src/components/CopyLead/index.ts, ./src/components/DownloadList/index.ts, ./src/components/FAQs/index.ts, ./src/components/FeaturePost/index.ts, ./src/components/HeaderBarNotification/index.ts, ./src/components/Highlights/index.ts, ./src/components/InlineLinkGroup/index.ts, ./src/components/LinkTile/index.ts, ./src/components/PartnerBrandLogos/index.ts, ./src/components/ProductCard/index.ts, ./src/components/ProductCardGrid/index.ts, ./src/components/ProductNavigation/index.ts, ./src/components/PromoListing/index.ts, ./src/components/PromoListingThumbnailSignpost/index.ts, ./src/components/Quote/index.ts, ./src/components/SectionHeading/index.ts, ./src/components/Statistics/index.ts, ./src/components/Summary/index.ts, ./src/components/ThumbnailSignpost/index.ts, ./src/components/VideoHeroCard/index.ts, ./src/components/VideoPortraitCard/index.ts[22m → [1mlib[22m...[39m
|
|
39
|
-
[32mcreated [1mlib[22m in [
|
|
38
|
+
[1m./src/components/Accordion/index.ts, ./src/components/ActionTile/index.ts, ./src/components/ArticleCarousel/index.ts, ./src/components/ArticleSidebar/index.ts, ./src/components/Author/index.ts, ./src/components/BannerWithTabs/index.ts, ./src/components/BusinessSegmentSwitcher/index.ts, ./src/components/ComparisonTable/index.ts, ./src/components/ContentInfoWidget/index.ts, ./src/components/CopyLead/index.ts, ./src/components/DownloadList/index.ts, ./src/components/FAQs/index.ts, ./src/components/FeaturePost/index.ts, ./src/components/HeaderBarNotification/index.ts, ./src/components/Highlights/index.ts, ./src/components/InlineLinkGroup/index.ts, ./src/components/LinkTile/index.ts, ./src/components/PartnerBrandLogos/index.ts, ./src/components/ProductCard/index.ts, ./src/components/ProductCardGrid/index.ts, ./src/components/ProductNavigation/index.ts, ./src/components/PromoListing/index.ts, ./src/components/PromoListingThumbnailSignpost/index.ts, ./src/components/Quote/index.ts, ./src/components/SectionHeading/index.ts, ./src/components/Statistics/index.ts, ./src/components/Summary/index.ts, ./src/components/ThumbnailSignpost/index.ts, ./src/components/VideoHeroCard/index.ts, ./src/components/VideoPortraitCard/index.ts[22m → [1mlib[22m...[39m
|
|
39
|
+
[32mcreated [1mlib[22m in [1m6.8s[22m[39m
|
|
40
40
|
[36m
|
|
41
|
-
[1m./src/components/Accordion/index.ts, ./src/components/ActionTile/index.ts, ./src/components/ArticleCarousel/index.ts, ./src/components/ArticleSidebar/index.ts, ./src/components/Author/index.ts, ./src/components/BannerWithTabs/index.ts, ./src/components/BusinessSegmentSwitcher/index.ts, ./src/components/ContentInfoWidget/index.ts, ./src/components/CopyLead/index.ts, ./src/components/DownloadList/index.ts, ./src/components/FAQs/index.ts, ./src/components/FeaturePost/index.ts, ./src/components/HeaderBarNotification/index.ts, ./src/components/Highlights/index.ts, ./src/components/InlineLinkGroup/index.ts, ./src/components/LinkTile/index.ts, ./src/components/PartnerBrandLogos/index.ts, ./src/components/ProductCard/index.ts, ./src/components/ProductCardGrid/index.ts, ./src/components/ProductNavigation/index.ts, ./src/components/PromoListing/index.ts, ./src/components/PromoListingThumbnailSignpost/index.ts, ./src/components/Quote/index.ts, ./src/components/SectionHeading/index.ts, ./src/components/Statistics/index.ts, ./src/components/Summary/index.ts, ./src/components/ThumbnailSignpost/index.ts, ./src/components/VideoHeroCard/index.ts, ./src/components/VideoPortraitCard/index.ts[22m → [1mlib[22m...[39m
|
|
42
|
-
[32mcreated [1mlib[22m in [
|
|
43
|
-
Browserslist: browsers data (caniuse-lite) is
|
|
41
|
+
[1m./src/components/Accordion/index.ts, ./src/components/ActionTile/index.ts, ./src/components/ArticleCarousel/index.ts, ./src/components/ArticleSidebar/index.ts, ./src/components/Author/index.ts, ./src/components/BannerWithTabs/index.ts, ./src/components/BusinessSegmentSwitcher/index.ts, ./src/components/ComparisonTable/index.ts, ./src/components/ContentInfoWidget/index.ts, ./src/components/CopyLead/index.ts, ./src/components/DownloadList/index.ts, ./src/components/FAQs/index.ts, ./src/components/FeaturePost/index.ts, ./src/components/HeaderBarNotification/index.ts, ./src/components/Highlights/index.ts, ./src/components/InlineLinkGroup/index.ts, ./src/components/LinkTile/index.ts, ./src/components/PartnerBrandLogos/index.ts, ./src/components/ProductCard/index.ts, ./src/components/ProductCardGrid/index.ts, ./src/components/ProductNavigation/index.ts, ./src/components/PromoListing/index.ts, ./src/components/PromoListingThumbnailSignpost/index.ts, ./src/components/Quote/index.ts, ./src/components/SectionHeading/index.ts, ./src/components/Statistics/index.ts, ./src/components/Summary/index.ts, ./src/components/ThumbnailSignpost/index.ts, ./src/components/VideoHeroCard/index.ts, ./src/components/VideoPortraitCard/index.ts[22m → [1mlib[22m...[39m
|
|
42
|
+
[32mcreated [1mlib[22m in [1m7.2s[22m[39m
|
|
43
|
+
Browserslist: browsers data (caniuse-lite) is 15 months old. Please run:
|
|
44
44
|
npx update-browserslist-db@latest
|
|
45
45
|
Why you should do it regularly: https://github.com/browserslist/update-db#readme
|
|
46
46
|
|
|
47
|
-
> @arc-ui/community-components@3.
|
|
47
|
+
> @arc-ui/community-components@3.17.0 build:clean /builds/enterprise/frontend/arc-community/packages/components
|
|
48
48
|
> rimraf ./lib/types ./lib/styles.js ./lib/index.js ./lib/index.js.map
|
|
49
49
|
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @arc-ui/community-components
|
|
2
2
|
|
|
3
|
+
## 3.17.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 46b9c24: Allow FeaturePost CTA buttons to use all ButtonV2 styles while preserving secondary as the default.
|
|
8
|
+
- 46b9c24: Introduce new ComparisonTable component
|
|
9
|
+
- 46b9c24: Support all ButtonV2 styles for Highlights CTAs through cta.buttonStyle, defaulting to secondary and preserving existing cta usage.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 46b9c24: Use ButtonV2Props for Highlights CTAs and forward button props while retaining existing defaults.
|
|
14
|
+
- 46b9c24: refactor: make rows be a single array with a sectionID prop
|
|
15
|
+
- 46b9c24: Preserve the fixed medium size for Highlights CTAs and limit Storybook examples to the established styles and default.
|
|
16
|
+
- 46b9c24: Align the FeaturePost date with the label when it wraps onto a separate row.
|
|
17
|
+
- 46b9c24: Keep Highlights button styling on the existing cta API and remove the additional footer prop.
|
|
18
|
+
- 46b9c24: create tags via Gitlab API using CI_JOB_TOKEN rather than pushing tag via PAT
|
|
19
|
+
- 46b9c24: Replace Project Access Token to CI_JOB_TOKEN for tag and publish stage
|
|
20
|
+
- 46b9c24: Use local styles for FeaturePost label wrapping and date layout without overriding Arc component classes.
|
|
21
|
+
- 46b9c24: Allow FeaturePost labels to wrap across multiple lines instead of truncating.
|
|
22
|
+
- 46b9c24: fix a11y roles for comparison table
|
|
23
|
+
|
|
24
|
+
## 3.16.0
|
|
25
|
+
|
|
26
|
+
### Minor Changes
|
|
27
|
+
|
|
28
|
+
- Update Arc packages to 13.16.0, including components, themes, icons, gradients and design tokens.
|
|
29
|
+
|
|
3
30
|
## 3.15.0
|
|
4
31
|
|
|
5
32
|
### Minor Changes
|
|
@@ -6,7 +6,7 @@ var index = require('../_shared/cjs/index-B7Z7sgRq.cjs');
|
|
|
6
6
|
var Carousel = require('@arc-ui/components/Carousel');
|
|
7
7
|
var SectionHeading = require('../_shared/cjs/SectionHeading-XCMdv8eZ.cjs');
|
|
8
8
|
var filterAttrs = require('../_shared/cjs/filter-attrs-BizjMsy0.cjs');
|
|
9
|
-
var index_es = require('../_shared/cjs/index.es-
|
|
9
|
+
var index_es = require('../_shared/cjs/index.es-oEhoU2Bd.cjs');
|
|
10
10
|
var MediaCard = require('@arc-ui/components/MediaCard');
|
|
11
11
|
var useMediaQuery = require('@arc-ui/components/use-media-query');
|
|
12
12
|
require('@arc-ui/components/Text');
|
|
@@ -4,7 +4,7 @@ import { a as commonjsGlobal, g as getDefaultExportFromCjs, c as classNames } fr
|
|
|
4
4
|
import { Carousel } from '@arc-ui/components/Carousel';
|
|
5
5
|
import { S as SectionHeading } from '../_shared/esm/SectionHeading-lyXLUtdr.mjs';
|
|
6
6
|
import { f as filterAttrs } from '../_shared/esm/filter-attrs-DZ7RCEZm.mjs';
|
|
7
|
-
import { d as ArcSizeBreakpointsXs, A as ArcSizeBreakpointsS, b as ArcSizeBreakpointsM, a as ArcSizeBreakpointsL, c as ArcSizeBreakpointsXl, e as ArcSizeBreakpointsXxl } from '../_shared/esm/index.es-
|
|
7
|
+
import { d as ArcSizeBreakpointsXs, A as ArcSizeBreakpointsS, b as ArcSizeBreakpointsM, a as ArcSizeBreakpointsL, c as ArcSizeBreakpointsXl, e as ArcSizeBreakpointsXxl } from '../_shared/esm/index.es-DujqqZXe.mjs';
|
|
8
8
|
import { MediaCard } from '@arc-ui/components/MediaCard';
|
|
9
9
|
import { useMediaQuery } from '@arc-ui/components/use-media-query';
|
|
10
10
|
import '@arc-ui/components/Text';
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var tslib_es6 = require('../_shared/cjs/tslib.es6-BxB9I209.cjs');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var index = require('../_shared/cjs/index-B7Z7sgRq.cjs');
|
|
6
|
+
var filterAttrs = require('../_shared/cjs/filter-attrs-BizjMsy0.cjs');
|
|
7
|
+
var Heading = require('@arc-ui/components/Heading');
|
|
8
|
+
var Surface = require('@arc-ui/components/Surface');
|
|
9
|
+
var Text = require('@arc-ui/components/Text');
|
|
10
|
+
var VisuallyHidden = require('@arc-ui/components/VisuallyHidden');
|
|
11
|
+
var Icon = require('@arc-ui/components/Icon');
|
|
12
|
+
var Popover = require('@arc-ui/components/Popover');
|
|
13
|
+
var ButtonV2 = require('@arc-ui/components/ButtonV2');
|
|
14
|
+
var VerticalSpace = require('@arc-ui/components/VerticalSpace');
|
|
15
|
+
var ProductCardPriceIncrease = require('../_shared/cjs/ProductCardPriceIncrease-BP39clav.cjs');
|
|
16
|
+
|
|
17
|
+
var styles$1 = {"wrapper":"ComparisonTable-module_wrapper__SSvrL","wrapperBordered":"ComparisonTable-module_wrapperBordered__kQeRo","shadowOverlay":"ComparisonTable-module_shadowOverlay__unZ3Q","table":"ComparisonTable-module_table__iU0Zl","desktopTable":"ComparisonTable-module_desktopTable__IwkOh","headerRow":"ComparisonTable-module_headerRow__BCw20","subHeaderRow":"ComparisonTable-module_subHeaderRow__h-S8Y","row":"ComparisonTable-module_row__VMAyW","headerCell":"ComparisonTable-module_headerCell__4bhwd","headerCellPromoted":"ComparisonTable-module_headerCellPromoted__4oIRU","highlightedTop":"ComparisonTable-module_highlightedTop__pKNy8","stickyHeader":"ComparisonTable-module_stickyHeader__MJLxP","subHeaderCell":"ComparisonTable-module_subHeaderCell__12J6c","rowGroup":"ComparisonTable-module_rowGroup__YuAHE","featureRow":"ComparisonTable-module_featureRow__hSa-p","featureRowHeader":"ComparisonTable-module_featureRowHeader__YB-eY","cell":"ComparisonTable-module_cell__lWOm3","featureRowHeaderContent":"ComparisonTable-module_featureRowHeaderContent__XmzGi","controlRow":"ComparisonTable-module_controlRow__Lf01P","controlCell":"ComparisonTable-module_controlCell__uauzO","controlCellContent":"ComparisonTable-module_controlCellContent__welDu","highlighted":"ComparisonTable-module_highlighted__WLAu4","highlightedBottom":"ComparisonTable-module_highlightedBottom__7PPJO","mobileLayout":"ComparisonTable-module_mobileLayout__GkFfO","desktopLayout":"ComparisonTable-module_desktopLayout__k3qMZ","desktopTableSticky":"ComparisonTable-module_desktopTableSticky__GflmR","desktopHeaderRow":"ComparisonTable-module_desktopHeaderRow__BmfJz","desktopSubHeaderRow":"ComparisonTable-module_desktopSubHeaderRow__4KeVU","desktopRow":"ComparisonTable-module_desktopRow__XrYwQ","desktopFeatureHeader":"ComparisonTable-module_desktopFeatureHeader__M5Aa-","desktopHeaderCell":"ComparisonTable-module_desktopHeaderCell__fEYWe","desktopControlsCell":"ComparisonTable-module_desktopControlsCell__5fjOI","desktopFeatureCell":"ComparisonTable-module_desktopFeatureCell__i5MiH","sectionToggleRow":"ComparisonTable-module_sectionToggleRow__XDwt4","sectionToggle":"ComparisonTable-module_sectionToggle__GR-Xz","sectionContent":"ComparisonTable-module_sectionContent__GuogA","sectionToggleContent":"ComparisonTable-module_sectionToggleContent__p0ouX","sectionToggleOpen":"ComparisonTable-module_sectionToggleOpen__ZFdLO","sectionChevron":"ComparisonTable-module_sectionChevron__0kmLs","sectionChevronOpen":"ComparisonTable-module_sectionChevronOpen__m7jv0","isLastRow":"ComparisonTable-module_isLastRow__coPlk"};
|
|
18
|
+
|
|
19
|
+
var HeaderCell = function (_a) {
|
|
20
|
+
var _b;
|
|
21
|
+
var children = _a.children, _c = _a.columnIndex, columnIndex = _c === void 0 ? 0 : _c, promoted = _a.promoted, props = tslib_es6.__rest(_a, ["children", "columnIndex", "promoted"]);
|
|
22
|
+
return (React.createElement("div", tslib_es6.__assign({ role: "columnheader", className: index.classNames(styles$1.headerCell, (_b = {},
|
|
23
|
+
_b[styles$1.highlighted] = columnIndex % 2 === 0,
|
|
24
|
+
_b[styles$1.highlightedTop] = columnIndex % 2 === 0,
|
|
25
|
+
_b)) }, filterAttrs.filterAttrs(props)),
|
|
26
|
+
promoted && (React.createElement("div", { className: styles$1.headerCellPromoted },
|
|
27
|
+
React.createElement(Surface.Surface, { background: "dark-brand-01", paddingVertical: "16", paddingHorizontal: "24" },
|
|
28
|
+
React.createElement(VisuallyHidden.VisuallyHidden, null, "Promotional offer. "),
|
|
29
|
+
React.createElement(Text.Text, { size: "s" }, promoted)))),
|
|
30
|
+
children != null && (React.createElement(Heading.Heading, { size: "m", isWordWrap: true }, children))));
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var ControlCell = function (_a) {
|
|
34
|
+
var children = _a.children, props = tslib_es6.__rest(_a, ["children"]);
|
|
35
|
+
return (React.createElement("div", tslib_es6.__assign({ role: "cell", className: styles$1.controlCell }, filterAttrs.filterAttrs(props)),
|
|
36
|
+
React.createElement("div", { className: styles$1.controlCellContent }, children)));
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var Cell = function (_a) {
|
|
40
|
+
var _b;
|
|
41
|
+
var children = _a.children, _c = _a.columnIndex, columnIndex = _c === void 0 ? 0 : _c, _d = _a.isLastRow, isLastRow = _d === void 0 ? false : _d, props = tslib_es6.__rest(_a, ["children", "columnIndex", "isLastRow"]);
|
|
42
|
+
var isHighlighted = columnIndex % 2 === 0;
|
|
43
|
+
return (React.createElement("div", tslib_es6.__assign({ role: "cell", className: index.classNames(styles$1.cell, (_b = {},
|
|
44
|
+
_b[styles$1.highlighted] = isHighlighted,
|
|
45
|
+
_b[styles$1.highlightedBottom] = isHighlighted && isLastRow,
|
|
46
|
+
_b)) }, filterAttrs.filterAttrs(props)),
|
|
47
|
+
React.createElement(Text.Text, null, children)));
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Do not edit directly
|
|
52
|
+
* Generated file
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
const BtIconInfo =
|
|
56
|
+
"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3e%3cpath d='M16 2a14 14 0 1 0 14 14A14 14 0 0 0 16 2m0 27a13 13 0 1 1 13-13 13.015 13.015 0 0 1-13 13'/%3e%3cpath d='M16 8.993a1 1 0 1 0 0 2 1 1 0 1 0 0-2M15.995 12.977a.5.5 0 0 0-.5.5l-.002 9.01a.5.5 0 0 0 1 0l.002-9.01a.5.5 0 0 0-.5-.5'/%3e%3c/svg%3e";
|
|
57
|
+
|
|
58
|
+
var styles = {"packageCell":"FeatureCell-module_packageCell__H7UPQ","packageCellPopoverDesktop":"FeatureCell-module_packageCellPopoverDesktop__AHGzm","packageCellTitle":"FeatureCell-module_packageCellTitle__747D6","packageCellHeading":"FeatureCell-module_packageCellHeading__YxXWC","packageCellPopoverMobile":"FeatureCell-module_packageCellPopoverMobile__JEZXA"};
|
|
59
|
+
|
|
60
|
+
var FeatureCell = function (_a) {
|
|
61
|
+
var icon = _a.icon, title = _a.title, description = _a.description, popoverContent = _a.popoverContent;
|
|
62
|
+
return (React.createElement("div", { className: styles.packageCell },
|
|
63
|
+
React.createElement("div", { className: styles.packageCellTitle },
|
|
64
|
+
React.createElement("div", { style: { width: 32 } },
|
|
65
|
+
React.createElement(Icon.Icon, { icon: icon, size: 32, color: "brand" })),
|
|
66
|
+
React.createElement("div", { className: styles.packageCellText },
|
|
67
|
+
React.createElement("div", { className: styles.packageCellHeading },
|
|
68
|
+
React.createElement(Heading.Heading, { size: "xs", isWordWrap: true }, title),
|
|
69
|
+
popoverContent && (React.createElement("div", { className: styles.packageCellPopoverMobile },
|
|
70
|
+
React.createElement(Popover.Popover, { arrow: true, background: "white", constrainToViewport: true, content: React.createElement(Text.Text, null, popoverContent), maxWidth: 300, side: "top" },
|
|
71
|
+
React.createElement(Icon.Icon, { icon: BtIconInfo, size: 16, color: "brand", label: "More information about ".concat(title) })))),
|
|
72
|
+
" "),
|
|
73
|
+
description && (React.createElement(Text.Text, { size: "xs", tone: "muted" }, description)))),
|
|
74
|
+
popoverContent && (React.createElement("div", { className: styles.packageCellPopoverDesktop },
|
|
75
|
+
React.createElement(Popover.Popover, { arrow: true, background: "white", constrainToViewport: true, content: React.createElement(Text.Text, null, popoverContent), side: "bottom", align: "start" },
|
|
76
|
+
React.createElement(Icon.Icon, { icon: BtIconInfo, size: 16, color: "brand", label: "More information about ".concat(title) }))))));
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Renders a single content row of cells for the mobile layout.
|
|
81
|
+
*/
|
|
82
|
+
var renderRow = function (cells, key, isLastRow) { return (React.createElement("div", { key: key, className: styles$1.row }, cells.map(function (cell, index) { return (React.createElement(Cell, { key: "cell-".concat(index), columnIndex: index, isLastRow: isLastRow }, cell)); }))); };
|
|
83
|
+
var MobileRow = function (_a) {
|
|
84
|
+
var _b;
|
|
85
|
+
var _c;
|
|
86
|
+
var row = _a.row, _d = _a.isLastGroup, isLastGroup = _d === void 0 ? false : _d, props = tslib_es6.__rest(_a, ["row", "isLastGroup"]);
|
|
87
|
+
var subRows = (_c = row.subRows) !== null && _c !== void 0 ? _c : [];
|
|
88
|
+
var hasSubRows = subRows.length > 0;
|
|
89
|
+
return (React.createElement("div", tslib_es6.__assign({ role: "row", className: index.classNames(styles$1.rowGroup, (_b = {},
|
|
90
|
+
_b[styles$1.isLastRow] = isLastGroup,
|
|
91
|
+
_b)) }, filterAttrs.filterAttrs(props)),
|
|
92
|
+
React.createElement("div", { className: styles$1.featureRow },
|
|
93
|
+
React.createElement("div", { role: "rowheader", className: styles$1.featureRowHeader },
|
|
94
|
+
React.createElement("div", { className: styles$1.featureRowHeaderContent },
|
|
95
|
+
React.createElement(FeatureCell, { icon: row.feature.icon, title: row.feature.title, description: row.feature.description, popoverContent: row.feature.popoverContent })))),
|
|
96
|
+
renderRow(row.cells, "primary-row", isLastGroup && !hasSubRows),
|
|
97
|
+
subRows.map(function (subRow, index) {
|
|
98
|
+
return renderRow(subRow.cells, "row-".concat(index), isLastGroup && index === subRows.length - 1);
|
|
99
|
+
})));
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Do not edit directly
|
|
104
|
+
* Generated file
|
|
105
|
+
*/
|
|
106
|
+
|
|
107
|
+
const BtIconChevronDownMid =
|
|
108
|
+
"data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3e%3cpath fill='currentColor' d='m16 18.09 5.704-5.696a1.347 1.347 0 0 1 2.296.949 1.34 1.34 0 0 1-.393.95L16.95 20.94a1.347 1.347 0 0 1-1.902 0l-6.656-6.648A1.342 1.342 0 0 1 9.345 12c.356 0 .699.142.951.393z'/%3e%3c/svg%3e";
|
|
109
|
+
|
|
110
|
+
var SectionToggle = function (_a) {
|
|
111
|
+
var _b, _c;
|
|
112
|
+
var heading = _a.heading, _d = _a.headingLevel, headingLevel = _d === void 0 ? "3" : _d, isOpen = _a.isOpen, onToggle = _a.onToggle, controlsId = _a.controlsId;
|
|
113
|
+
return (React.createElement("button", { type: "button", className: index.classNames(styles$1.sectionToggle, (_b = {},
|
|
114
|
+
_b[styles$1.sectionToggleOpen] = isOpen,
|
|
115
|
+
_b)), "aria-expanded": isOpen, "aria-controls": controlsId, onClick: onToggle },
|
|
116
|
+
React.createElement("span", { className: styles$1.sectionToggleContent },
|
|
117
|
+
React.createElement(Heading.Heading, { level: headingLevel, size: "s" }, heading),
|
|
118
|
+
React.createElement("span", { className: index.classNames(styles$1.sectionChevron, (_c = {},
|
|
119
|
+
_c[styles$1.sectionChevronOpen] = isOpen,
|
|
120
|
+
_c)), "aria-hidden": "true" },
|
|
121
|
+
React.createElement(Icon.Icon, { icon: BtIconChevronDownMid, size: 24 })))));
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Optional-controlled open state for a section. When `open` is provided the
|
|
126
|
+
* section is controlled and the internal state is ignored; otherwise the hook
|
|
127
|
+
* manages its own state seeded by `defaultOpen`. `onOpenChange` is always
|
|
128
|
+
* called with the next value when `toggle` runs.
|
|
129
|
+
*/
|
|
130
|
+
var useSectionState = function (_a) {
|
|
131
|
+
var _b = _a.defaultOpen, defaultOpen = _b === void 0 ? false : _b, open = _a.open, onOpenChange = _a.onOpenChange;
|
|
132
|
+
var _c = React.useState(defaultOpen), internalOpen = _c[0], setInternalOpen = _c[1];
|
|
133
|
+
var isControlled = open !== undefined;
|
|
134
|
+
var isOpen = isControlled ? open : internalOpen;
|
|
135
|
+
var toggle = React.useCallback(function () {
|
|
136
|
+
var next = !isOpen;
|
|
137
|
+
if (!isControlled) {
|
|
138
|
+
setInternalOpen(next);
|
|
139
|
+
}
|
|
140
|
+
onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(next);
|
|
141
|
+
}, [isControlled, isOpen, onOpenChange]);
|
|
142
|
+
return { isOpen: isOpen, toggle: toggle };
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
var Section = function (_a) {
|
|
146
|
+
var _b;
|
|
147
|
+
var section = _a.section, isLastSection = _a.isLastSection, renderRow = _a.renderRow;
|
|
148
|
+
var regionId = React.useId();
|
|
149
|
+
var _c = useSectionState({
|
|
150
|
+
defaultOpen: section.defaultOpen,
|
|
151
|
+
open: section.open,
|
|
152
|
+
onOpenChange: section.onOpenChange,
|
|
153
|
+
}), isOpen = _c.isOpen, toggle = _c.toggle;
|
|
154
|
+
var lastRowIndex = section.rows.length - 1;
|
|
155
|
+
return (React.createElement("div", { role: "rowgroup" },
|
|
156
|
+
React.createElement("div", { role: "row", className: index.classNames(styles$1.sectionToggleRow, (_b = {},
|
|
157
|
+
_b[styles$1.isLastRow] = isLastSection === true && !isOpen,
|
|
158
|
+
_b)) },
|
|
159
|
+
React.createElement(SectionToggle, { heading: section.heading, headingLevel: section.headingLevel, isOpen: isOpen, onToggle: toggle, controlsId: regionId })),
|
|
160
|
+
isOpen && (React.createElement("div", { id: regionId, className: styles$1.sectionContent }, section.rows.map(function (row, index) {
|
|
161
|
+
return renderRow(row, index, isLastSection === true && index === lastRowIndex);
|
|
162
|
+
})))));
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
var SubHeaderCell = function (_a) {
|
|
166
|
+
var _b;
|
|
167
|
+
var price = _a.price, priceIncrease = _a.priceIncrease, button = _a.button, _c = _a.columnIndex, columnIndex = _c === void 0 ? 0 : _c, props = tslib_es6.__rest(_a, ["price", "priceIncrease", "button", "columnIndex"]);
|
|
168
|
+
return (React.createElement("div", tslib_es6.__assign({ role: "cell", className: index.classNames(styles$1.subHeaderCell, (_b = {},
|
|
169
|
+
_b[styles$1.highlighted] = columnIndex % 2 === 0,
|
|
170
|
+
_b)) }, filterAttrs.filterAttrs(props)),
|
|
171
|
+
React.createElement(ProductCardPriceIncrease.ProductCardPrice, tslib_es6.__assign({}, price)),
|
|
172
|
+
priceIncrease && (React.createElement(ProductCardPriceIncrease.ProductCardPriceIncrease, tslib_es6.__assign({ heading: "Increasing to:", hideBorder: true }, priceIncrease))),
|
|
173
|
+
React.createElement(VerticalSpace.VerticalSpace, null),
|
|
174
|
+
button && React.createElement(ButtonV2.ButtonV2, tslib_es6.__assign({ isFullWidth: true }, button))));
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
var MobileTable = function (_a) {
|
|
178
|
+
var columns = _a.columns, rows = _a.rows, sections = _a.sections, controls = _a.controls, className = _a.className;
|
|
179
|
+
return (React.createElement("div", { role: "table", className: index.classNames(styles$1.table, className), style: { "--comparison-columns": columns.length } },
|
|
180
|
+
React.createElement("div", { role: "row", className: styles$1.headerRow }, columns.map(function (column, index) { return (React.createElement(HeaderCell, { key: column.id, columnIndex: index, promoted: column.promoted }, column.label)); })),
|
|
181
|
+
controls && (React.createElement("div", { role: "row", className: styles$1.controlRow, "aria-label": "comparison table controls" },
|
|
182
|
+
React.createElement(ControlCell, null, controls))),
|
|
183
|
+
columns.some(function (column) { return column.subheader; }) && (React.createElement("div", { role: "row", className: styles$1.subHeaderRow }, columns.map(function (column, index) {
|
|
184
|
+
var _a;
|
|
185
|
+
return (React.createElement(SubHeaderCell, tslib_es6.__assign({ key: column.id, columnIndex: index }, ((_a = column.subheader) !== null && _a !== void 0 ? _a : { price: { value: "" } }))));
|
|
186
|
+
}))),
|
|
187
|
+
rows.map(function (row, index) { return (React.createElement(MobileRow, { key: "row-group-".concat(index), row: row, isLastGroup: sections.length === 0 && index === rows.length - 1 })); }),
|
|
188
|
+
sections.map(function (section, index) { return (React.createElement(Section, { key: section.id, section: section, isLastSection: index === sections.length - 1, renderRow: function (row, rowIndex, isLast) { return (React.createElement(MobileRow, { key: "section-group-".concat(rowIndex), row: row, isLastGroup: isLast })); } })); })));
|
|
189
|
+
};
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The same plans are highlighted in both layouts: plan index 0, 2, 4, ... (the
|
|
193
|
+
* 1st, 3rd, 5th plan). On desktop the leading feature column shifts these into
|
|
194
|
+
* the 2nd, 4th, ... visual grid columns, but it's the same plan as on mobile.
|
|
195
|
+
*/
|
|
196
|
+
var isPlanHighlighted$1 = function (planIndex) { return planIndex % 2 === 0; };
|
|
197
|
+
var DesktopRow = function (_a) {
|
|
198
|
+
var _b;
|
|
199
|
+
var row = _a.row, _c = _a.isLastRow, isLastRow = _c === void 0 ? false : _c;
|
|
200
|
+
return (React.createElement("div", { role: "row", className: index.classNames(styles$1.desktopRow, (_b = {},
|
|
201
|
+
_b[styles$1.isLastRow] = isLastRow,
|
|
202
|
+
_b)) },
|
|
203
|
+
React.createElement("div", { role: "rowheader", className: styles$1.desktopFeatureCell },
|
|
204
|
+
React.createElement(FeatureCell, { icon: row.feature.icon, title: row.feature.title, description: row.feature.description, popoverContent: row.feature.popoverContent })),
|
|
205
|
+
row.cells.map(function (cell, cellIndex) {
|
|
206
|
+
var _a;
|
|
207
|
+
return (React.createElement("div", { key: "desktop-cell-".concat(cellIndex), role: "cell", className: index.classNames(styles$1.cell, (_a = {},
|
|
208
|
+
_a[styles$1.highlighted] = isPlanHighlighted$1(cellIndex),
|
|
209
|
+
_a[styles$1.highlightedBottom] = isPlanHighlighted$1(cellIndex) && isLastRow,
|
|
210
|
+
_a)) },
|
|
211
|
+
React.createElement(Text.Text, null, cell)));
|
|
212
|
+
})));
|
|
213
|
+
};
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* The same plans are highlighted in both layouts: plan index 0, 2, 4, ... (the
|
|
217
|
+
* 1st, 3rd, 5th plan). On desktop the leading feature column shifts these into
|
|
218
|
+
* the 2nd, 4th, ... visual grid columns, but it's the same plan as on mobile.
|
|
219
|
+
*/
|
|
220
|
+
var isPlanHighlighted = function (planIndex) { return planIndex % 2 === 0; };
|
|
221
|
+
var DesktopTable = function (_a) {
|
|
222
|
+
var _b, _c;
|
|
223
|
+
var columns = _a.columns, rows = _a.rows, sections = _a.sections, controls = _a.controls, hasStickyHeader = _a.hasStickyHeader, className = _a.className;
|
|
224
|
+
var hasSubheader = columns.some(function (column) { return column.subheader; });
|
|
225
|
+
return (React.createElement("div", { role: "table", className: index.classNames(styles$1.desktopTable, className, (_b = {},
|
|
226
|
+
_b[styles$1.desktopTableSticky] = hasStickyHeader,
|
|
227
|
+
_b)), style: { "--comparison-columns": columns.length } },
|
|
228
|
+
React.createElement("div", { role: "row", className: index.classNames(styles$1.desktopHeaderRow, (_c = {},
|
|
229
|
+
_c[styles$1.stickyHeader] = hasStickyHeader,
|
|
230
|
+
_c)) },
|
|
231
|
+
React.createElement("div", { role: "columnheader", className: styles$1.desktopFeatureHeader },
|
|
232
|
+
React.createElement(VisuallyHidden.VisuallyHidden, null, "Features")),
|
|
233
|
+
columns.map(function (column, index$1) {
|
|
234
|
+
var _a;
|
|
235
|
+
return (React.createElement("div", { key: column.id, role: "columnheader", className: index.classNames(styles$1.desktopHeaderCell, (_a = {},
|
|
236
|
+
_a[styles$1.highlighted] = isPlanHighlighted(index$1),
|
|
237
|
+
_a[styles$1.highlightedTop] = isPlanHighlighted(index$1),
|
|
238
|
+
_a)) },
|
|
239
|
+
column.promoted && (React.createElement("div", { className: styles$1.headerCellPromoted },
|
|
240
|
+
React.createElement(Surface.Surface, { background: "dark-brand-01", paddingVertical: "16", paddingHorizontal: "24" },
|
|
241
|
+
React.createElement(VisuallyHidden.VisuallyHidden, null, "Promotional offer. "),
|
|
242
|
+
React.createElement(Text.Text, { size: "s" }, column.promoted)))),
|
|
243
|
+
React.createElement(Heading.Heading, { size: "m" }, column.label)));
|
|
244
|
+
})),
|
|
245
|
+
(controls || hasSubheader) && (React.createElement("div", { role: "row", className: styles$1.desktopSubHeaderRow },
|
|
246
|
+
React.createElement("div", { className: styles$1.desktopControlsCell, "aria-label": "comparison table controls" }, controls),
|
|
247
|
+
columns.map(function (column, index) {
|
|
248
|
+
var _a;
|
|
249
|
+
return (React.createElement(SubHeaderCell, tslib_es6.__assign({ key: column.id, columnIndex: isPlanHighlighted(index) ? 0 : 1 }, ((_a = column.subheader) !== null && _a !== void 0 ? _a : { price: { value: "" } }))));
|
|
250
|
+
}))),
|
|
251
|
+
rows.map(function (row, rowIndex) { return (React.createElement(DesktopRow, { key: "desktop-row-".concat(rowIndex), row: row, isLastRow: sections.length === 0 && rowIndex === rows.length - 1 })); }),
|
|
252
|
+
sections.map(function (section, index) { return (React.createElement(Section, { key: section.id, section: section, isLastSection: index === sections.length - 1, renderRow: function (row, rowIndex, isLast) { return (React.createElement(DesktopRow, { key: "desktop-section-row-".concat(rowIndex), row: row, isLastRow: isLast })); } })); })));
|
|
253
|
+
};
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Splits a flat list of rows into unsectioned rows and resolved sections.
|
|
257
|
+
* Rows are bucketed by `sectionId` in one pass, then sections are built by
|
|
258
|
+
* iterating `sections` (not the bucket keys) so section order follows the
|
|
259
|
+
* `sections` array. A `sectionId` with no matching section logs a dev-only
|
|
260
|
+
* warning and the row renders unsectioned, so rows are never lost.
|
|
261
|
+
*/
|
|
262
|
+
var groupRows = function (rows, sections) {
|
|
263
|
+
if (rows === void 0) { rows = []; }
|
|
264
|
+
if (sections === void 0) { sections = []; }
|
|
265
|
+
var knownIds = new Set(sections.map(function (section) { return section.id; }));
|
|
266
|
+
var rowsBySection = new Map();
|
|
267
|
+
var unsectioned = [];
|
|
268
|
+
rows.forEach(function (row) {
|
|
269
|
+
var sectionId = row.sectionId;
|
|
270
|
+
if (sectionId === undefined) {
|
|
271
|
+
unsectioned.push(row);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (!knownIds.has(sectionId)) {
|
|
275
|
+
if (process.env.NODE_ENV !== "production") {
|
|
276
|
+
// eslint-disable-next-line no-console
|
|
277
|
+
console.warn("ComparisonTable: row sectionId \"".concat(sectionId, "\" does not match any section; rendering it unsectioned."));
|
|
278
|
+
}
|
|
279
|
+
unsectioned.push(row);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
var bucket = rowsBySection.get(sectionId);
|
|
283
|
+
if (bucket) {
|
|
284
|
+
bucket.push(row);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
rowsBySection.set(sectionId, [row]);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
var resolvedSections = [];
|
|
291
|
+
sections.forEach(function (section) {
|
|
292
|
+
var sectionRows = rowsBySection.get(section.id);
|
|
293
|
+
if (sectionRows === null || sectionRows === void 0 ? void 0 : sectionRows.length) {
|
|
294
|
+
resolvedSections.push(tslib_es6.__assign(tslib_es6.__assign({}, section), { rows: sectionRows }));
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
return { unsectioned: unsectioned, sections: resolvedSections };
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
var ComparisonTable = function (_a) {
|
|
301
|
+
var _b;
|
|
302
|
+
var columns = _a.columns, rows = _a.rows, sections = _a.sections, controls = _a.controls, _c = _a.hasBorder, hasBorder = _c === void 0 ? true : _c, _d = _a.hasStickyHeader, hasStickyHeader = _d === void 0 ? false : _d, props = tslib_es6.__rest(_a, ["columns", "rows", "sections", "controls", "hasBorder", "hasStickyHeader"]);
|
|
303
|
+
var _e = React.useMemo(function () { return groupRows(rows, sections); }, [rows, sections]), unsectioned = _e.unsectioned, resolvedSections = _e.sections;
|
|
304
|
+
return (React.createElement("div", tslib_es6.__assign({ className: index.classNames(styles$1.wrapper, (_b = {},
|
|
305
|
+
_b[styles$1.wrapperBordered] = hasBorder,
|
|
306
|
+
_b)) }, filterAttrs.filterAttrs(props)),
|
|
307
|
+
hasBorder && React.createElement("div", { className: styles$1.shadowOverlay, "aria-hidden": "true" }),
|
|
308
|
+
React.createElement(MobileTable, { className: styles$1.mobileLayout, columns: columns, rows: unsectioned, sections: resolvedSections, controls: controls }),
|
|
309
|
+
React.createElement(DesktopTable, { className: styles$1.desktopLayout, columns: columns, rows: unsectioned, sections: resolvedSections, controls: controls, hasStickyHeader: hasStickyHeader })));
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
exports.Cell = Cell;
|
|
313
|
+
exports.ComparisonTable = ComparisonTable;
|
|
314
|
+
exports.ControlCell = ControlCell;
|
|
315
|
+
exports.FeatureCell = FeatureCell;
|
|
316
|
+
exports.HeaderCell = HeaderCell;
|
|
317
|
+
exports.SubHeaderCell = SubHeaderCell;
|