@tempoxyz/ds 0.3.18 → 0.3.20
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/dist/arsenal/icons/Icon.d.ts +57 -0
- package/dist/arsenal/icons/Icon.d.ts.map +1 -0
- package/dist/arsenal/icons/Icon.js +117 -0
- package/dist/arsenal/icons/Icon.js.map +1 -0
- package/dist/arsenal/icons/glyphs.d.ts +5238 -0
- package/dist/arsenal/icons/glyphs.d.ts.map +1 -0
- package/dist/arsenal/icons/glyphs.js +2888 -0
- package/dist/arsenal/icons/glyphs.js.map +1 -0
- package/dist/arsenal/icons/index.d.ts +4 -0
- package/dist/arsenal/icons/index.d.ts.map +1 -0
- package/dist/arsenal/icons/index.js +4 -0
- package/dist/arsenal/icons/index.js.map +1 -0
- package/dist/docs/AGENTS.md +2 -2
- package/dist/docs/arsenal.md +4555 -0
- package/dist/docs/marketing.md +7082 -480
- package/dist/docs/product/documents.md +17 -1
- package/dist/document/Document.d.ts +1 -1
- package/dist/document/Document.d.ts.map +1 -1
- package/dist/document/Document.js +1 -0
- package/dist/document/Document.js.map +1 -1
- package/dist/document/document.css +12 -1
- package/dist/document/templates/brief.html +3 -3
- package/dist/document/templates/essay.html +3 -3
- package/dist/document/templates/post.html +3 -3
- package/dist/marketing/components/ArticleBody.css +1 -0
- package/dist/marketing/components/ArticleBody.d.ts +1013 -0
- package/dist/marketing/components/ArticleBody.d.ts.map +1 -0
- package/dist/marketing/components/ArticleBody.js +120 -0
- package/dist/marketing/components/ArticleBody.js.map +1 -0
- package/dist/marketing/components/ArticleBody.js.zyzz.json +1 -0
- package/dist/marketing/components/ArticleHero.css +1 -0
- package/dist/marketing/components/ArticleHero.d.ts +168 -0
- package/dist/marketing/components/ArticleHero.d.ts.map +1 -0
- package/dist/marketing/components/ArticleHero.js +74 -0
- package/dist/marketing/components/ArticleHero.js.map +1 -0
- package/dist/marketing/components/ArticleHero.js.zyzz.json +1 -0
- package/dist/marketing/components/ArticleIndex.css +1 -0
- package/dist/marketing/components/ArticleIndex.d.ts +164 -0
- package/dist/marketing/components/ArticleIndex.d.ts.map +1 -0
- package/dist/marketing/components/ArticleIndex.js +100 -0
- package/dist/marketing/components/ArticleIndex.js.map +1 -0
- package/dist/marketing/components/ArticleIndex.js.zyzz.json +1 -0
- package/dist/marketing/components/ArticleRail.css +1 -0
- package/dist/marketing/components/ArticleRail.d.ts +105 -0
- package/dist/marketing/components/ArticleRail.d.ts.map +1 -0
- package/dist/marketing/components/ArticleRail.js +96 -0
- package/dist/marketing/components/ArticleRail.js.map +1 -0
- package/dist/marketing/components/ArticleRail.js.zyzz.json +1 -0
- package/dist/marketing/components/AsideLayout.css +1 -0
- package/dist/marketing/components/AsideLayout.d.ts +39 -0
- package/dist/marketing/components/AsideLayout.d.ts.map +1 -0
- package/dist/marketing/components/AsideLayout.js +24 -0
- package/dist/marketing/components/AsideLayout.js.map +1 -0
- package/dist/marketing/components/AsideLayout.js.zyzz.json +1 -0
- package/dist/marketing/components/Breadcrumbs.css +1 -0
- package/dist/marketing/components/Breadcrumbs.d.ts +132 -0
- package/dist/marketing/components/Breadcrumbs.d.ts.map +1 -0
- package/dist/marketing/components/Breadcrumbs.js +75 -0
- package/dist/marketing/components/Breadcrumbs.js.map +1 -0
- package/dist/marketing/components/Breadcrumbs.js.zyzz.json +1 -0
- package/dist/marketing/components/Button.css +1 -0
- package/dist/marketing/components/Button.d.ts +421 -0
- package/dist/marketing/components/Button.d.ts.map +1 -0
- package/dist/marketing/components/Button.js +87 -0
- package/dist/marketing/components/Button.js.map +1 -0
- package/dist/marketing/components/Button.js.zyzz.json +1 -0
- package/dist/marketing/components/Card.css +1 -0
- package/dist/marketing/components/Card.d.ts +563 -0
- package/dist/marketing/components/Card.d.ts.map +1 -0
- package/dist/marketing/components/Card.js +171 -0
- package/dist/marketing/components/Card.js.map +1 -0
- package/dist/marketing/components/Card.js.zyzz.json +1 -0
- package/dist/marketing/components/Contact.css +1 -0
- package/dist/marketing/components/Contact.d.ts +51 -0
- package/dist/marketing/components/Contact.d.ts.map +1 -0
- package/dist/marketing/components/Contact.js +44 -0
- package/dist/marketing/components/Contact.js.map +1 -0
- package/dist/marketing/components/Contact.js.zyzz.json +1 -0
- package/dist/marketing/components/Cta.css +1 -0
- package/dist/marketing/components/Cta.d.ts +138 -0
- package/dist/marketing/components/Cta.d.ts.map +1 -0
- package/dist/marketing/components/Cta.js +71 -0
- package/dist/marketing/components/Cta.js.map +1 -0
- package/dist/marketing/components/Cta.js.zyzz.json +1 -0
- package/dist/marketing/components/CustomerStoryFeature.css +1 -0
- package/dist/marketing/components/CustomerStoryFeature.d.ts +48 -0
- package/dist/marketing/components/CustomerStoryFeature.d.ts.map +1 -0
- package/dist/marketing/components/CustomerStoryFeature.js +58 -0
- package/dist/marketing/components/CustomerStoryFeature.js.map +1 -0
- package/dist/marketing/components/CustomerStoryFeature.js.zyzz.json +1 -0
- package/dist/marketing/components/Faq.css +1 -0
- package/dist/marketing/components/Faq.d.ts +99 -0
- package/dist/marketing/components/Faq.d.ts.map +1 -0
- package/dist/marketing/components/Faq.js +83 -0
- package/dist/marketing/components/Faq.js.map +1 -0
- package/dist/marketing/components/Faq.js.zyzz.json +1 -0
- package/dist/marketing/components/FeatureAccordion.css +1 -0
- package/dist/marketing/components/FeatureAccordion.d.ts +230 -0
- package/dist/marketing/components/FeatureAccordion.d.ts.map +1 -0
- package/dist/marketing/components/FeatureAccordion.js +117 -0
- package/dist/marketing/components/FeatureAccordion.js.map +1 -0
- package/dist/marketing/components/FeatureAccordion.js.zyzz.json +1 -0
- package/dist/marketing/components/Footer.css +1 -0
- package/dist/marketing/components/Footer.d.ts +178 -0
- package/dist/marketing/components/Footer.d.ts.map +1 -0
- package/dist/marketing/components/Footer.js +109 -0
- package/dist/marketing/components/Footer.js.map +1 -0
- package/dist/marketing/components/Footer.js.zyzz.json +1 -0
- package/dist/marketing/components/Hero.css +1 -0
- package/dist/marketing/components/Hero.d.ts +200 -0
- package/dist/marketing/components/Hero.d.ts.map +1 -0
- package/dist/marketing/components/Hero.js +67 -0
- package/dist/marketing/components/Hero.js.map +1 -0
- package/dist/marketing/components/Hero.js.zyzz.json +1 -0
- package/dist/marketing/components/LeadCapture.css +1 -0
- package/dist/marketing/components/LeadCapture.d.ts +102 -0
- package/dist/marketing/components/LeadCapture.d.ts.map +1 -0
- package/dist/marketing/components/LeadCapture.js +78 -0
- package/dist/marketing/components/LeadCapture.js.map +1 -0
- package/dist/marketing/components/LeadCapture.js.zyzz.json +1 -0
- package/dist/marketing/components/Link.css +1 -0
- package/dist/marketing/components/Link.d.ts +342 -0
- package/dist/marketing/components/Link.d.ts.map +1 -0
- package/dist/marketing/components/Link.js +152 -0
- package/dist/marketing/components/Link.js.map +1 -0
- package/dist/marketing/components/Link.js.zyzz.json +1 -0
- package/dist/marketing/components/Logo.css +1 -0
- package/dist/marketing/components/Logo.d.ts +30 -0
- package/dist/marketing/components/Logo.d.ts.map +1 -0
- package/dist/marketing/components/Logo.js +38 -0
- package/dist/marketing/components/Logo.js.map +1 -0
- package/dist/marketing/components/Logo.js.zyzz.json +1 -0
- package/dist/marketing/components/LogoWall.css +1 -0
- package/dist/marketing/components/LogoWall.d.ts +156 -0
- package/dist/marketing/components/LogoWall.d.ts.map +1 -0
- package/dist/marketing/components/LogoWall.js +41 -0
- package/dist/marketing/components/LogoWall.js.map +1 -0
- package/dist/marketing/components/LogoWall.js.zyzz.json +1 -0
- package/dist/marketing/components/Mark.css +1 -0
- package/dist/marketing/components/Mark.d.ts +30 -0
- package/dist/marketing/components/Mark.d.ts.map +1 -0
- package/dist/marketing/components/Mark.js +38 -0
- package/dist/marketing/components/Mark.js.map +1 -0
- package/dist/marketing/components/Mark.js.zyzz.json +1 -0
- package/dist/marketing/components/Media.css +1 -0
- package/dist/marketing/components/Media.d.ts +74 -0
- package/dist/marketing/components/Media.d.ts.map +1 -0
- package/dist/marketing/components/Media.js +80 -0
- package/dist/marketing/components/Media.js.map +1 -0
- package/dist/marketing/components/Media.js.zyzz.json +1 -0
- package/dist/marketing/components/Nav.css +1 -0
- package/dist/marketing/components/Nav.d.ts +303 -0
- package/dist/marketing/components/Nav.d.ts.map +1 -0
- package/dist/marketing/components/Nav.js +166 -0
- package/dist/marketing/components/Nav.js.map +1 -0
- package/dist/marketing/components/Nav.js.zyzz.json +1 -0
- package/dist/marketing/components/PartnersIndex.css +1 -0
- package/dist/marketing/components/PartnersIndex.d.ts +267 -0
- package/dist/marketing/components/PartnersIndex.d.ts.map +1 -0
- package/dist/marketing/components/PartnersIndex.js +96 -0
- package/dist/marketing/components/PartnersIndex.js.map +1 -0
- package/dist/marketing/components/PartnersIndex.js.zyzz.json +1 -0
- package/dist/marketing/components/QuoteBand.css +1 -0
- package/dist/marketing/components/QuoteBand.d.ts +128 -0
- package/dist/marketing/components/QuoteBand.d.ts.map +1 -0
- package/dist/marketing/components/QuoteBand.js +73 -0
- package/dist/marketing/components/QuoteBand.js.map +1 -0
- package/dist/marketing/components/QuoteBand.js.zyzz.json +1 -0
- package/dist/marketing/components/Section.css +1 -0
- package/dist/marketing/components/Section.d.ts +132 -0
- package/dist/marketing/components/Section.d.ts.map +1 -0
- package/dist/marketing/components/Section.js +33 -0
- package/dist/marketing/components/Section.js.map +1 -0
- package/dist/marketing/components/Section.js.zyzz.json +1 -0
- package/dist/marketing/components/SectionHeading.css +1 -0
- package/dist/marketing/components/SectionHeading.d.ts +215 -0
- package/dist/marketing/components/SectionHeading.d.ts.map +1 -0
- package/dist/marketing/components/SectionHeading.js +48 -0
- package/dist/marketing/components/SectionHeading.js.map +1 -0
- package/dist/marketing/components/SectionHeading.js.zyzz.json +1 -0
- package/dist/marketing/components/Showcase.css +1 -0
- package/dist/marketing/components/Showcase.d.ts +269 -0
- package/dist/marketing/components/Showcase.d.ts.map +1 -0
- package/dist/marketing/components/Showcase.js +67 -0
- package/dist/marketing/components/Showcase.js.map +1 -0
- package/dist/marketing/components/Showcase.js.zyzz.json +1 -0
- package/dist/marketing/components/Stats.css +1 -0
- package/dist/marketing/components/Stats.d.ts +133 -0
- package/dist/marketing/components/Stats.d.ts.map +1 -0
- package/dist/marketing/components/Stats.js +34 -0
- package/dist/marketing/components/Stats.js.map +1 -0
- package/dist/marketing/components/Stats.js.zyzz.json +1 -0
- package/dist/marketing/components/Steps.css +1 -0
- package/dist/marketing/components/Steps.d.ts +53 -0
- package/dist/marketing/components/Steps.d.ts.map +1 -0
- package/dist/marketing/components/Steps.js +78 -0
- package/dist/marketing/components/Steps.js.map +1 -0
- package/dist/marketing/components/Steps.js.zyzz.json +1 -0
- package/dist/marketing/components/SymbolTile.css +1 -0
- package/dist/marketing/components/SymbolTile.d.ts +85 -0
- package/dist/marketing/components/SymbolTile.d.ts.map +1 -0
- package/dist/marketing/components/SymbolTile.js +35 -0
- package/dist/marketing/components/SymbolTile.js.map +1 -0
- package/dist/marketing/components/SymbolTile.js.zyzz.json +1 -0
- package/dist/marketing/components/Tab.css +1 -0
- package/dist/marketing/components/Tab.d.ts +280 -0
- package/dist/marketing/components/Tab.d.ts.map +1 -0
- package/dist/marketing/components/Tab.js +43 -0
- package/dist/marketing/components/Tab.js.map +1 -0
- package/dist/marketing/components/Tab.js.zyzz.json +1 -0
- package/dist/marketing/components/Table.css +1 -0
- package/dist/marketing/components/Table.d.ts +157 -0
- package/dist/marketing/components/Table.d.ts.map +1 -0
- package/dist/marketing/components/Table.js +80 -0
- package/dist/marketing/components/Table.js.map +1 -0
- package/dist/marketing/components/Table.js.zyzz.json +1 -0
- package/dist/marketing/components/Tag.css +1 -0
- package/dist/marketing/components/Tag.d.ts +254 -0
- package/dist/marketing/components/Tag.d.ts.map +1 -0
- package/dist/marketing/components/Tag.js +59 -0
- package/dist/marketing/components/Tag.js.map +1 -0
- package/dist/marketing/components/Tag.js.zyzz.json +1 -0
- package/dist/marketing/components/internal/Links.d.ts +9 -0
- package/dist/marketing/components/internal/Links.d.ts.map +1 -0
- package/dist/marketing/components/internal/Links.js +15 -0
- package/dist/marketing/components/internal/Links.js.map +1 -0
- package/dist/marketing/icons/ArrowUpRight.d.ts +6 -0
- package/dist/marketing/icons/ArrowUpRight.d.ts.map +1 -0
- package/dist/marketing/icons/ArrowUpRight.js +5 -0
- package/dist/marketing/icons/ArrowUpRight.js.map +1 -0
- package/dist/marketing/icons/Checkmark.d.ts +6 -0
- package/dist/marketing/icons/Checkmark.d.ts.map +1 -0
- package/dist/marketing/icons/Checkmark.js +5 -0
- package/dist/marketing/icons/Checkmark.js.map +1 -0
- package/dist/marketing/icons/ChevronRight.d.ts +6 -0
- package/dist/marketing/icons/ChevronRight.d.ts.map +1 -0
- package/dist/marketing/icons/ChevronRight.js +5 -0
- package/dist/marketing/icons/ChevronRight.js.map +1 -0
- package/dist/marketing/icons/Link.d.ts +6 -0
- package/dist/marketing/icons/Link.d.ts.map +1 -0
- package/dist/marketing/icons/Link.js +5 -0
- package/dist/marketing/icons/Link.js.map +1 -0
- package/dist/marketing/icons/Play.d.ts +6 -0
- package/dist/marketing/icons/Play.d.ts.map +1 -0
- package/dist/marketing/icons/Play.js +5 -0
- package/dist/marketing/icons/Play.js.map +1 -0
- package/dist/marketing/icons/Spinner.d.ts +6 -0
- package/dist/marketing/icons/Spinner.d.ts.map +1 -0
- package/dist/marketing/icons/Spinner.js +5 -0
- package/dist/marketing/icons/Spinner.js.map +1 -0
- package/dist/marketing/icons/Xmark.d.ts +6 -0
- package/dist/marketing/icons/Xmark.d.ts.map +1 -0
- package/dist/marketing/icons/Xmark.js +5 -0
- package/dist/marketing/icons/Xmark.js.map +1 -0
- package/dist/marketing/index.d.ts +34 -1
- package/dist/marketing/index.d.ts.map +1 -1
- package/dist/marketing/index.js +34 -1
- package/dist/marketing/index.js.map +1 -1
- package/dist/marketing/index.js.zyzz.json +1 -1
- package/package.json +8 -2
- package/src/arsenal/icons/CATALOGUE.md +471 -0
- package/src/arsenal/icons/CHANGELOG.md +181 -0
- package/src/arsenal/icons/Icon.tsx +187 -0
- package/src/arsenal/icons/README.md +53 -0
- package/src/arsenal/icons/glyphs.ts +2901 -0
- package/src/arsenal/icons/index.ts +12 -0
- package/src/document/Document.ts +1 -0
- package/src/document/document.css +12 -1
- package/src/marketing/README.md +13 -1
- package/src/marketing/components/ArticleBody.tsx +784 -0
- package/src/marketing/components/ArticleHero.tsx +331 -0
- package/src/marketing/components/ArticleIndex.tsx +457 -0
- package/src/marketing/components/ArticleRail.tsx +384 -0
- package/src/marketing/components/AsideLayout.tsx +52 -0
- package/src/marketing/components/Breadcrumbs.tsx +197 -0
- package/src/marketing/components/Button.tsx +469 -0
- package/src/marketing/components/Card.tsx +865 -0
- package/src/marketing/components/Contact.tsx +157 -0
- package/src/marketing/components/Cta.tsx +297 -0
- package/src/marketing/components/CustomerStoryFeature.tsx +218 -0
- package/src/marketing/components/Faq.tsx +334 -0
- package/src/marketing/components/FeatureAccordion.tsx +459 -0
- package/src/marketing/components/Footer.tsx +440 -0
- package/src/marketing/components/Hero.tsx +275 -0
- package/src/marketing/components/LeadCapture.tsx +322 -0
- package/src/marketing/components/Link.tsx +508 -0
- package/src/marketing/components/Logo.tsx +71 -0
- package/src/marketing/components/LogoWall.tsx +185 -0
- package/src/marketing/components/Mark.tsx +67 -0
- package/src/marketing/components/Media.tsx +275 -0
- package/src/marketing/components/Nav.tsx +1030 -0
- package/src/marketing/components/PartnersIndex.tsx +448 -0
- package/src/marketing/components/QuoteBand.tsx +288 -0
- package/src/marketing/components/Section.tsx +110 -0
- package/src/marketing/components/SectionHeading.tsx +227 -0
- package/src/marketing/components/Showcase.tsx +301 -0
- package/src/marketing/components/Stats.tsx +130 -0
- package/src/marketing/components/Steps.tsx +215 -0
- package/src/marketing/components/SymbolTile.tsx +89 -0
- package/src/marketing/components/Tab.tsx +306 -0
- package/src/marketing/components/Table.tsx +255 -0
- package/src/marketing/components/Tag.tsx +289 -0
- package/src/marketing/components/internal/Links.ts +19 -0
- package/src/marketing/icons/ArrowUpRight.tsx +25 -0
- package/src/marketing/icons/Checkmark.tsx +25 -0
- package/src/marketing/icons/ChevronRight.tsx +25 -0
- package/src/marketing/icons/Link.tsx +25 -0
- package/src/marketing/icons/Play.tsx +25 -0
- package/src/marketing/icons/Spinner.tsx +25 -0
- package/src/marketing/icons/Xmark.tsx +25 -0
- package/src/marketing/index.ts +34 -1
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
/** Renders the Marketing feature accordion: one feature open at a time, with its art beside it. @module */
|
|
2
|
+
import * as BaseUi from '@base-ui/react/accordion'
|
|
3
|
+
import {
|
|
4
|
+
type ComponentPropsWithRef,
|
|
5
|
+
type KeyboardEvent,
|
|
6
|
+
type ReactNode,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
useSyncExternalStore,
|
|
10
|
+
} from 'react'
|
|
11
|
+
import type * as zyzz from 'zyzz'
|
|
12
|
+
import { style, variants } from '../zyzz.config.js'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Rows of features, each a name, a line and an optional link, beside the open row's art from
|
|
16
|
+
* 1024px. One row is open at a time, built on Base UI Accordion: each name is a `<button>` with
|
|
17
|
+
* `aria-expanded` inside an `<h3>`, and pressing it opens its row and closes the last one. Below
|
|
18
|
+
* 1024px every row stands open with its art under its text, and the names are plain headings.
|
|
19
|
+
*
|
|
20
|
+
* - Use it for Home's products, each with its art and a link to its page, or for a product's three
|
|
21
|
+
* capabilities with `variant="capabilities"`.
|
|
22
|
+
* - Write each `description` as one sentence, and end a row with a Marketing `Link` in `link`.
|
|
23
|
+
* - Pass decorative art in `media`. The art is hidden from assistive technology, so the name and
|
|
24
|
+
* description carry the meaning.
|
|
25
|
+
* - Place it in a `Section` under a `SectionHeading`.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* <FeatureAccordion
|
|
29
|
+
* items={[
|
|
30
|
+
* { description: 'Hold stablecoins and earn yield.', media: <Art />, title: 'Earn' },
|
|
31
|
+
* { description: 'Send payments across borders.', media: <Art />, title: 'Routes' },
|
|
32
|
+
* ]}
|
|
33
|
+
* />
|
|
34
|
+
*
|
|
35
|
+
* @see {@link https://base-ui.com/react/components/accordion | Base UI Accordion}
|
|
36
|
+
* @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/accordion/ | WAI-ARIA APG Accordion pattern}
|
|
37
|
+
*/
|
|
38
|
+
export function FeatureAccordion(props: FeatureAccordion.Props) {
|
|
39
|
+
const {
|
|
40
|
+
className,
|
|
41
|
+
defaultValue,
|
|
42
|
+
items,
|
|
43
|
+
onValueChange,
|
|
44
|
+
value: controlled,
|
|
45
|
+
variant,
|
|
46
|
+
vars,
|
|
47
|
+
...attributes
|
|
48
|
+
} = props
|
|
49
|
+
|
|
50
|
+
const wide = useSyncExternalStore(subscribe, matches, () => true)
|
|
51
|
+
const values = items.map((item, index) => item.value ?? String(index))
|
|
52
|
+
const [uncontrolled, setUncontrolled] = useState(defaultValue ?? values[0])
|
|
53
|
+
const value = controlled ?? uncontrolled
|
|
54
|
+
const triggers = useRef<(HTMLElement | null)[]>([])
|
|
55
|
+
|
|
56
|
+
// The row just left, so its art drifts up as the next row's art rises. Adjusted while rendering,
|
|
57
|
+
// so a controlled `value` sets it too.
|
|
58
|
+
const [shown, setShown] = useState<{ current?: string | undefined; left?: string | undefined }>({
|
|
59
|
+
current: value,
|
|
60
|
+
})
|
|
61
|
+
if (shown.current !== value) setShown({ current: value, left: shown.current })
|
|
62
|
+
|
|
63
|
+
function select(next: string) {
|
|
64
|
+
if (next === value) return
|
|
65
|
+
setUncontrolled(next)
|
|
66
|
+
onValueChange?.(next)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// Up and Down move to the row before or after and open it, and Home and End jump to the first
|
|
70
|
+
// and last. Base UI Accordion leaves arrow keys to the page, after the APG update.
|
|
71
|
+
function navigate(event: KeyboardEvent<HTMLButtonElement>, index: number) {
|
|
72
|
+
const last = items.length - 1
|
|
73
|
+
const next = (() => {
|
|
74
|
+
if (event.key === 'ArrowDown') return Math.min(last, index + 1)
|
|
75
|
+
if (event.key === 'ArrowUp') return Math.max(0, index - 1)
|
|
76
|
+
if (event.key === 'Home') return 0
|
|
77
|
+
if (event.key === 'End') return last
|
|
78
|
+
return undefined
|
|
79
|
+
})()
|
|
80
|
+
if (next === undefined) return
|
|
81
|
+
|
|
82
|
+
event.preventDefault()
|
|
83
|
+
triggers.current[next]?.focus()
|
|
84
|
+
select(values[next]!)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!wide)
|
|
88
|
+
return (
|
|
89
|
+
<div {...attributes} {...styles.root({ className, style: props.style, variant, vars })}>
|
|
90
|
+
<div {...styles.list()}>
|
|
91
|
+
{items.map((item, index) => (
|
|
92
|
+
<div data-open="" key={values[index]}>
|
|
93
|
+
<h3 {...styles.name({ variant })}>{item.title}</h3>
|
|
94
|
+
<div {...styles.body({ variant })}>
|
|
95
|
+
<p {...styles.description()}>{item.description}</p>
|
|
96
|
+
{item.link}
|
|
97
|
+
</div>
|
|
98
|
+
<div aria-hidden="true" {...styles.media({ variant })}>
|
|
99
|
+
<div {...styles.art()}>{item.media}</div>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
))}
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<BaseUi.Accordion.Root
|
|
109
|
+
{...attributes}
|
|
110
|
+
{...styles.root({ className, style: props.style, variant, vars })}
|
|
111
|
+
hiddenUntilFound
|
|
112
|
+
// A press on the open row would close it, so only a change to another row passes.
|
|
113
|
+
onValueChange={(next) => {
|
|
114
|
+
const [first] = next
|
|
115
|
+
if (typeof first === 'string') select(first)
|
|
116
|
+
}}
|
|
117
|
+
value={value === undefined ? [] : [value]}
|
|
118
|
+
>
|
|
119
|
+
<div {...styles.list()}>
|
|
120
|
+
{items.map((item, index) => (
|
|
121
|
+
<BaseUi.Accordion.Item
|
|
122
|
+
data-leaving={shown.left === values[index] && value !== values[index] ? '' : undefined}
|
|
123
|
+
key={values[index]}
|
|
124
|
+
value={values[index]}
|
|
125
|
+
>
|
|
126
|
+
<BaseUi.Accordion.Header {...styles.name({ variant })}>
|
|
127
|
+
<BaseUi.Accordion.Trigger
|
|
128
|
+
onKeyDown={(event) => navigate(event, index)}
|
|
129
|
+
ref={(element) => {
|
|
130
|
+
triggers.current[index] = element
|
|
131
|
+
}}
|
|
132
|
+
{...styles.trigger()}
|
|
133
|
+
>
|
|
134
|
+
{item.title}
|
|
135
|
+
</BaseUi.Accordion.Trigger>
|
|
136
|
+
</BaseUi.Accordion.Header>
|
|
137
|
+
<BaseUi.Accordion.Panel {...styles.panel()}>
|
|
138
|
+
<div {...styles.body({ variant })}>
|
|
139
|
+
<p {...styles.description()}>{item.description}</p>
|
|
140
|
+
{item.link}
|
|
141
|
+
</div>
|
|
142
|
+
</BaseUi.Accordion.Panel>
|
|
143
|
+
<div aria-hidden="true" {...styles.media({ variant })}>
|
|
144
|
+
<div {...styles.art()}>{item.media}</div>
|
|
145
|
+
</div>
|
|
146
|
+
</BaseUi.Accordion.Item>
|
|
147
|
+
))}
|
|
148
|
+
</div>
|
|
149
|
+
</BaseUi.Accordion.Root>
|
|
150
|
+
)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export namespace FeatureAccordion {
|
|
154
|
+
/** One feature row. */
|
|
155
|
+
export type Item = {
|
|
156
|
+
/** The line under the name, as one sentence. */
|
|
157
|
+
description: ReactNode
|
|
158
|
+
/** A Marketing `Link` that ends the row, such as Explore Earn. Absent when the row links nowhere. */
|
|
159
|
+
link?: ReactNode | undefined
|
|
160
|
+
/**
|
|
161
|
+
* Decorative art for the row, hidden from assistive technology. It fills a 1:1 frame below
|
|
162
|
+
* 768px, 16:9 from 768px, and 3:2 from 1024px in `capabilities`. Its frame carries `data-open`
|
|
163
|
+
* on its row while open, so art can start its own motion with an `[data-open] &` selector.
|
|
164
|
+
*/
|
|
165
|
+
media: ReactNode
|
|
166
|
+
/** The feature's name, such as Earn. */
|
|
167
|
+
title: string
|
|
168
|
+
/** Identifies the row in `value`. Defaults to the row's index as a string. */
|
|
169
|
+
value?: string | undefined
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export type Props = Omit<ComponentPropsWithRef<'div'>, 'children' | 'defaultValue'> &
|
|
173
|
+
zyzz.Props.Variants<typeof styles.root> & {
|
|
174
|
+
/** The row open at first, when `value` is not set. Defaults to the first row. */
|
|
175
|
+
defaultValue?: string | undefined
|
|
176
|
+
/** The rows, in order. */
|
|
177
|
+
items: readonly Item[]
|
|
178
|
+
/** Called with the row that opens, by press or arrow key. */
|
|
179
|
+
onValueChange?: ((value: string) => void) | undefined
|
|
180
|
+
/** The open row, for a controlled accordion. */
|
|
181
|
+
value?: string | undefined
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const query = '(min-width: 1024px)'
|
|
186
|
+
|
|
187
|
+
function matches() {
|
|
188
|
+
return matchMedia(query).matches
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function subscribe(onChange: () => void) {
|
|
192
|
+
const media = matchMedia(query)
|
|
193
|
+
media.addEventListener('change', onChange)
|
|
194
|
+
return () => media.removeEventListener('change', onChange)
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
namespace styles {
|
|
198
|
+
// The art eases in over the row's art, waits a beat, and leaves faster than it arrives. Under
|
|
199
|
+
// reduced motion the showcase durations are 0ms, so the change is immediate.
|
|
200
|
+
export const art = style(
|
|
201
|
+
{
|
|
202
|
+
alignItems: 'center',
|
|
203
|
+
display: 'flex',
|
|
204
|
+
inset: '0',
|
|
205
|
+
justifyContent: 'center',
|
|
206
|
+
position: 'absolute',
|
|
207
|
+
'@media >=1024': {
|
|
208
|
+
transitionDuration: 'media',
|
|
209
|
+
transitionProperty: 'translate !custom',
|
|
210
|
+
transitionTimingFunction: 'standard',
|
|
211
|
+
translate: '0 6px !custom',
|
|
212
|
+
selectors: {
|
|
213
|
+
'[data-leaving] > * > &': { translate: '0 -4px !custom' },
|
|
214
|
+
'[data-open] > * > &': {
|
|
215
|
+
transitionDelay: 'showcaseEnter',
|
|
216
|
+
transitionDuration: 'showcaseEnter',
|
|
217
|
+
transitionTimingFunction: 'enter',
|
|
218
|
+
translate: 'none !custom',
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
'@media (prefers-reduced-motion: reduce)': {
|
|
223
|
+
selectors: {
|
|
224
|
+
'&, [data-leaving] > * > &, [data-open] > * > &': { translate: 'none !custom' },
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
{ id: 'tds/marketing/feature-accordion/art' },
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
// The text rises 10px into its row as it opens and leaves 6px upward as it closes, on the rows'
|
|
232
|
+
// pace and curve.
|
|
233
|
+
export const body = variants(
|
|
234
|
+
{
|
|
235
|
+
base: {
|
|
236
|
+
display: 'grid',
|
|
237
|
+
gap: 'textPair.b1B1',
|
|
238
|
+
typography: 'body.b1',
|
|
239
|
+
'@media >=1024': {
|
|
240
|
+
transitionDuration: 'showcase',
|
|
241
|
+
transitionProperty: 'translate !custom',
|
|
242
|
+
transitionTimingFunction: 'morph',
|
|
243
|
+
selectors: {
|
|
244
|
+
'[data-starting-style] > &': { translate: '0 10px !custom' },
|
|
245
|
+
'[data-ending-style] > &': { translate: '0 -6px !custom' },
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
'@media (prefers-reduced-motion: reduce)': {
|
|
249
|
+
selectors: {
|
|
250
|
+
'[data-starting-style] > &, [data-ending-style] > &': { translate: 'none !custom' },
|
|
251
|
+
},
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
defaultVariants: { variant: 'products' },
|
|
255
|
+
variants: {
|
|
256
|
+
variant: {
|
|
257
|
+
capabilities: { paddingTop: 'textPair.h4B1' },
|
|
258
|
+
products: { paddingTop: '16' },
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
{ id: 'tds/marketing/feature-accordion/body' },
|
|
263
|
+
)
|
|
264
|
+
|
|
265
|
+
export const description = style(
|
|
266
|
+
{
|
|
267
|
+
color: 'content.secondary',
|
|
268
|
+
margin: '0',
|
|
269
|
+
textWrap: 'pretty',
|
|
270
|
+
'@media >=1024': { maxWidth: '280' },
|
|
271
|
+
},
|
|
272
|
+
{ id: 'tds/marketing/feature-accordion/description' },
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
export const list = style(
|
|
276
|
+
{
|
|
277
|
+
display: 'flex',
|
|
278
|
+
flexDirection: 'column',
|
|
279
|
+
gap: 'layoutGap.content',
|
|
280
|
+
minWidth: '0 !custom',
|
|
281
|
+
'@media >=1024': {
|
|
282
|
+
alignSelf: 'start',
|
|
283
|
+
gap: '32',
|
|
284
|
+
gridColumn: '1 / span 4 !custom',
|
|
285
|
+
gridRow: '1 !custom',
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
{ id: 'tds/marketing/feature-accordion/list' },
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
// From 1024px every row's art overlays one frame over the right eight columns, so the rows stay
|
|
292
|
+
// put while the art changes. Each frame sits absolutely over the stage, which `::before` sizes.
|
|
293
|
+
export const media = variants(
|
|
294
|
+
{
|
|
295
|
+
base: {
|
|
296
|
+
aspectRatio: '1 !custom',
|
|
297
|
+
borderRadius: 'sm',
|
|
298
|
+
marginTop: 'layoutGap.element',
|
|
299
|
+
overflow: 'clip',
|
|
300
|
+
position: 'relative',
|
|
301
|
+
'@media >=768': { aspectRatio: '16 / 9 !custom' },
|
|
302
|
+
'@media >=1024': {
|
|
303
|
+
insetInlineEnd: '0',
|
|
304
|
+
marginTop: '0',
|
|
305
|
+
opacity: '0 !custom',
|
|
306
|
+
pointerEvents: 'none',
|
|
307
|
+
position: 'absolute',
|
|
308
|
+
top: '0',
|
|
309
|
+
// The art it leaves fades at the showcase exit pace.
|
|
310
|
+
transitionDuration: 'showcaseExit',
|
|
311
|
+
transitionProperty: 'opacity !custom',
|
|
312
|
+
transitionTimingFunction: 'standard',
|
|
313
|
+
// Eight of twelve columns with their seven 32px gaps.
|
|
314
|
+
width: 'calc((200% - 32px) / 3) !custom',
|
|
315
|
+
selectors: {
|
|
316
|
+
'[data-open] > &': {
|
|
317
|
+
opacity: 'full',
|
|
318
|
+
transitionDelay: 'showcaseEnter',
|
|
319
|
+
transitionDuration: 'showcaseEnter',
|
|
320
|
+
transitionTimingFunction: 'enter',
|
|
321
|
+
},
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
defaultVariants: { variant: 'products' },
|
|
326
|
+
variants: {
|
|
327
|
+
variant: {
|
|
328
|
+
// Capability art brings its own plate.
|
|
329
|
+
capabilities: { '@media >=1024': { aspectRatio: '3 / 2 !custom' } },
|
|
330
|
+
products: { backgroundColor: 'neutral.006' },
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
{ id: 'tds/marketing/feature-accordion/media' },
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
export const name = variants(
|
|
338
|
+
{
|
|
339
|
+
base: {
|
|
340
|
+
borderBlockStartColor: 'line.secondary',
|
|
341
|
+
borderBlockStartStyle: 'solid',
|
|
342
|
+
borderBlockStartWidth: 'regular',
|
|
343
|
+
color: 'content.primary',
|
|
344
|
+
margin: '0',
|
|
345
|
+
maxWidth: '600',
|
|
346
|
+
paddingTop: '24',
|
|
347
|
+
'@media >=1024': { paddingTop: '32' },
|
|
348
|
+
},
|
|
349
|
+
defaultVariants: { variant: 'products' },
|
|
350
|
+
variants: {
|
|
351
|
+
variant: {
|
|
352
|
+
// Capabilities are phrases, not one-word products.
|
|
353
|
+
capabilities: { typography: 'heading.h4' },
|
|
354
|
+
products: { typography: 'heading.h3' },
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
},
|
|
358
|
+
{ id: 'tds/marketing/feature-accordion/name' },
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
// The panel's height follows Base UI's measure. Its clip lets a link's focus ring show past the
|
|
362
|
+
// sides and foot, where `overflow: hidden` would cut it.
|
|
363
|
+
export const panel = style(
|
|
364
|
+
{
|
|
365
|
+
clipPath: 'inset(0 -8px -6px) !custom',
|
|
366
|
+
height: 'var(--accordion-panel-height) !custom',
|
|
367
|
+
transitionDuration: 'showcase',
|
|
368
|
+
transitionProperty: 'height !custom',
|
|
369
|
+
transitionTimingFunction: 'morph',
|
|
370
|
+
selectors: {
|
|
371
|
+
'&[data-starting-style], &[data-ending-style]': { height: '0' },
|
|
372
|
+
},
|
|
373
|
+
},
|
|
374
|
+
{ id: 'tds/marketing/feature-accordion/panel' },
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
export const root = variants(
|
|
378
|
+
{
|
|
379
|
+
base: {
|
|
380
|
+
display: 'grid',
|
|
381
|
+
gap: 'layoutGap.element',
|
|
382
|
+
gridTemplateColumns: 'minmax(0, 1fr) !custom',
|
|
383
|
+
position: 'relative',
|
|
384
|
+
'@media >=1024': {
|
|
385
|
+
gridTemplateColumns: 'repeat(12, minmax(0, 1fr)) !custom',
|
|
386
|
+
selectors: {
|
|
387
|
+
'&::before': {
|
|
388
|
+
alignSelf: 'start',
|
|
389
|
+
content: '"" !custom',
|
|
390
|
+
gridColumn: '5 / span 8 !custom',
|
|
391
|
+
gridRow: '1 !custom',
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
},
|
|
395
|
+
},
|
|
396
|
+
defaultVariants: { variant: 'products' },
|
|
397
|
+
variants: {
|
|
398
|
+
/**
|
|
399
|
+
* The rows' register: `products` for Home's products, with `h3` names and a 16:9 frame on a
|
|
400
|
+
* grey ground, and `capabilities` for a product's capabilities, with `h4` names and a 3:2
|
|
401
|
+
* frame from 1024px that the art plates itself.
|
|
402
|
+
*
|
|
403
|
+
* @default 'products'
|
|
404
|
+
*/
|
|
405
|
+
variant: {
|
|
406
|
+
capabilities: {
|
|
407
|
+
'@media >=1024': { selectors: { '&::before': { aspectRatio: '3 / 2 !custom' } } },
|
|
408
|
+
},
|
|
409
|
+
products: {
|
|
410
|
+
'@media >=1024': { selectors: { '&::before': { aspectRatio: '16 / 9 !custom' } } },
|
|
411
|
+
},
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
{ id: 'tds/marketing/feature-accordion' },
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
// A resting name reads as supporting text, a hovered one at 80%, between rest and open, and the
|
|
419
|
+
// open one at full strength. The color changes at the media pace, on the showcase's curve.
|
|
420
|
+
export const trigger = style(
|
|
421
|
+
{
|
|
422
|
+
appearance: 'none !custom',
|
|
423
|
+
backgroundColor: 'transparent !custom',
|
|
424
|
+
borderRadius: '2px !custom',
|
|
425
|
+
borderStyle: 'none',
|
|
426
|
+
color: 'content.secondary',
|
|
427
|
+
cursor: 'pointer',
|
|
428
|
+
display: 'block',
|
|
429
|
+
fontFamily: 'inherit !custom',
|
|
430
|
+
fontSize: 'inherit !custom',
|
|
431
|
+
fontWeight: 'inherit !custom',
|
|
432
|
+
letterSpacing: 'inherit !custom',
|
|
433
|
+
lineHeight: 'inherit !custom',
|
|
434
|
+
opacity: 'full',
|
|
435
|
+
outlineColor: 'neutral.100',
|
|
436
|
+
outlineOffset: 'ring',
|
|
437
|
+
outlineStyle: 'none',
|
|
438
|
+
outlineWidth: 'ring',
|
|
439
|
+
padding: '0',
|
|
440
|
+
textAlign: 'start',
|
|
441
|
+
transitionDuration: 'media',
|
|
442
|
+
transitionProperty: 'color, opacity !custom',
|
|
443
|
+
transitionTimingFunction: 'morph',
|
|
444
|
+
width: '100% !custom',
|
|
445
|
+
selectors: {
|
|
446
|
+
'&[data-panel-open]': { color: 'content.primary' },
|
|
447
|
+
'&:active:not([data-panel-open])': { opacity: 'press', transitionDuration: 'press' },
|
|
448
|
+
'&:focus-visible': { outlineStyle: 'solid' },
|
|
449
|
+
},
|
|
450
|
+
'@media (hover: hover) and (pointer: fine)': {
|
|
451
|
+
selectors: { '&:hover:not([data-panel-open])': { color: 'content.prose' } },
|
|
452
|
+
},
|
|
453
|
+
'@media (forced-colors: active)': {
|
|
454
|
+
selectors: { '&:focus-visible': { outlineColor: 'Highlight !custom' } },
|
|
455
|
+
},
|
|
456
|
+
},
|
|
457
|
+
{ id: 'tds/marketing/feature-accordion/trigger' },
|
|
458
|
+
)
|
|
459
|
+
}
|