@deriv-com/dds-marketing 1.0.2 → 1.1.1
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/.llm/components/awards.md +209 -0
- package/.llm/components/background.md +89 -40
- package/.llm/components/bottomsheet.md +5 -0
- package/.llm/components/comparisoncards.md +257 -0
- package/.llm/components/comparisontable.md +231 -0
- package/.llm/components/ctabanner.md +9 -12
- package/.llm/components/ctabannerslider.md +15 -2
- package/.llm/components/datatable.md +273 -0
- package/.llm/components/downloadbanner.md +283 -0
- package/.llm/components/featurecards.md +41 -3
- package/.llm/components/featurecardscarousel.md +311 -0
- package/.llm/components/featuresplit.md +5 -0
- package/.llm/components/featurestack.md +227 -0
- package/.llm/components/illustrationcard.md +2 -2
- package/.llm/components/illustrationscene.md +6 -10
- package/.llm/components/imagebanner.md +278 -0
- package/.llm/components/navbar.md +1 -1
- package/.llm/components/navbaritem.md +4 -0
- package/.llm/components/pageheader.md +4 -3
- package/.llm/components/paginationdots.md +6 -1
- package/.llm/components/producthero.md +35 -11
- package/.llm/components/resourcebanner.md +247 -0
- package/.llm/components/scenescroll.md +222 -0
- package/.llm/components/select.md +17 -0
- package/.llm/components/stats.md +219 -0
- package/.llm/components/steps.md +286 -0
- package/.llm/components/stickycards.md +251 -0
- package/.llm/components/tableheadercell.md +19 -0
- package/.llm/components/teamgrid.md +243 -0
- package/.llm/components/testimonialrow.md +5 -0
- package/.llm/components/testimonialslider.md +14 -1
- package/.llm/components/textarea.md +13 -0
- package/.llm/components/textinput.md +13 -0
- package/.llm/components/textscroll.md +187 -0
- package/.llm/components/tiers.md +227 -0
- package/.llm/digest/awards.md +45 -0
- package/.llm/digest/background.md +11 -10
- package/.llm/digest/bottomsheet.md +2 -0
- package/.llm/digest/comparisoncards.md +51 -0
- package/.llm/digest/comparisontable.md +53 -0
- package/.llm/digest/ctabanner.md +4 -4
- package/.llm/digest/ctabannerslider.md +4 -0
- package/.llm/digest/datatable.md +65 -0
- package/.llm/digest/downloadbanner.md +65 -0
- package/.llm/digest/featurecards.md +1 -1
- package/.llm/digest/featurecardscarousel.md +54 -0
- package/.llm/digest/featuresplit.md +1 -0
- package/.llm/digest/featurestack.md +48 -0
- package/.llm/digest/illustrationscene.md +2 -3
- package/.llm/digest/imagebanner.md +64 -0
- package/.llm/digest/navbaritem.md +1 -0
- package/.llm/digest/pageheader.md +2 -1
- package/.llm/digest/paginationdots.md +3 -1
- package/.llm/digest/producthero.md +4 -2
- package/.llm/digest/resourcebanner.md +53 -0
- package/.llm/digest/scenescroll.md +49 -0
- package/.llm/digest/select.md +5 -0
- package/.llm/digest/stats.md +46 -0
- package/.llm/digest/steps.md +55 -0
- package/.llm/digest/stickycards.md +52 -0
- package/.llm/digest/tableheadercell.md +4 -0
- package/.llm/digest/teamgrid.md +53 -0
- package/.llm/digest/testimonialrow.md +2 -0
- package/.llm/digest/testimonialslider.md +4 -0
- package/.llm/digest/textarea.md +4 -0
- package/.llm/digest/textinput.md +4 -0
- package/.llm/digest/textscroll.md +43 -0
- package/.llm/digest/tiers.md +50 -0
- package/.llm/index.md +19 -3
- package/.llm/tokens.md +26 -1
- package/AGENTS.md +17 -1
- package/dist/components/awards-data.d.ts +24 -0
- package/dist/components/awards-data.js +11 -0
- package/dist/components/block-image-data.d.ts +24 -0
- package/dist/components/block-image-data.js +9 -0
- package/dist/components/blocks/awards/Awards.css +134 -0
- package/dist/components/blocks/awards/Awards.d.ts +24 -0
- package/dist/components/blocks/awards/Awards.js +114 -0
- package/dist/components/blocks/awards/Awards.types.d.ts +31 -0
- package/dist/components/blocks/awards/Awards.types.js +16 -0
- package/dist/components/blocks/awards/awards-impl.css +222 -0
- package/dist/components/blocks/cards-of.d.ts +16 -0
- package/dist/components/blocks/cards-of.js +23 -0
- package/dist/components/blocks/comparison-cards/ComparisonCards.css +195 -0
- package/dist/components/blocks/comparison-cards/ComparisonCards.d.ts +24 -0
- package/dist/components/blocks/comparison-cards/ComparisonCards.js +75 -0
- package/dist/components/blocks/comparison-cards/ComparisonCards.types.d.ts +49 -0
- package/dist/components/blocks/comparison-cards/ComparisonCards.types.js +26 -0
- package/dist/components/blocks/comparison-cards/comparison-cards-impl.css +262 -0
- package/dist/components/blocks/comparison-table/ComparisonTable.css +111 -0
- package/dist/components/blocks/comparison-table/ComparisonTable.d.ts +25 -0
- package/dist/components/blocks/comparison-table/ComparisonTable.js +100 -0
- package/dist/components/blocks/comparison-table/ComparisonTable.types.d.ts +36 -0
- package/dist/components/blocks/comparison-table/ComparisonTable.types.js +15 -0
- package/dist/components/blocks/comparison-table/comparison-table-impl.css +143 -0
- package/dist/components/blocks/cta-banner/CtaBanner.css +1 -0
- package/dist/components/blocks/cta-banner/CtaBanner.js +2 -2
- package/dist/components/blocks/cta-banner/CtaBanner.types.d.ts +4 -3
- package/dist/components/blocks/cta-banner/CtaBanner.types.js +1 -1
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.css +1 -0
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.d.ts +1 -1
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.js +6 -2
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.types.d.ts +8 -0
- package/dist/components/blocks/cta-banner-slider/CtaBannerSlider.types.js +1 -1
- package/dist/components/blocks/data-table/DataTable.css +170 -0
- package/dist/components/blocks/data-table/DataTable.d.ts +29 -0
- package/dist/components/blocks/data-table/DataTable.js +84 -0
- package/dist/components/blocks/data-table/DataTable.types.d.ts +69 -0
- package/dist/components/blocks/data-table/DataTable.types.js +19 -0
- package/dist/components/blocks/data-table/data-table-impl.css +155 -0
- package/dist/components/blocks/download-banner/DownloadBanner.css +228 -0
- package/dist/components/blocks/download-banner/DownloadBanner.d.ts +28 -0
- package/dist/components/blocks/download-banner/DownloadBanner.js +75 -0
- package/dist/components/blocks/download-banner/DownloadBanner.types.d.ts +56 -0
- package/dist/components/blocks/download-banner/DownloadBanner.types.js +23 -0
- package/dist/components/blocks/download-banner/download-banner-impl.css +216 -0
- package/dist/components/blocks/faq-accordion/FaqAccordion.css +1 -0
- package/dist/components/blocks/faq-accordion/faq-accordion-impl.css +3 -7
- package/dist/components/blocks/feature-bullets/FeatureBullets.css +1 -0
- package/dist/components/blocks/feature-bullets/feature-bullets-impl.css +14 -1
- package/dist/components/blocks/feature-cards/FeatureCards.css +1 -0
- package/dist/components/blocks/feature-cards/FeatureCards.d.ts +2 -1
- package/dist/components/blocks/feature-cards/FeatureCards.js +4 -21
- package/dist/components/blocks/feature-cards/feature-cards-impl.css +10 -9
- package/dist/components/blocks/feature-cards-carousel/FeatureCardsCarousel.css +115 -0
- package/dist/components/blocks/feature-cards-carousel/FeatureCardsCarousel.d.ts +30 -0
- package/dist/components/blocks/feature-cards-carousel/FeatureCardsCarousel.js +160 -0
- package/dist/components/blocks/feature-cards-carousel/FeatureCardsCarousel.types.d.ts +52 -0
- package/dist/components/blocks/feature-cards-carousel/FeatureCardsCarousel.types.js +17 -0
- package/dist/components/blocks/feature-cards-carousel/feature-cards-carousel-impl.css +207 -0
- package/dist/components/blocks/feature-scroll/FeatureScroll.css +1 -0
- package/dist/components/blocks/feature-split/FeatureSplit.css +1 -0
- package/dist/components/blocks/feature-split/feature-split-impl.css +14 -1
- package/dist/components/blocks/feature-stack/FeatureStack.css +86 -0
- package/dist/components/blocks/feature-stack/FeatureStack.d.ts +19 -0
- package/dist/components/blocks/feature-stack/FeatureStack.js +27 -0
- package/dist/components/blocks/feature-stack/FeatureStack.types.d.ts +34 -0
- package/dist/components/blocks/feature-stack/FeatureStack.types.js +14 -0
- package/dist/components/blocks/feature-stack/feature-stack-impl.css +87 -0
- package/dist/components/blocks/image-banner/ImageBanner.css +133 -0
- package/dist/components/blocks/image-banner/ImageBanner.d.ts +32 -0
- package/dist/components/blocks/image-banner/ImageBanner.js +41 -0
- package/dist/components/blocks/image-banner/ImageBanner.types.d.ts +54 -0
- package/dist/components/blocks/image-banner/ImageBanner.types.js +14 -0
- package/dist/components/blocks/image-banner/image-banner-impl.css +281 -0
- package/dist/components/blocks/landing-hero/LandingHero.css +1 -0
- package/dist/components/blocks/logo-columns/LogoColumns.css +1 -0
- package/dist/components/blocks/logo-rows/LogoRows.css +1 -0
- package/dist/components/blocks/page-header/PageHeader.css +1 -0
- package/dist/components/blocks/page-header/PageHeader.js +2 -2
- package/dist/components/blocks/page-header/PageHeader.types.d.ts +4 -2
- package/dist/components/blocks/page-header/PageHeader.types.js +1 -1
- package/dist/components/blocks/page-header/page-header-impl.css +5 -3
- package/dist/components/blocks/product-hero/ProductHero.css +8 -3
- package/dist/components/blocks/product-hero/ProductHero.d.ts +1 -1
- package/dist/components/blocks/product-hero/ProductHero.js +5 -2
- package/dist/components/blocks/product-hero/ProductHero.types.d.ts +5 -1
- package/dist/components/blocks/product-hero/ProductHero.types.js +1 -0
- package/dist/components/blocks/product-hero/product-hero-impl.css +43 -12
- package/dist/components/blocks/resource-banner/ResourceBanner.css +106 -0
- package/dist/components/blocks/resource-banner/ResourceBanner.d.ts +32 -0
- package/dist/components/blocks/resource-banner/ResourceBanner.js +51 -0
- package/dist/components/blocks/resource-banner/ResourceBanner.types.d.ts +44 -0
- package/dist/components/blocks/resource-banner/ResourceBanner.types.js +14 -0
- package/dist/components/blocks/resource-banner/resource-banner-impl.css +69 -0
- package/dist/components/blocks/scene-scroll/SceneScroll.css +93 -0
- package/dist/components/blocks/scene-scroll/SceneScroll.d.ts +36 -0
- package/dist/components/blocks/scene-scroll/SceneScroll.js +54 -0
- package/dist/components/blocks/scene-scroll/SceneScroll.types.d.ts +32 -0
- package/dist/components/blocks/scene-scroll/SceneScroll.types.js +15 -0
- package/dist/components/blocks/scene-scroll/scene-scroll-impl.css +275 -0
- package/dist/components/blocks/stats/Stats.css +139 -0
- package/dist/components/blocks/stats/Stats.d.ts +24 -0
- package/dist/components/blocks/stats/Stats.js +120 -0
- package/dist/components/blocks/stats/Stats.types.d.ts +36 -0
- package/dist/components/blocks/stats/Stats.types.js +19 -0
- package/dist/components/blocks/stats/stats-count.d.ts +34 -0
- package/dist/components/blocks/stats/stats-count.js +61 -0
- package/dist/components/blocks/stats/stats-impl.css +284 -0
- package/dist/components/blocks/stats/use-wheel.d.ts +37 -0
- package/dist/components/blocks/stats/use-wheel.js +126 -0
- package/dist/components/blocks/steps/Steps.css +202 -0
- package/dist/components/blocks/steps/Steps.d.ts +32 -0
- package/dist/components/blocks/steps/Steps.js +65 -0
- package/dist/components/blocks/steps/Steps.types.d.ts +48 -0
- package/dist/components/blocks/steps/Steps.types.js +21 -0
- package/dist/components/blocks/steps/steps-impl.css +216 -0
- package/dist/components/blocks/steps/use-turn.d.ts +33 -0
- package/dist/components/blocks/steps/use-turn.js +75 -0
- package/dist/components/blocks/sticky-cards/StickyCards.css +154 -0
- package/dist/components/blocks/sticky-cards/StickyCards.d.ts +35 -0
- package/dist/components/blocks/sticky-cards/StickyCards.js +153 -0
- package/dist/components/blocks/sticky-cards/StickyCards.types.d.ts +43 -0
- package/dist/components/blocks/sticky-cards/StickyCards.types.js +18 -0
- package/dist/components/blocks/sticky-cards/sticky-cards-impl.css +393 -0
- package/dist/components/blocks/team-grid/TeamGrid.css +159 -0
- package/dist/components/blocks/team-grid/TeamGrid.d.ts +28 -0
- package/dist/components/blocks/team-grid/TeamGrid.js +74 -0
- package/dist/components/blocks/team-grid/TeamGrid.types.d.ts +51 -0
- package/dist/components/blocks/team-grid/TeamGrid.types.js +20 -0
- package/dist/components/blocks/team-grid/team-grid-impl.css +129 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.css +1 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.d.ts +1 -1
- package/dist/components/blocks/testimonial-row/TestimonialRow.js +4 -3
- package/dist/components/blocks/testimonial-row/TestimonialRow.types.d.ts +3 -0
- package/dist/components/blocks/testimonial-row/TestimonialRow.types.js +1 -1
- package/dist/components/blocks/testimonial-row/testimonial-row-impl.css +8 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.css +1 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.d.ts +1 -1
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.js +2 -2
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.types.d.ts +8 -0
- package/dist/components/blocks/testimonial-slider/TestimonialSlider.types.js +1 -1
- package/dist/components/blocks/text-scroll/TextScroll.css +53 -0
- package/dist/components/blocks/text-scroll/TextScroll.d.ts +5 -0
- package/dist/components/blocks/text-scroll/TextScroll.js +71 -0
- package/dist/components/blocks/text-scroll/TextScroll.types.d.ts +22 -0
- package/dist/components/blocks/text-scroll/TextScroll.types.js +10 -0
- package/dist/components/blocks/text-scroll/text-scroll-impl.css +115 -0
- package/dist/components/blocks/tiers/Tiers.css +233 -0
- package/dist/components/blocks/tiers/Tiers.d.ts +32 -0
- package/dist/components/blocks/tiers/Tiers.js +68 -0
- package/dist/components/blocks/tiers/Tiers.types.d.ts +45 -0
- package/dist/components/blocks/tiers/Tiers.types.js +25 -0
- package/dist/components/blocks/tiers/tiers-impl.css +185 -0
- package/dist/components/blocks/use-rotation.d.ts +12 -2
- package/dist/components/blocks/use-rotation.js +6 -28
- package/dist/components/comparison-cards-data.d.ts +59 -0
- package/dist/components/comparison-cards-data.js +12 -0
- package/dist/components/comparison-table-data.d.ts +39 -0
- package/dist/components/comparison-table-data.js +11 -0
- package/dist/components/core/accordion-item/AccordionItem.css +1 -5
- package/dist/components/core/background/Background.css +23 -0
- package/dist/components/core/background/Background.d.ts +10 -4
- package/dist/components/core/background/Background.js +16 -7
- package/dist/components/core/background/Background.types.d.ts +11 -8
- package/dist/components/core/background/Background.types.js +3 -1
- package/dist/components/core/background/background-impl.css +334 -1
- package/dist/components/core/background/halftone.d.ts +11 -0
- package/dist/components/core/background/halftone.js +43 -3
- package/dist/components/core/background/patterns.d.ts +66 -0
- package/dist/components/core/background/patterns.js +244 -0
- package/dist/components/core/background/shader.d.ts +44 -0
- package/dist/components/core/background/shader.js +307 -0
- package/dist/components/core/background/use-shader.d.ts +11 -0
- package/dist/components/core/background/use-shader.js +25 -0
- package/dist/components/core/background/use-spotlight.d.ts +2 -1
- package/dist/components/core/background/use-spotlight.js +9 -1
- package/dist/components/core/bottom-sheet/BottomSheet.js +2 -2
- package/dist/components/core/bottom-sheet/BottomSheet.types.d.ts +3 -1
- package/dist/components/core/breadcrumb/Breadcrumb.d.ts +1 -0
- package/dist/components/core/breadcrumb/Breadcrumb.js +1 -0
- package/dist/components/core/breadcrumb/breadcrumb-impl.css +11 -0
- package/dist/components/core/button/button-impl.css +14 -1
- package/dist/components/core/illustration-card/IllustrationCard.js +1 -1
- package/dist/components/core/illustration-card/illustration-card-impl.css +20 -0
- package/dist/components/core/illustration-scene/IllustrationScene.css +4 -7
- package/dist/components/core/illustration-scene/IllustrationScene.types.d.ts +2 -3
- package/dist/components/core/illustration-scene/illustration-scene-impl.css +22 -1
- package/dist/components/core/link/Link.js +7 -3
- package/dist/components/core/link/link-impl.css +29 -2
- package/dist/components/core/navbar/Navbar.css +2 -2
- package/dist/components/core/navbar/Navbar.types.d.ts +1 -1
- package/dist/components/core/navbar-item/NavbarItem.d.ts +2 -1
- package/dist/components/core/navbar-item/NavbarItem.js +3 -10
- package/dist/components/core/navbar-item/NavbarItem.types.d.ts +4 -1
- package/dist/components/core/navbar-item/NavbarItem.types.js +1 -1
- package/dist/components/core/navbar-item/navbar-item-impl.css +10 -0
- package/dist/components/core/navbar-menu/navbar-menu-impl.css +9 -0
- package/dist/components/core/navbar-switcher/navbar-switcher-impl.css +19 -0
- package/dist/components/core/pagination/Pagination.js +1 -1
- package/dist/components/core/pagination/pagination-impl.css +9 -0
- package/dist/components/core/pagination-dots/PaginationDots.d.ts +1 -1
- package/dist/components/core/pagination-dots/PaginationDots.js +3 -3
- package/dist/components/core/pagination-dots/PaginationDots.types.d.ts +3 -1
- package/dist/components/core/segmented-control/SegmentedControl.css +4 -3
- package/dist/components/core/segmented-control/SegmentedControl.js +17 -3
- package/dist/components/core/segmented-control-item/SegmentedControlItem.css +2 -1
- package/dist/components/core/select/Select.js +3 -3
- package/dist/components/core/select/Select.types.d.ts +11 -1
- package/dist/components/core/select/Select.types.js +1 -1
- package/dist/components/core/tab-list/TabList.js +9 -1
- package/dist/components/core/table-header-cell/TableHeaderCell.d.ts +1 -1
- package/dist/components/core/table-header-cell/TableHeaderCell.js +5 -2
- package/dist/components/core/table-header-cell/TableHeaderCell.types.d.ts +7 -1
- package/dist/components/core/table-header-cell/TableHeaderCell.types.js +1 -1
- package/dist/components/core/text-area/TextArea.d.ts +1 -1
- package/dist/components/core/text-area/TextArea.js +2 -2
- package/dist/components/core/text-area/TextArea.types.d.ts +9 -1
- package/dist/components/core/text-area/TextArea.types.js +1 -1
- package/dist/components/core/text-input/TextInput.d.ts +1 -1
- package/dist/components/core/text-input/TextInput.js +2 -2
- package/dist/components/core/text-input/TextInput.types.d.ts +9 -1
- package/dist/components/core/text-input/TextInput.types.js +1 -1
- package/dist/components/data-table-data.d.ts +33 -0
- package/dist/components/data-table-data.js +12 -0
- package/dist/components/download-banner-data.d.ts +52 -0
- package/dist/components/download-banner-data.js +11 -0
- package/dist/components/index.d.ts +45 -0
- package/dist/components/index.js +32 -0
- package/dist/components/resource-banner-data.d.ts +34 -0
- package/dist/components/resource-banner-data.js +13 -0
- package/dist/components/scene-scroll-data.d.ts +24 -0
- package/dist/components/scene-scroll-data.js +9 -0
- package/dist/components/stats-data.d.ts +28 -0
- package/dist/components/stats-data.js +11 -0
- package/dist/components/steps-data.d.ts +38 -0
- package/dist/components/steps-data.js +13 -0
- package/dist/components/sticky-cards-data.d.ts +43 -0
- package/dist/components/sticky-cards-data.js +12 -0
- package/dist/components/team-grid-data.d.ts +38 -0
- package/dist/components/team-grid-data.js +11 -0
- package/dist/components/tiers-data.d.ts +47 -0
- package/dist/components/tiers-data.js +13 -0
- package/dist/marketing.css +77 -28
- package/package.json +1 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { milliseconds } from '../../css-time.js';
|
|
4
|
+
/**
|
|
5
|
+
* The width the figures stop turning at and lay out as a grid: the package's fold, in rem. A
|
|
6
|
+
* number here rather than a token read, because the stylesheet's container query states the same
|
|
7
|
+
* width longhand — `var()` is not permitted in one — and the two have to agree.
|
|
8
|
+
*/
|
|
9
|
+
const FOLD_REM = 48;
|
|
10
|
+
/**
|
|
11
|
+
* A figure's place on the wheel at a given turn: the one in place, the one it replaced above it, the
|
|
12
|
+
* one coming in below it, and every other figure out of sight.
|
|
13
|
+
*
|
|
14
|
+
* With two figures there is no "above" — the one that leaves comes straight back in below — and with
|
|
15
|
+
* three the one above goes straight to below, which the stylesheet draws as an arrival from below
|
|
16
|
+
* rather than as a figure crossing the wheel.
|
|
17
|
+
*/
|
|
18
|
+
export function slotOf(at, turn, count) {
|
|
19
|
+
const place = (((at - turn) % count) + count) % count;
|
|
20
|
+
if (place === 0)
|
|
21
|
+
return 'active';
|
|
22
|
+
if (place === 1)
|
|
23
|
+
return 'below';
|
|
24
|
+
if (place === count - 1)
|
|
25
|
+
return 'above';
|
|
26
|
+
return 'hidden';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* The phone's wheel of figures — the reference site's mobile stats: one figure in place, the one
|
|
30
|
+
* before it smaller above and the next smaller below, turning on to the next every
|
|
31
|
+
* motion.duration.hold plus motion.duration.turn.
|
|
32
|
+
*
|
|
33
|
+
* It turns only where every condition for it holds, and otherwise hands back `wheeling: false` and
|
|
34
|
+
* the figures are the grid they are from the fold:
|
|
35
|
+
* - the section is narrower than the fold, read off the section itself — a container, not the
|
|
36
|
+
* viewport, as the stylesheet reads it;
|
|
37
|
+
* - there are two figures or more;
|
|
38
|
+
* - the reader has not asked for less motion — the grid is the still version of the same set;
|
|
39
|
+
* - the section is on screen. A wheel nobody can see does not turn, and starts again where it was;
|
|
40
|
+
* - nothing holds or has stopped it — see `hold`.
|
|
41
|
+
*/
|
|
42
|
+
export function useWheel(section, count) {
|
|
43
|
+
const [narrow, setNarrow] = useState(false);
|
|
44
|
+
const [seen, setSeen] = useState(false);
|
|
45
|
+
const [turn, setTurn] = useState(0);
|
|
46
|
+
const [still, setStill] = useState(false);
|
|
47
|
+
/*
|
|
48
|
+
A pointer over the wheel or focus on it holds it for as long as it lasts; a press anywhere on
|
|
49
|
+
it stops it for good — CtaBannerSlider's rule, by way of the WAI carousel pattern: a reader who
|
|
50
|
+
has touched the thing is reading it. Together they are the way to stop a wheel that would
|
|
51
|
+
otherwise turn for as long as it is on screen, which WCAG 2.2.2 asks of anything that moves on
|
|
52
|
+
its own for more than five seconds: the keyboard's way is the wheel's own tab stop, the
|
|
53
|
+
pointer's is resting on it, and a touch screen's is a tap.
|
|
54
|
+
*/
|
|
55
|
+
const [held, setHeld] = useState(false);
|
|
56
|
+
const [stopped, setStopped] = useState(false);
|
|
57
|
+
const wheeling = narrow && count > 1 && !still;
|
|
58
|
+
// Asked live rather than once: a reader who turns on reduced motion mid-visit stops the wheel then.
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
if (typeof window.matchMedia !== 'function')
|
|
61
|
+
return undefined;
|
|
62
|
+
const query = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
63
|
+
const follow = () => setStill(query.matches);
|
|
64
|
+
follow();
|
|
65
|
+
query.addEventListener?.('change', follow);
|
|
66
|
+
return () => query.removeEventListener?.('change', follow);
|
|
67
|
+
}, []);
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
const element = section.current;
|
|
70
|
+
if (element === null || typeof ResizeObserver === 'undefined')
|
|
71
|
+
return undefined;
|
|
72
|
+
const measure = () => {
|
|
73
|
+
const rem = Number.parseFloat(getComputedStyle(document.documentElement).fontSize) || 16;
|
|
74
|
+
// The layout width, not the drawn one: getBoundingClientRect reports the box after
|
|
75
|
+
// transforms, so a section shown scaled down — a thumbnail of the page, a zoomed preview —
|
|
76
|
+
// measured as a phone and turned into the wheel at desktop width. offsetWidth is the width
|
|
77
|
+
// the section is laid out at, the same one its container queries read.
|
|
78
|
+
setNarrow(element.offsetWidth < FOLD_REM * rem);
|
|
79
|
+
};
|
|
80
|
+
measure();
|
|
81
|
+
const observer = new ResizeObserver(measure);
|
|
82
|
+
observer.observe(element);
|
|
83
|
+
return () => observer.disconnect();
|
|
84
|
+
}, [section]);
|
|
85
|
+
useEffect(() => {
|
|
86
|
+
const element = section.current;
|
|
87
|
+
if (element === null || typeof IntersectionObserver === 'undefined')
|
|
88
|
+
return undefined;
|
|
89
|
+
const observer = new IntersectionObserver(([entry]) => setSeen(entry?.isIntersecting ?? false));
|
|
90
|
+
observer.observe(element);
|
|
91
|
+
return () => observer.disconnect();
|
|
92
|
+
}, [section]);
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const element = section.current;
|
|
95
|
+
if (!wheeling || !seen || held || stopped || element === null)
|
|
96
|
+
return undefined;
|
|
97
|
+
const style = getComputedStyle(element);
|
|
98
|
+
const every = (milliseconds(style.getPropertyValue('--motion-duration-hold')) ?? 0) +
|
|
99
|
+
(milliseconds(style.getPropertyValue('--motion-duration-turn')) ?? 0);
|
|
100
|
+
if (every <= 0)
|
|
101
|
+
return undefined;
|
|
102
|
+
const timer = window.setInterval(() => setTurn((at) => at + 1), every);
|
|
103
|
+
return () => window.clearInterval(timer);
|
|
104
|
+
}, [section, wheeling, seen, held, stopped]);
|
|
105
|
+
/** Spread on the wheel's list: what holds it, and what stops it. */
|
|
106
|
+
const hold = {
|
|
107
|
+
onPointerEnter: (event) => {
|
|
108
|
+
if (event.pointerType === 'mouse')
|
|
109
|
+
setHeld(true);
|
|
110
|
+
},
|
|
111
|
+
onPointerLeave: (event) => {
|
|
112
|
+
if (event.pointerType === 'mouse')
|
|
113
|
+
setHeld(false);
|
|
114
|
+
},
|
|
115
|
+
onFocus: () => setHeld(true),
|
|
116
|
+
onBlur: (event) => {
|
|
117
|
+
if (!event.currentTarget.contains(event.relatedTarget))
|
|
118
|
+
setHeld(false);
|
|
119
|
+
},
|
|
120
|
+
onPointerDownCapture: (event) => {
|
|
121
|
+
if (event.isPrimary && (event.pointerType !== 'mouse' || event.button === 0))
|
|
122
|
+
setStopped(true);
|
|
123
|
+
},
|
|
124
|
+
};
|
|
125
|
+
return { wheeling, turn, hold };
|
|
126
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/* GENERATED from steps.contract.json. Do not edit. */
|
|
2
|
+
|
|
3
|
+
:where([data-dds-context="marketing"]) .dds-steps {
|
|
4
|
+
box-sizing: border-box;
|
|
5
|
+
container-type: inline-size;
|
|
6
|
+
display: flex;
|
|
7
|
+
inline-size: 100%;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
overflow-wrap: anywhere;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__inner {
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
inline-size: 100%;
|
|
17
|
+
min-inline-size: 0;
|
|
18
|
+
max-inline-size: var(--size-content-max);
|
|
19
|
+
padding-block: var(--space-section-default);
|
|
20
|
+
padding-inline: var(--space-inset-page);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__split {
|
|
24
|
+
align-items: stretch;
|
|
25
|
+
display: flex;
|
|
26
|
+
min-inline-size: 0;
|
|
27
|
+
column-gap: var(--space-gap-3xl);
|
|
28
|
+
row-gap: var(--space-gap-2xl);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__media {
|
|
32
|
+
min-inline-size: 0;
|
|
33
|
+
overflow: hidden;
|
|
34
|
+
position: relative;
|
|
35
|
+
aspect-ratio: var(--aspect-square);
|
|
36
|
+
border-radius: var(--radius-container);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__image {
|
|
40
|
+
display: block;
|
|
41
|
+
transition-duration: var(--motion-duration-shift);
|
|
42
|
+
transition-timing-function: var(--motion-easing-standard);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__content {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex-direction: column;
|
|
48
|
+
min-inline-size: 0;
|
|
49
|
+
row-gap: var(--space-gap-none);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__title {
|
|
53
|
+
margin-block: 0;
|
|
54
|
+
text-wrap: balance;
|
|
55
|
+
font-family: var(--font-h2-family);
|
|
56
|
+
font-size: var(--font-h2-size);
|
|
57
|
+
font-weight: var(--font-h2-weight);
|
|
58
|
+
letter-spacing: var(--font-h2-letter-spacing);
|
|
59
|
+
line-height: var(--font-h2-line-height);
|
|
60
|
+
margin-block-end: var(--space-heading-content);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__list {
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: column;
|
|
66
|
+
list-style: none;
|
|
67
|
+
margin-block: 0;
|
|
68
|
+
padding-inline-start: 0;
|
|
69
|
+
row-gap: var(--space-gap-none);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__step {
|
|
73
|
+
align-items: flex-start;
|
|
74
|
+
border-block-start-style: solid;
|
|
75
|
+
box-sizing: border-box;
|
|
76
|
+
display: flex;
|
|
77
|
+
position: relative;
|
|
78
|
+
border-width: var(--border-width-default);
|
|
79
|
+
column-gap: var(--space-gap-md);
|
|
80
|
+
padding-block: var(--space-inset-md);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__number {
|
|
84
|
+
flex: none;
|
|
85
|
+
font-variant-numeric: tabular-nums;
|
|
86
|
+
font-family: var(--font-h4-family);
|
|
87
|
+
font-size: var(--font-h4-size);
|
|
88
|
+
font-weight: var(--font-h4-weight);
|
|
89
|
+
letter-spacing: var(--font-h4-letter-spacing);
|
|
90
|
+
line-height: var(--font-h4-line-height);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__body {
|
|
94
|
+
display: flex;
|
|
95
|
+
flex-direction: column;
|
|
96
|
+
min-inline-size: 0;
|
|
97
|
+
row-gap: var(--space-heading-title-description-compact);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__step-title {
|
|
101
|
+
margin-block: 0;
|
|
102
|
+
font-family: var(--font-h5-family);
|
|
103
|
+
font-size: var(--font-h5-size);
|
|
104
|
+
font-weight: var(--font-h5-weight);
|
|
105
|
+
letter-spacing: var(--font-h5-letter-spacing);
|
|
106
|
+
line-height: var(--font-h5-line-height);
|
|
107
|
+
min-block-size: var(--size-target-min);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__trigger {
|
|
111
|
+
transition-property: outline-color, outline-width;
|
|
112
|
+
appearance: none;
|
|
113
|
+
background: none;
|
|
114
|
+
border-style: none;
|
|
115
|
+
color: inherit;
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
font: inherit;
|
|
118
|
+
letter-spacing: inherit;
|
|
119
|
+
outline-style: solid;
|
|
120
|
+
padding: 0;
|
|
121
|
+
text-align: start;
|
|
122
|
+
border-radius: var(--radius-subtle);
|
|
123
|
+
min-block-size: var(--size-target-min);
|
|
124
|
+
min-inline-size: var(--size-target-min);
|
|
125
|
+
outline-width: var(--border-width-none);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__step-description {
|
|
129
|
+
margin-block: 0;
|
|
130
|
+
font-family: var(--font-body-md-family);
|
|
131
|
+
font-size: var(--font-body-md-size);
|
|
132
|
+
font-weight: var(--font-body-md-weight);
|
|
133
|
+
letter-spacing: var(--font-body-md-letter-spacing);
|
|
134
|
+
line-height: var(--font-body-md-line-height);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__progress {
|
|
138
|
+
display: none;
|
|
139
|
+
pointer-events: none;
|
|
140
|
+
position: absolute;
|
|
141
|
+
background-color: var(--color-bg-brand);
|
|
142
|
+
block-size: var(--border-width-strong);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-media-position="end"] .dds-steps__split {
|
|
146
|
+
flex-direction: row-reverse;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-media-position="start"] .dds-steps__split {
|
|
150
|
+
flex-direction: row;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
:where([data-dds-context="marketing"]) .dds-steps .dds-steps__trigger:focus-visible {
|
|
154
|
+
outline-color: var(--color-border-focus);
|
|
155
|
+
outline-width: var(--border-width-focus);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-ground="page"] {
|
|
159
|
+
background-color: var(--color-bg-page);
|
|
160
|
+
color: var(--color-fg-default);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-ground="page"] .dds-steps__number {
|
|
164
|
+
color: var(--color-fg-brand-accent);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-ground="page"] .dds-steps__step {
|
|
168
|
+
border-color: var(--color-border-subtle);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-ground="strong"] {
|
|
172
|
+
background-color: var(--color-bg-brand-strong);
|
|
173
|
+
color: var(--color-fg-on-brand-strong);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-ground="strong"] .dds-steps__number {
|
|
177
|
+
color: var(--color-fg-on-brand-strong);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-ground="strong"] .dds-steps__step {
|
|
181
|
+
border-color: var(--color-border-subtle-inverse);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-ground="subtle"] {
|
|
185
|
+
background-color: var(--color-bg-page);
|
|
186
|
+
background-image: linear-gradient(var(--color-bg-band-subtle), var(--color-bg-band-subtle));
|
|
187
|
+
color: var(--color-fg-default);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-ground="subtle"] .dds-steps__number {
|
|
191
|
+
color: var(--color-fg-brand);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
:where([data-dds-context="marketing"]) .dds-steps[data-ground="subtle"] .dds-steps__step {
|
|
195
|
+
border-color: var(--color-border-subtle);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@media (prefers-reduced-motion: reduce) {
|
|
199
|
+
:where([data-dds-context="marketing"]) .dds-steps,
|
|
200
|
+
:where([data-dds-context="marketing"]) .dds-steps * { transition: none !important; }
|
|
201
|
+
}
|
|
202
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import './Steps.css';
|
|
2
|
+
import './steps-impl.css';
|
|
3
|
+
import '../block-reveal.css';
|
|
4
|
+
import { type StepsProps } from './Steps.types.js';
|
|
5
|
+
export type { StepsProps };
|
|
6
|
+
/**
|
|
7
|
+
* A how-it-works section: one picture beside a numbered list of the steps a reader takes.
|
|
8
|
+
*
|
|
9
|
+
* The numbers are the argument. They say the order matters and how far there is to go, which is
|
|
10
|
+
* what separates this from FeatureBullets — the same split, where every line is included rather
|
|
11
|
+
* than one coming after another. So the list is an `<ol>`, and a screen reader announces the count
|
|
12
|
+
* and each step's place without being told; the large number drawn beside each step is the
|
|
13
|
+
* section's own decoration, hidden from assistive technology so the place is not read twice.
|
|
14
|
+
*
|
|
15
|
+
* The steps are records rather than children, because the number in front of each is drawn from
|
|
16
|
+
* its place in the list and a page composing its own would be a page retyping the order.
|
|
17
|
+
*
|
|
18
|
+
* The picture comes first in the markup and on a phone, which is the reference design's order and
|
|
19
|
+
* the one a sequence reads in: the picture sets the scene the steps then walk through. At full
|
|
20
|
+
* width `mediaPosition` puts it on either side.
|
|
21
|
+
*
|
|
22
|
+
* The reference template also carried `embedded`, which dropped the section for a plain `<div>`
|
|
23
|
+
* inside an article's body, and `titleId`, which let a table of contents target the heading. Both
|
|
24
|
+
* are gone: this package has no article layout to embed into, and a section here is named by its
|
|
25
|
+
* own heading through `aria-labelledby` — a `<section>` is only a region landmark once it has one.
|
|
26
|
+
*
|
|
27
|
+
* With `autoplay` the steps take their turn: one is current, its rule fills, and the next takes
|
|
28
|
+
* over — see `useTurn`. Each title becomes a button that makes its step current, and where every
|
|
29
|
+
* step carries a picture the one beside the list is the current step's. The list is still the
|
|
30
|
+
* ordered list it always is; only which step is drawn as current moves.
|
|
31
|
+
*/
|
|
32
|
+
export declare function Steps({ ground, mediaPosition, autoplay, title, steps, media, }: StepsProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from 'react';
|
|
4
|
+
import './Steps.css';
|
|
5
|
+
import './steps-impl.css';
|
|
6
|
+
import '../block-reveal.css';
|
|
7
|
+
import { arriving, useReveal } from '../use-reveal.js';
|
|
8
|
+
import { given } from '../../given.js';
|
|
9
|
+
import { useTurn } from './use-turn.js';
|
|
10
|
+
import { stepsDefaults, stepsParts } from './Steps.types.js';
|
|
11
|
+
/**
|
|
12
|
+
* A how-it-works section: one picture beside a numbered list of the steps a reader takes.
|
|
13
|
+
*
|
|
14
|
+
* The numbers are the argument. They say the order matters and how far there is to go, which is
|
|
15
|
+
* what separates this from FeatureBullets — the same split, where every line is included rather
|
|
16
|
+
* than one coming after another. So the list is an `<ol>`, and a screen reader announces the count
|
|
17
|
+
* and each step's place without being told; the large number drawn beside each step is the
|
|
18
|
+
* section's own decoration, hidden from assistive technology so the place is not read twice.
|
|
19
|
+
*
|
|
20
|
+
* The steps are records rather than children, because the number in front of each is drawn from
|
|
21
|
+
* its place in the list and a page composing its own would be a page retyping the order.
|
|
22
|
+
*
|
|
23
|
+
* The picture comes first in the markup and on a phone, which is the reference design's order and
|
|
24
|
+
* the one a sequence reads in: the picture sets the scene the steps then walk through. At full
|
|
25
|
+
* width `mediaPosition` puts it on either side.
|
|
26
|
+
*
|
|
27
|
+
* The reference template also carried `embedded`, which dropped the section for a plain `<div>`
|
|
28
|
+
* inside an article's body, and `titleId`, which let a table of contents target the heading. Both
|
|
29
|
+
* are gone: this package has no article layout to embed into, and a section here is named by its
|
|
30
|
+
* own heading through `aria-labelledby` — a `<section>` is only a region landmark once it has one.
|
|
31
|
+
*
|
|
32
|
+
* With `autoplay` the steps take their turn: one is current, its rule fills, and the next takes
|
|
33
|
+
* over — see `useTurn`. Each title becomes a button that makes its step current, and where every
|
|
34
|
+
* step carries a picture the one beside the list is the current step's. The list is still the
|
|
35
|
+
* ordered list it always is; only which step is drawn as current moves.
|
|
36
|
+
*/
|
|
37
|
+
export function Steps({ ground = stepsDefaults.ground, mediaPosition = stepsDefaults.mediaPosition, autoplay = stepsDefaults.autoplay, title, steps, media, }) {
|
|
38
|
+
const titleId = useId();
|
|
39
|
+
const [band, revealed] = useReveal();
|
|
40
|
+
// A step with no name is somebody mid-sentence, not a step. The workbench's own control emits
|
|
41
|
+
// records as they are typed, and a number against nothing is a step the page did not write — so
|
|
42
|
+
// it is dropped before the count is taken, and the numbers close up rather than skipping one.
|
|
43
|
+
const shown = steps.filter((step) => given(step.title));
|
|
44
|
+
const { current, turning, playing, next, choose, section, hold } = useTurn(shown.length, autoplay);
|
|
45
|
+
// The steps' own pictures replace the one picture only where every step has one: a turn that
|
|
46
|
+
// reached a step without a picture would show nothing beside it.
|
|
47
|
+
const pictured = shown.length > 0 && shown.every((step) => given(step.image?.src));
|
|
48
|
+
return (_jsx("section", { className: stepsParts.root, ref: section, "data-ground": ground, "data-media-position": mediaPosition, "data-autoplay": autoplay || undefined, "aria-labelledby": titleId, ...(autoplay ? hold : {}), children: _jsx("div", { className: stepsParts.inner, ref: band, "data-revealed": revealed, children: _jsxs("div", { className: stepsParts.split, children: [_jsx("div", { className: stepsParts.media, ...arriving(0), "aria-hidden": "true", children: pictured
|
|
49
|
+
? shown.map((step, at) => (_jsx("img", { className: stepsParts.image, src: step.image?.src, alt: "", width: step.image?.width, height: step.image?.height, "data-current": at === current, loading: at === 0 ? undefined : 'lazy' }, `${at}:${step.title}`)))
|
|
50
|
+
: media }), _jsxs("div", { className: stepsParts.content, children: [_jsx("h2", { className: stepsParts.title, ...arriving(0), id: titleId, children: title }), _jsx("ol", { className: stepsParts.list, role: "list", "data-turning": autoplay ? turning : undefined, "data-playing": autoplay ? playing : undefined, children: shown.map((step, at) => (
|
|
51
|
+
/* Keyed by the step's own name. An index would key the list by position, so
|
|
52
|
+
removing a step would renumber every row under it and React would reconcile
|
|
53
|
+
the wrong ones; two steps with one name are one step written twice.
|
|
54
|
+
|
|
55
|
+
The position is still what decides the number and when a row arrives — the
|
|
56
|
+
steps come up in the order they are taken, behind the title and the picture. */
|
|
57
|
+
_jsxs("li", { className: stepsParts.step, "data-current": autoplay ? at === current : undefined, ...arriving(2 + at), children: [_jsx("span", { className: stepsParts.number, "aria-hidden": "true", children: at + 1 }), _jsxs("div", { className: stepsParts.body, children: [_jsx("h3", { className: stepsParts['step-title'], children: autoplay ? (_jsx("button", { type: "button", className: stepsParts.trigger, "aria-current": at === current ? 'step' : undefined, onClick: () => choose(at), children: step.title })) : (step.title) }), _jsx("p", { className: stepsParts['step-description'], children: step.description })] }), _jsx("span", { className: stepsParts.progress, "aria-hidden": "true", ref: at === current && playing
|
|
58
|
+
? (element) => {
|
|
59
|
+
if (!element)
|
|
60
|
+
return;
|
|
61
|
+
element.addEventListener('animationend', next);
|
|
62
|
+
return () => element.removeEventListener('animationend', next);
|
|
63
|
+
}
|
|
64
|
+
: undefined })] }, `${at}:${step.title}`))) })] })] }) }) }));
|
|
65
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { StepsItem } from '../../steps-data.js';
|
|
3
|
+
export interface StepsOwnProps {
|
|
4
|
+
/**
|
|
5
|
+
* `page` — The default, and the page's own white. A section that has nothing to separate itself from what is above it — most of them
|
|
6
|
+
* `subtle` — A quiet step off the page, for a band that wants to read as its own section without changing the page's voice. The reference design paints this section grey, and a page following it closely takes this. Painted as the band's tint laid over the page's own ground, so it is the same grey whatever is behind the section.
|
|
7
|
+
* `strong` — `color.bg.brand-strong`, the dark band. It stops the page rather than dividing it, so it is for a section a reader should arrive at — and one per page is usually one more than enough
|
|
8
|
+
*/
|
|
9
|
+
ground?: 'page' | 'subtle' | 'strong';
|
|
10
|
+
/**
|
|
11
|
+
* `start` — The default, and the reference design's: the picture first, then the steps it introduces
|
|
12
|
+
* `end` — The steps first, for a section sitting under a split whose picture is already at the start
|
|
13
|
+
*/
|
|
14
|
+
mediaPosition?: 'start' | 'end';
|
|
15
|
+
/** Whether the steps take their turn on their own: one step is current, its rule fills over motion.duration.dwell, then the next takes over, and back to the first after the last. The current step's number is drawn at full strength and the rest recede; with an `image` on each step the picture changes to the current one's. Each step's title becomes a button that makes it current. Off by default, so a list nobody configured stays still. On, it holds while the pointer is over the section or focus is inside it, waits until the section is on screen, never moves for a reader who asked for less motion, and stops for good once the reader presses a step — the WAI carousel rule CtaBannerSlider follows: a reader who has chosen a step is reading it. That gives a reader a way to stop it, which WCAG 2.2.2 asks for, but not a visible one, so a page that needs 2.2.2 met plainly should leave it off. */
|
|
16
|
+
autoplay?: boolean;
|
|
17
|
+
/** Always. What the steps get a reader to, in the fewest words that say it — 'Get started in 3 steps' */
|
|
18
|
+
title: string;
|
|
19
|
+
/** Always. The steps, in the order a reader takes them — three or four is right, six the most. Each is a short imperative and a sentence under about two hundred characters. The number in front of each is drawn from its place in the list, so reordering the list renumbers it. Give each step an `image` — a screenshot of that step — and the picture beside the list is the current step's: the first while the list is still, and each in turn under `autoplay`. */
|
|
20
|
+
steps: StepsItem[];
|
|
21
|
+
/** The one picture beside the steps, where they have no pictures of their own — a screenshot, a photograph. The section is a split and the picture is one half of it: give this or an `image` on each step, because without either the list runs to a measure it was never sized for. Steps that carry their own pictures win over this. */
|
|
22
|
+
media?: ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export type StepsProps = StepsOwnProps;
|
|
25
|
+
/** The class each part carries. Apply these — do not retype them. */
|
|
26
|
+
export declare const stepsParts: {
|
|
27
|
+
readonly root: "dds-steps";
|
|
28
|
+
readonly inner: "dds-steps__inner";
|
|
29
|
+
readonly split: "dds-steps__split";
|
|
30
|
+
readonly media: "dds-steps__media";
|
|
31
|
+
readonly image: "dds-steps__image";
|
|
32
|
+
readonly content: "dds-steps__content";
|
|
33
|
+
readonly title: "dds-steps__title";
|
|
34
|
+
readonly list: "dds-steps__list";
|
|
35
|
+
readonly step: "dds-steps__step";
|
|
36
|
+
readonly number: "dds-steps__number";
|
|
37
|
+
readonly body: "dds-steps__body";
|
|
38
|
+
readonly 'step-title': "dds-steps__step-title";
|
|
39
|
+
readonly trigger: "dds-steps__trigger";
|
|
40
|
+
readonly 'step-description': "dds-steps__step-description";
|
|
41
|
+
readonly progress: "dds-steps__progress";
|
|
42
|
+
};
|
|
43
|
+
/** Generated so defaults cannot drift from the contract. */
|
|
44
|
+
export declare const stepsDefaults: {
|
|
45
|
+
readonly ground: "page";
|
|
46
|
+
readonly mediaPosition: "start";
|
|
47
|
+
readonly autoplay: false;
|
|
48
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// GENERATED from steps.contract.json. Do not edit.
|
|
2
|
+
/** The class each part carries. Apply these — do not retype them. */
|
|
3
|
+
export const stepsParts = {
|
|
4
|
+
root: 'dds-steps',
|
|
5
|
+
inner: 'dds-steps__inner',
|
|
6
|
+
split: 'dds-steps__split',
|
|
7
|
+
media: 'dds-steps__media',
|
|
8
|
+
image: 'dds-steps__image',
|
|
9
|
+
content: 'dds-steps__content',
|
|
10
|
+
title: 'dds-steps__title',
|
|
11
|
+
list: 'dds-steps__list',
|
|
12
|
+
step: 'dds-steps__step',
|
|
13
|
+
number: 'dds-steps__number',
|
|
14
|
+
body: 'dds-steps__body',
|
|
15
|
+
'step-title': 'dds-steps__step-title',
|
|
16
|
+
trigger: 'dds-steps__trigger',
|
|
17
|
+
'step-description': 'dds-steps__step-description',
|
|
18
|
+
progress: 'dds-steps__progress',
|
|
19
|
+
};
|
|
20
|
+
/** Generated so defaults cannot drift from the contract. */
|
|
21
|
+
export const stepsDefaults = { ground: 'page', mediaPosition: 'start', autoplay: false };
|