@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,384 @@
|
|
|
1
|
+
/** Renders the column beside an article: share links, then its contents and what follows them. @module */
|
|
2
|
+
import { type ComponentPropsWithRef, type ReactNode, useEffect, useRef, useState } from 'react'
|
|
3
|
+
import type * as zyzz from 'zyzz'
|
|
4
|
+
import { Checkmark } from '../icons/Checkmark.js'
|
|
5
|
+
import { Link as LinkGlyph } from '../icons/Link.js'
|
|
6
|
+
import { style, variants, vars } from '../zyzz.config.js'
|
|
7
|
+
import { Button } from './Button.js'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The column beside a blog post or Learn guide, in an `<aside>`: links that share the article on
|
|
11
|
+
* LinkedIn and X, a link to Tempo on GitHub and a button that copies the article's address, then
|
|
12
|
+
* its contents and the children, such as a panel with a call to action. Below 1024px only the share
|
|
13
|
+
* links show, in a row above the text. From 1024px the rail takes the first 3 of the article grid's
|
|
14
|
+
* 12 columns and sticks below the navigation, and only its contents scroll.
|
|
15
|
+
*
|
|
16
|
+
* - Pass the article's absolute `url` and `title`. The share links carry them.
|
|
17
|
+
* - Pass `headings` from the text's `h2` to `h4` headings, with the IDs the text renders. Leave them
|
|
18
|
+
* out for text without headings, and the contents do not render.
|
|
19
|
+
* - Keep the children to one short panel, so the contents keep their room.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* <ArticleRail
|
|
23
|
+
* headings={[{ id: 'start-building', text: 'Start building on Tempo' }]}
|
|
24
|
+
* title="Tempo Mainnet is live"
|
|
25
|
+
* url="https://tempo.xyz/blog/mainnet/"
|
|
26
|
+
* />
|
|
27
|
+
*
|
|
28
|
+
* @see {@link https://www.w3.org/WAI/ARIA/apg/practices/landmark-regions/ | WAI-ARIA APG Landmark Regions}
|
|
29
|
+
* @see {@link https://www.w3.org/WAI/WCAG22/Understanding/status-messages.html | WCAG 2.2 Status Messages}
|
|
30
|
+
* @see {@link https://www.w3.org/WAI/WCAG22/Understanding/multiple-ways.html | WCAG 2.2 Multiple Ways}
|
|
31
|
+
*/
|
|
32
|
+
export function ArticleRail(props: ArticleRail.Props) {
|
|
33
|
+
const {
|
|
34
|
+
children,
|
|
35
|
+
className,
|
|
36
|
+
github = 'https://github.com/tempoxyz',
|
|
37
|
+
headings = [],
|
|
38
|
+
messages = {},
|
|
39
|
+
title,
|
|
40
|
+
url,
|
|
41
|
+
vars,
|
|
42
|
+
...attributes
|
|
43
|
+
} = props
|
|
44
|
+
|
|
45
|
+
const address = encodeURIComponent(url)
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<aside {...attributes} {...styles.root({ className, style: props.style, vars })}>
|
|
49
|
+
<div
|
|
50
|
+
aria-label={messages.share ?? 'Share article'}
|
|
51
|
+
// oxlint-disable-next-line jsx-a11y/prefer-tag-over-role
|
|
52
|
+
role="group"
|
|
53
|
+
{...styles.panel()}
|
|
54
|
+
>
|
|
55
|
+
<div {...styles.share()}>
|
|
56
|
+
<Button.Link
|
|
57
|
+
aria-label={messages.linkedIn ?? 'Share on LinkedIn'}
|
|
58
|
+
href={`https://www.linkedin.com/shareArticle?mini=true&url=${address}`}
|
|
59
|
+
layout="carousel"
|
|
60
|
+
rel="noreferrer"
|
|
61
|
+
target="_blank"
|
|
62
|
+
variant="secondary"
|
|
63
|
+
>
|
|
64
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" {...styles.mark()}>
|
|
65
|
+
<path d="M20.45 20.45h-3.56v-5.57c0-1.33-.02-3.04-1.85-3.04-1.85 0-2.14 1.45-2.14 2.94v5.67H9.35V9h3.41v1.56h.05c.48-.9 1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.46v6.28ZM5.34 7.43a2.06 2.06 0 1 1 0-4.12 2.06 2.06 0 0 1 0 4.12Zm1.78 13.02H3.55V9h3.57v11.45ZM22.23 0H1.77C.79 0 0 .77 0 1.73v20.54C0 23.23.79 24 1.77 24h20.45c.98 0 1.78-.77 1.78-1.73V1.73C24 .77 23.2 0 22.22 0h.01Z" />
|
|
66
|
+
</svg>
|
|
67
|
+
</Button.Link>
|
|
68
|
+
<Button.Link
|
|
69
|
+
aria-label={messages.x ?? 'Share on X'}
|
|
70
|
+
href={`https://twitter.com/intent/tweet?url=${address}&text=${encodeURIComponent(title)}`}
|
|
71
|
+
layout="carousel"
|
|
72
|
+
rel="noreferrer"
|
|
73
|
+
target="_blank"
|
|
74
|
+
variant="secondary"
|
|
75
|
+
>
|
|
76
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" {...styles.mark()}>
|
|
77
|
+
<path d="M14.2 10.35 21 3h-1.62l-5.9 6.38L8.76 3H3.33l7.13 9.64L3.33 20.35h1.62l6.23-6.74 4.98 6.74h5.43l-7.39-10Zm-2.2 2.38-.72-.96-5.75-7.5h2.45l4.64 6.06.72.96 6.03 7.86h-2.45L12 12.73Z" />
|
|
78
|
+
</svg>
|
|
79
|
+
</Button.Link>
|
|
80
|
+
<Button.Link
|
|
81
|
+
aria-label={messages.gitHub ?? 'Tempo on GitHub'}
|
|
82
|
+
href={github}
|
|
83
|
+
layout="carousel"
|
|
84
|
+
rel="noreferrer"
|
|
85
|
+
target="_blank"
|
|
86
|
+
variant="secondary"
|
|
87
|
+
>
|
|
88
|
+
<svg aria-hidden="true" viewBox="0 0 24 24" {...styles.mark()}>
|
|
89
|
+
<path d="M10.226 17.284c-2.965-.36-5.054-2.493-5.054-5.256 0-1.123.404-2.336 1.078-3.144-.292-.741-.247-2.314.09-2.965.898-.112 2.111.36 2.83 1.01.853-.269 1.752-.404 2.853-.404 1.1 0 1.999.135 2.807.382.696-.629 1.932-1.1 2.83-.988.315.606.36 2.179.067 2.942.72.854 1.101 2 1.101 3.167 0 2.763-2.089 4.852-5.098 5.234.763.494 1.28 1.572 1.28 2.807v2.336c0 .674.561 1.056 1.235.786 4.066-1.55 7.255-5.615 7.255-10.646C23.5 6.188 18.334 1 11.978 1 5.62 1 .5 6.188.5 12.545c0 4.986 3.167 9.12 7.435 10.669.606.225 1.19-.18 1.19-.786V20.63a2.9 2.9 0 0 1-1.078.224c-1.483 0-2.359-.808-2.987-2.313-.247-.607-.517-.966-1.034-1.033-.27-.023-.359-.135-.359-.27 0-.27.45-.471.898-.471.652 0 1.213.404 1.797 1.235.45.651.921.943 1.483.943.561 0 .92-.202 1.437-.719.382-.381.674-.718.944-.943" />
|
|
90
|
+
</svg>
|
|
91
|
+
</Button.Link>
|
|
92
|
+
<Copy
|
|
93
|
+
label={messages.copyLink ?? 'Copy link'}
|
|
94
|
+
status={messages.linkCopied ?? 'Link copied'}
|
|
95
|
+
url={url}
|
|
96
|
+
/>
|
|
97
|
+
</div>
|
|
98
|
+
</div>
|
|
99
|
+
{headings.length > 0 && (
|
|
100
|
+
<nav aria-label={messages.contents ?? 'Table of contents'} {...styles.contents()}>
|
|
101
|
+
<p {...styles.heading()}>{messages.contentsHeading ?? 'In this article'}</p>
|
|
102
|
+
<ol {...styles.list()}>
|
|
103
|
+
{headings.map((heading) => (
|
|
104
|
+
<li key={heading.id} {...styles.item()}>
|
|
105
|
+
<a href={`#${heading.id}`} {...styles.link()}>
|
|
106
|
+
{heading.text}
|
|
107
|
+
</a>
|
|
108
|
+
</li>
|
|
109
|
+
))}
|
|
110
|
+
</ol>
|
|
111
|
+
</nav>
|
|
112
|
+
)}
|
|
113
|
+
{children}
|
|
114
|
+
</aside>
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export namespace ArticleRail {
|
|
119
|
+
export type Props = Omit<ComponentPropsWithRef<'aside'>, 'title'> &
|
|
120
|
+
zyzz.Props.Variants<typeof styles.root> & {
|
|
121
|
+
/**
|
|
122
|
+
* The address of the GitHub link.
|
|
123
|
+
*
|
|
124
|
+
* @default 'https://github.com/tempoxyz'
|
|
125
|
+
*/
|
|
126
|
+
github?: string | undefined
|
|
127
|
+
/**
|
|
128
|
+
* The article's headings, in order, each with the `id` its text renders. The contents link
|
|
129
|
+
* to each one. Without headings, the contents do not render.
|
|
130
|
+
*/
|
|
131
|
+
headings?: readonly { id: string; text: ReactNode }[] | undefined
|
|
132
|
+
/** The labels, in English by default. */
|
|
133
|
+
messages?:
|
|
134
|
+
| {
|
|
135
|
+
/** The name of the contents' navigation. @default 'Table of contents' */
|
|
136
|
+
contents?: string | undefined
|
|
137
|
+
/** The line above the contents. @default 'In this article' */
|
|
138
|
+
contentsHeading?: string | undefined
|
|
139
|
+
/** The copy button's label. @default 'Copy link' */
|
|
140
|
+
copyLink?: string | undefined
|
|
141
|
+
/** The GitHub link's label. @default 'Tempo on GitHub' */
|
|
142
|
+
gitHub?: string | undefined
|
|
143
|
+
/** The status that a copy announces. @default 'Link copied' */
|
|
144
|
+
linkCopied?: string | undefined
|
|
145
|
+
/** The LinkedIn link's label. @default 'Share on LinkedIn' */
|
|
146
|
+
linkedIn?: string | undefined
|
|
147
|
+
/** The name of the share links' group. @default 'Share article' */
|
|
148
|
+
share?: string | undefined
|
|
149
|
+
/** The X link's label. @default 'Share on X' */
|
|
150
|
+
x?: string | undefined
|
|
151
|
+
}
|
|
152
|
+
| undefined
|
|
153
|
+
/** The article's title, which a post on X starts with. */
|
|
154
|
+
title: string
|
|
155
|
+
/** The article's absolute address, which the share links carry and the copy button copies. */
|
|
156
|
+
url: string
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/** Copies `url`. The link glyph swaps to a check for a second, and a live region announces it. */
|
|
161
|
+
function Copy(props: { label: string; status: string; url: string }) {
|
|
162
|
+
const [copied, setCopied] = useState(false)
|
|
163
|
+
const timeout = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
164
|
+
|
|
165
|
+
useEffect(
|
|
166
|
+
() => () => {
|
|
167
|
+
if (timeout.current) clearTimeout(timeout.current)
|
|
168
|
+
},
|
|
169
|
+
[],
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
async function copy() {
|
|
173
|
+
try {
|
|
174
|
+
await navigator.clipboard.writeText(props.url)
|
|
175
|
+
setCopied(true)
|
|
176
|
+
if (timeout.current) clearTimeout(timeout.current)
|
|
177
|
+
timeout.current = setTimeout(() => setCopied(false), 1000)
|
|
178
|
+
} catch {
|
|
179
|
+
setCopied(false)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return (
|
|
184
|
+
<>
|
|
185
|
+
<Button aria-label={props.label} layout="carousel" onClick={copy} variant="secondary">
|
|
186
|
+
<span {...styles.swap()}>
|
|
187
|
+
<LinkGlyph data-shown={!copied} />
|
|
188
|
+
<Checkmark data-shown={copied} />
|
|
189
|
+
</span>
|
|
190
|
+
</Button>
|
|
191
|
+
<span aria-live="polite" {...styles.hidden()}>
|
|
192
|
+
{copied ? props.status : ''}
|
|
193
|
+
</span>
|
|
194
|
+
</>
|
|
195
|
+
)
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
namespace styles {
|
|
199
|
+
// The contents show only from 1024px, where only they shrink and scroll, so the share row and
|
|
200
|
+
// any trailing panel keep their hit areas. A 4px inset, which a negative margin cancels, keeps
|
|
201
|
+
// the links' focus rings inside the scroll box. Each panel stops at 240px, which has no token.
|
|
202
|
+
export const contents = style(
|
|
203
|
+
{
|
|
204
|
+
display: 'none',
|
|
205
|
+
margin: '-4px !custom',
|
|
206
|
+
maxInlineSize: '240px !custom',
|
|
207
|
+
padding: '4',
|
|
208
|
+
'@media >=1024': {
|
|
209
|
+
display: 'block',
|
|
210
|
+
flexShrink: '1 !custom',
|
|
211
|
+
minBlockSize: '0',
|
|
212
|
+
overflowY: 'auto',
|
|
213
|
+
},
|
|
214
|
+
},
|
|
215
|
+
{ id: 'tds/marketing/article-rail/contents' },
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
// Body B2 in the text color, 12px over the contents.
|
|
219
|
+
export const heading = style(
|
|
220
|
+
{
|
|
221
|
+
color: 'content.primary',
|
|
222
|
+
marginBlockEnd: '12',
|
|
223
|
+
marginBlockStart: '0',
|
|
224
|
+
typography: 'body.b2',
|
|
225
|
+
},
|
|
226
|
+
{ id: 'tds/marketing/article-rail/heading' },
|
|
227
|
+
)
|
|
228
|
+
|
|
229
|
+
// The live region stays in the accessibility tree and out of view.
|
|
230
|
+
export const hidden = style(
|
|
231
|
+
{
|
|
232
|
+
blockSize: '1px !custom',
|
|
233
|
+
clip: 'rect(0 0 0 0) !custom',
|
|
234
|
+
inlineSize: '1px !custom',
|
|
235
|
+
margin: '-1px !custom',
|
|
236
|
+
overflow: 'hidden',
|
|
237
|
+
padding: '0',
|
|
238
|
+
position: 'absolute',
|
|
239
|
+
whiteSpace: 'nowrap',
|
|
240
|
+
},
|
|
241
|
+
{ id: 'tds/marketing/article-rail/hidden' },
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
// Body B2: each link 12px after a 2px by 12px rule in the subtle color, which sits on its first
|
|
245
|
+
// line. The rule's 0.5px corners have no radius token.
|
|
246
|
+
export const item = style(
|
|
247
|
+
{
|
|
248
|
+
alignItems: 'start',
|
|
249
|
+
columnGap: '12',
|
|
250
|
+
display: 'grid',
|
|
251
|
+
gridTemplateColumns: '2px minmax(0, 1fr) !custom',
|
|
252
|
+
typography: 'body.b2',
|
|
253
|
+
selectors: {
|
|
254
|
+
'&::before': {
|
|
255
|
+
backgroundColor: 'content.subtle',
|
|
256
|
+
blockSize: '12',
|
|
257
|
+
borderRadius: 'calc(0.5px * var(--tds-corner-scale, 1)) !custom',
|
|
258
|
+
content: '"" !custom',
|
|
259
|
+
inlineSize: '2',
|
|
260
|
+
marginBlockStart: '4',
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
{ id: 'tds/marketing/article-rail/item' },
|
|
265
|
+
)
|
|
266
|
+
|
|
267
|
+
// A link in its item's color, as wide as its text. Under a mouse it turns 56% black at the
|
|
268
|
+
// hover-in pace and back at the hover-out pace. A press dims it to the surfaces' press, and
|
|
269
|
+
// keyboard focus rings it.
|
|
270
|
+
export const link = style(
|
|
271
|
+
{
|
|
272
|
+
color: 'inherit !custom',
|
|
273
|
+
justifySelf: 'start',
|
|
274
|
+
outlineColor: 'content.primary',
|
|
275
|
+
outlineOffset: 'ringInline',
|
|
276
|
+
outlineStyle: 'none',
|
|
277
|
+
outlineWidth: 'ring',
|
|
278
|
+
textDecoration: 'none !custom',
|
|
279
|
+
transitionDuration: 'hoverOut',
|
|
280
|
+
transitionProperty: 'color, opacity !custom',
|
|
281
|
+
transitionTimingFunction: 'standard',
|
|
282
|
+
selectors: {
|
|
283
|
+
'&:active': { opacity: 'pressSurface', transitionDuration: 'press' },
|
|
284
|
+
'&:focus-visible': { outlineStyle: 'solid' },
|
|
285
|
+
},
|
|
286
|
+
'@media (hover: hover) and (pointer: fine)': {
|
|
287
|
+
selectors: {
|
|
288
|
+
'&:hover:not(:active)': { color: 'content.secondary', transitionDuration: 'hoverIn' },
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
'@media (forced-colors: active)': {
|
|
292
|
+
textDecoration: 'underline !custom',
|
|
293
|
+
selectors: { '&:focus-visible': { outlineColor: 'Highlight !custom' } },
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
{ id: 'tds/marketing/article-rail/link' },
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
// The contents, 8px apart, without markers.
|
|
300
|
+
export const list = style(
|
|
301
|
+
{
|
|
302
|
+
display: 'flex',
|
|
303
|
+
flexDirection: 'column',
|
|
304
|
+
gap: '8',
|
|
305
|
+
listStyle: 'none !custom',
|
|
306
|
+
margin: '0',
|
|
307
|
+
padding: '0',
|
|
308
|
+
},
|
|
309
|
+
{ id: 'tds/marketing/article-rail/list' },
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
// The brand marks draw at 16px, the smallest icon size, in their link's color.
|
|
313
|
+
export const mark = style(
|
|
314
|
+
{
|
|
315
|
+
blockSize: '16',
|
|
316
|
+
fill: 'currentColor !custom',
|
|
317
|
+
flexShrink: '0 !custom',
|
|
318
|
+
inlineSize: '16',
|
|
319
|
+
},
|
|
320
|
+
{ id: 'tds/marketing/article-rail/mark' },
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
export const panel = style(
|
|
324
|
+
{ maxInlineSize: '240px !custom' },
|
|
325
|
+
{ id: 'tds/marketing/article-rail/panel' },
|
|
326
|
+
)
|
|
327
|
+
|
|
328
|
+
// Its panels stack 48px apart. Below 1024px the rail is a row above the text, 32px over it. From
|
|
329
|
+
// 1024px it is a column in the first 3 of the article grid's 12, 32px short of the text, and sticks
|
|
330
|
+
// Section MD (100px) from the top. The text spans the grid's two rows, and the rail spans them too,
|
|
331
|
+
// so it sticks all the way down.
|
|
332
|
+
export const root = variants(
|
|
333
|
+
{
|
|
334
|
+
base: {
|
|
335
|
+
color: 'content.primary',
|
|
336
|
+
display: 'flex',
|
|
337
|
+
flexDirection: 'column',
|
|
338
|
+
gap: '48',
|
|
339
|
+
paddingBlockEnd: '32',
|
|
340
|
+
'@media >=1024': {
|
|
341
|
+
gridColumn: '1 / span 3 !custom',
|
|
342
|
+
gridRow: '1 / span 2 !custom',
|
|
343
|
+
insetBlockStart: 'section.md',
|
|
344
|
+
maxBlockSize: 'calc(100dvh - 100px - 16px) !custom',
|
|
345
|
+
paddingBlockEnd: '0',
|
|
346
|
+
paddingInlineEnd: '32',
|
|
347
|
+
position: 'sticky',
|
|
348
|
+
selectors: { '& > *': { flexShrink: '0 !custom' } },
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
{ id: 'tds/marketing/article-rail' },
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
// The share links in a row, 8px apart.
|
|
356
|
+
export const share = style(
|
|
357
|
+
{ alignItems: 'center', display: 'flex', gap: '8' },
|
|
358
|
+
{ id: 'tds/marketing/article-rail/share' },
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
// The copy button's two glyphs share one cell at 16px. The one leaving shrinks and blurs out as
|
|
362
|
+
// the other grows in, on the swap pace. Reduced motion keeps the fade and drops the scale.
|
|
363
|
+
export const swap = style(
|
|
364
|
+
{
|
|
365
|
+
display: 'grid',
|
|
366
|
+
flexShrink: '0 !custom',
|
|
367
|
+
fontSize: '16px !custom',
|
|
368
|
+
selectors: {
|
|
369
|
+
'& > *': {
|
|
370
|
+
gridArea: '1 / 1 !custom',
|
|
371
|
+
transitionDuration: 'swap',
|
|
372
|
+
transitionProperty: 'opacity, scale, filter !custom',
|
|
373
|
+
transitionTimingFunction: 'standard',
|
|
374
|
+
},
|
|
375
|
+
'& > [data-shown="false"]': {
|
|
376
|
+
filter: `blur(${vars.blur.soften}) !custom`,
|
|
377
|
+
opacity: '0 !custom',
|
|
378
|
+
scale: 'swap',
|
|
379
|
+
},
|
|
380
|
+
},
|
|
381
|
+
},
|
|
382
|
+
{ id: 'tds/marketing/article-rail/swap' },
|
|
383
|
+
)
|
|
384
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/** Renders the Marketing aside layout: a rail beside its content, on the page's 12 columns. @module */
|
|
2
|
+
import type { ComponentPropsWithRef, ReactNode } from 'react'
|
|
3
|
+
import type * as zyzz from 'zyzz'
|
|
4
|
+
import { variants } from '../zyzz.config.js'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The grid an article sits on: a rail, then its content, a page gutter apart. They stack below
|
|
8
|
+
* 1024px, the rail first, and share the page's 12 columns from 1024px. It places neither part:
|
|
9
|
+
* each places itself on the columns, as `ArticleRail` takes 1 to 3 and `ArticleBody` 4 to 9. It
|
|
10
|
+
* renders a plain `<div>`, so the rail and the content keep their own landmarks, and it has no
|
|
11
|
+
* states or motion.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <AsideLayout aside={<ArticleRail />}>
|
|
15
|
+
* <ArticleBody>…</ArticleBody>
|
|
16
|
+
* </AsideLayout>
|
|
17
|
+
*/
|
|
18
|
+
export function AsideLayout(props: AsideLayout.Props) {
|
|
19
|
+
const { aside, children, className, vars, ...attributes } = props
|
|
20
|
+
|
|
21
|
+
return (
|
|
22
|
+
<div {...attributes} {...styles.root({ className, style: props.style, vars })}>
|
|
23
|
+
{aside}
|
|
24
|
+
{children}
|
|
25
|
+
</div>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export namespace AsideLayout {
|
|
30
|
+
export type Props = ComponentPropsWithRef<'div'> &
|
|
31
|
+
zyzz.Props.Variants<typeof styles.root> & {
|
|
32
|
+
/** The rail beside the content, first in the reading order, such as an `ArticleRail`. */
|
|
33
|
+
aside?: ReactNode | undefined
|
|
34
|
+
/** The content the rail sits beside, such as an `ArticleBody`. */
|
|
35
|
+
children?: ReactNode | undefined
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
namespace styles {
|
|
40
|
+
export const root = variants(
|
|
41
|
+
{
|
|
42
|
+
base: {
|
|
43
|
+
alignItems: 'start',
|
|
44
|
+
columnGap: 'page.gutter',
|
|
45
|
+
display: 'grid',
|
|
46
|
+
gridTemplateColumns: 'minmax(0, 1fr) !custom',
|
|
47
|
+
'@media >=1024': { gridTemplateColumns: 'repeat(12, minmax(0, 1fr)) !custom' },
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
{ id: 'tds/marketing/aside-layout' },
|
|
51
|
+
)
|
|
52
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/** Renders the Marketing trail of links up through each level above a page. @module */
|
|
2
|
+
import { useRender } from '@base-ui/react/use-render'
|
|
3
|
+
import type { ComponentPropsWithRef, ReactNode } from 'react'
|
|
4
|
+
import type * as zyzz from 'zyzz'
|
|
5
|
+
import { ChevronRight } from '../icons/ChevronRight.js'
|
|
6
|
+
import { style, variants, vars } from '../zyzz.config.js'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The trail a page below an index opens with: each level up as a link with a chevron after it, then
|
|
10
|
+
* the page itself. Renders a `nav` named Breadcrumb around an `ol` in Body B2. On a fine pointer a
|
|
11
|
+
* link eases to black on hover, and a press keeps it black and dims it. In forced colors its links
|
|
12
|
+
* are underlined.
|
|
13
|
+
*
|
|
14
|
+
* - Order the items top down, from the section's index, such as Partners, to the page.
|
|
15
|
+
* - Label each item with its page's title, such as Wallets & custody, and mark the last `current`.
|
|
16
|
+
* - For a page under more than one parent, pass the parent the visitor came from as the last link.
|
|
17
|
+
* - Pass `aria-label` to translate the landmark's name.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <Breadcrumbs>
|
|
21
|
+
* <Breadcrumbs.Item href="/partners">Partners</Breadcrumbs.Item>
|
|
22
|
+
* <Breadcrumbs.Item current>Ramps & FX</Breadcrumbs.Item>
|
|
23
|
+
* </Breadcrumbs>
|
|
24
|
+
*
|
|
25
|
+
* @see {@link https://base-ui.com/react/utils/use-render | Base UI useRender}
|
|
26
|
+
* @see {@link https://www.w3.org/WAI/ARIA/apg/patterns/breadcrumb/ | WAI-ARIA APG Breadcrumb pattern}
|
|
27
|
+
* @see {@link https://www.w3.org/WAI/WCAG22/Understanding/link-purpose-in-context.html | WCAG 2.2 Link Purpose (In Context)}
|
|
28
|
+
*/
|
|
29
|
+
export function Breadcrumbs(props: Breadcrumbs.Props) {
|
|
30
|
+
const { 'aria-label': label = 'Breadcrumb', children, className, vars, ...attributes } = props
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<nav
|
|
34
|
+
{...attributes}
|
|
35
|
+
{...styles.root({ className, style: props.style, vars })}
|
|
36
|
+
aria-label={label}
|
|
37
|
+
>
|
|
38
|
+
<ol {...styles.list()}>{children}</ol>
|
|
39
|
+
</nav>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export namespace Breadcrumbs {
|
|
44
|
+
export type Props = ComponentPropsWithRef<'nav'> &
|
|
45
|
+
zyzz.Props.Variants<typeof styles.root> & {
|
|
46
|
+
/**
|
|
47
|
+
* The landmark's name, such as a translation.
|
|
48
|
+
*
|
|
49
|
+
* @default 'Breadcrumb'
|
|
50
|
+
*/
|
|
51
|
+
'aria-label'?: string | undefined
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* One level of the trail. Renders an `li` around an `a` and a chevron, or around a `span` with
|
|
56
|
+
* `aria-current="page"` when `current` is set. `ref`, `className` and `style` reach the inner
|
|
57
|
+
* element. Pass `render` for a router link. A label of 32 characters or fewer stays on one line.
|
|
58
|
+
*/
|
|
59
|
+
export function Item(props: Item.Props) {
|
|
60
|
+
const { children, className, current = false, ref, render, vars, ...attributes } = props
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<li {...styles.item()}>
|
|
64
|
+
{useRender({
|
|
65
|
+
defaultTagName: current ? 'span' : 'a',
|
|
66
|
+
props: {
|
|
67
|
+
...attributes,
|
|
68
|
+
...styles.link({ className, current, style: props.style, vars }),
|
|
69
|
+
'aria-current': current ? 'page' : undefined,
|
|
70
|
+
children: nbsp(children),
|
|
71
|
+
},
|
|
72
|
+
ref,
|
|
73
|
+
render,
|
|
74
|
+
})}
|
|
75
|
+
{!current && <ChevronRight {...styles.separator()} />}
|
|
76
|
+
</li>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export namespace Item {
|
|
81
|
+
export type Props = useRender.ComponentProps<'a'> &
|
|
82
|
+
Omit<zyzz.Props.Variants<typeof styles.link>, 'current'> & {
|
|
83
|
+
/**
|
|
84
|
+
* Marks the page itself, which ends the trail without a link or a chevron.
|
|
85
|
+
*
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
88
|
+
current?: boolean | undefined
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/** Joins the words of a label up to 32 characters with no-break spaces, so it stays on one line. */
|
|
94
|
+
function nbsp(children: ReactNode): ReactNode {
|
|
95
|
+
if (typeof children !== 'string' || children.trim().length > 32) return children
|
|
96
|
+
// U+00A0, written as a code so it stays visible in source.
|
|
97
|
+
return children.replace(/[ \t\r\n]+/g, String.fromCharCode(0xa0))
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
namespace styles {
|
|
101
|
+
export const item = style(
|
|
102
|
+
{ alignItems: 'center', columnGap: '4', display: 'inline-flex' },
|
|
103
|
+
{ id: 'tds/marketing/breadcrumbs/item' },
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
// A link eases to black on hover, and a press keeps that black and dims it. Hover answers only a
|
|
107
|
+
// mouse or trackpad.
|
|
108
|
+
export const link = variants(
|
|
109
|
+
{
|
|
110
|
+
base: {
|
|
111
|
+
color: 'content.secondary',
|
|
112
|
+
// The ring takes the ground's ink, black, not the link's 56%.
|
|
113
|
+
outlineColor: 'content.primary',
|
|
114
|
+
outlineOffset: 'ring',
|
|
115
|
+
outlineStyle: 'none',
|
|
116
|
+
outlineWidth: 'ring',
|
|
117
|
+
position: 'relative',
|
|
118
|
+
textDecoration: 'none !custom',
|
|
119
|
+
// At rest is where hover out and a release land.
|
|
120
|
+
transitionDuration: 'hoverOut',
|
|
121
|
+
transitionProperty: 'color, opacity !custom',
|
|
122
|
+
transitionTimingFunction: 'standard',
|
|
123
|
+
selectors: {
|
|
124
|
+
// A hit area that leaves the visible size alone. Centered, it grows toward 44px, but
|
|
125
|
+
// reaches at most 4px past an edge, the gap to its chevron, so on one line it never
|
|
126
|
+
// reaches the next link.
|
|
127
|
+
'&::after': {
|
|
128
|
+
content: '"" !custom',
|
|
129
|
+
insetBlock: `max(-4px, min(0px, (100% - ${vars.spacing.hitMin}) / 2)) !custom`,
|
|
130
|
+
insetInline: `max(-4px, min(0px, (100% - ${vars.spacing.hitMin}) / 2)) !custom`,
|
|
131
|
+
position: 'absolute',
|
|
132
|
+
},
|
|
133
|
+
'&:active': {
|
|
134
|
+
color: 'content.primary',
|
|
135
|
+
opacity: 'pressSurface',
|
|
136
|
+
transitionDuration: 'press',
|
|
137
|
+
},
|
|
138
|
+
'&:focus-visible': { outlineStyle: 'solid' },
|
|
139
|
+
},
|
|
140
|
+
'@media (hover: hover) and (pointer: fine)': {
|
|
141
|
+
selectors: {
|
|
142
|
+
'&:hover:not(:active)': { color: 'content.primary', transitionDuration: 'hoverIn' },
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
// Forced colors drop the color, so an underline marks each link.
|
|
146
|
+
'@media (forced-colors: active)': {
|
|
147
|
+
textDecorationLine: 'underline',
|
|
148
|
+
selectors: { '&:focus-visible': { outlineColor: 'Highlight !custom' } },
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
defaultVariants: { current: false },
|
|
152
|
+
variants: {
|
|
153
|
+
current: {
|
|
154
|
+
false: {},
|
|
155
|
+
true: {
|
|
156
|
+
color: 'content.primary',
|
|
157
|
+
selectors: {
|
|
158
|
+
'&::after': { content: 'none !custom' },
|
|
159
|
+
'&:active': { opacity: 'full' },
|
|
160
|
+
},
|
|
161
|
+
'@media (forced-colors: active)': { textDecorationLine: 'none' },
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{ id: 'tds/marketing/breadcrumbs/link' },
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
export const list = style(
|
|
170
|
+
{
|
|
171
|
+
alignItems: 'center',
|
|
172
|
+
display: 'flex',
|
|
173
|
+
flexWrap: 'wrap',
|
|
174
|
+
gap: '4',
|
|
175
|
+
listStyle: 'none !custom',
|
|
176
|
+
margin: '0',
|
|
177
|
+
padding: '0',
|
|
178
|
+
typography: 'body.b2',
|
|
179
|
+
},
|
|
180
|
+
{ id: 'tds/marketing/breadcrumbs/list' },
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
export const root = variants({ base: { display: 'block' } }, { id: 'tds/marketing/breadcrumbs' })
|
|
184
|
+
|
|
185
|
+
// An icon keeps its own color in forced colors, so the chevron takes the system text color there
|
|
186
|
+
// rather than fading into a dark system background. It mirrors in right-to-left text.
|
|
187
|
+
export const separator = style(
|
|
188
|
+
{
|
|
189
|
+
color: 'content.tertiary',
|
|
190
|
+
flexShrink: '0 !custom',
|
|
191
|
+
fontSize: '16px !custom',
|
|
192
|
+
selectors: { '[dir="rtl"] &': { transform: 'scaleX(-1) !custom' } },
|
|
193
|
+
'@media (forced-colors: active)': { color: 'CanvasText !custom' },
|
|
194
|
+
},
|
|
195
|
+
{ id: 'tds/marketing/breadcrumbs/separator' },
|
|
196
|
+
)
|
|
197
|
+
}
|