@adres/mgda-ui 0.0.0-stage → 0.0.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/brand-knowledge.json +451 -0
- package/knowledge/accordion.md +135 -0
- package/knowledge/activity-rings.md +123 -0
- package/knowledge/alert.md +184 -0
- package/knowledge/answer-actions.md +217 -0
- package/knowledge/aspect-ratio.md +82 -0
- package/knowledge/avatar.md +158 -0
- package/knowledge/badge.md +172 -0
- package/knowledge/bar-graph.md +167 -0
- package/knowledge/bento-grid.md +115 -0
- package/knowledge/blockquote.md +153 -0
- package/knowledge/box-list.md +177 -0
- package/knowledge/bullet-list.md +128 -0
- package/knowledge/button-group.md +179 -0
- package/knowledge/button.md +231 -0
- package/knowledge/calendar.md +168 -0
- package/knowledge/card.md +321 -0
- package/knowledge/cards-nav.md +170 -0
- package/knowledge/chain-of-thought.md +164 -0
- package/knowledge/chat-container.md +135 -0
- package/knowledge/chat-message.md +224 -0
- package/knowledge/checkbox-card.md +172 -0
- package/knowledge/checkbox.md +111 -0
- package/knowledge/citations.md +241 -0
- package/knowledge/combobox.md +265 -0
- package/knowledge/countdown-pill.md +153 -0
- package/knowledge/cta.md +118 -0
- package/knowledge/data-list.md +173 -0
- package/knowledge/data-table.md +220 -0
- package/knowledge/dialog.md +249 -0
- package/knowledge/drawer.md +236 -0
- package/knowledge/dropdown-menu.md +238 -0
- package/knowledge/dropzone.md +153 -0
- package/knowledge/email-chips-input.md +161 -0
- package/knowledge/empty-state.md +106 -0
- package/knowledge/entity-header.md +166 -0
- package/knowledge/feature-grid.md +120 -0
- package/knowledge/feedback-bar.md +127 -0
- package/knowledge/footer.md +116 -0
- package/knowledge/heading.md +189 -0
- package/knowledge/hero.md +361 -0
- package/knowledge/input-button.md +187 -0
- package/knowledge/input-group.md +185 -0
- package/knowledge/input.md +256 -0
- package/knowledge/inset.md +177 -0
- package/knowledge/kpi-card.md +206 -0
- package/knowledge/list-nav.md +181 -0
- package/knowledge/logo-cloud.md +102 -0
- package/knowledge/media-gallery.md +158 -0
- package/knowledge/message-actions.md +175 -0
- package/knowledge/nav-sidebar.md +225 -0
- package/knowledge/number-stepper.md +159 -0
- package/knowledge/page-header.md +109 -0
- package/knowledge/pagination.md +225 -0
- package/knowledge/popover.md +159 -0
- package/knowledge/pricing.md +132 -0
- package/knowledge/progress.md +156 -0
- package/knowledge/prompt-input.md +337 -0
- package/knowledge/prompt-suggestions.md +168 -0
- package/knowledge/quota-bar.md +160 -0
- package/knowledge/quote.md +116 -0
- package/knowledge/radio-card.md +172 -0
- package/knowledge/radio-group.md +135 -0
- package/knowledge/reasoning.md +142 -0
- package/knowledge/search.md +131 -0
- package/knowledge/section-nav.md +162 -0
- package/knowledge/segmented-control.md +181 -0
- package/knowledge/select-button.md +205 -0
- package/knowledge/select.md +210 -0
- package/knowledge/separator.md +75 -0
- package/knowledge/shimmer-text.md +140 -0
- package/knowledge/sidebar.md +227 -0
- package/knowledge/skeleton.md +142 -0
- package/knowledge/slider.md +133 -0
- package/knowledge/slideshow.md +159 -0
- package/knowledge/source.md +156 -0
- package/knowledge/spinner.md +120 -0
- package/knowledge/stat-strip.md +128 -0
- package/knowledge/stats.md +117 -0
- package/knowledge/step-indicator.md +157 -0
- package/knowledge/switch.md +88 -0
- package/knowledge/table.md +190 -0
- package/knowledge/tabs.md +169 -0
- package/knowledge/testimonials.md +115 -0
- package/knowledge/text-link.md +192 -0
- package/knowledge/text.md +194 -0
- package/knowledge/thinking-bar.md +115 -0
- package/knowledge/thinking-steps.md +140 -0
- package/knowledge/toaster.md +127 -0
- package/knowledge/toggle.md +113 -0
- package/knowledge/tool-call-card.md +241 -0
- package/knowledge/tooltip.md +120 -0
- package/knowledge/top-nav.md +138 -0
- package/knowledge.json +19854 -0
- package/package.json +94 -4
- package/src/components/accordion.stories.tsx +46 -0
- package/src/components/accordion.tsx +74 -0
- package/src/components/activity-rings.stories.tsx +73 -0
- package/src/components/activity-rings.tsx +121 -0
- package/src/components/alert.stories.tsx +43 -0
- package/src/components/alert.tsx +132 -0
- package/src/components/answer-actions.stories.tsx +54 -0
- package/src/components/answer-actions.test.tsx +37 -0
- package/src/components/answer-actions.tsx +313 -0
- package/src/components/aspect-ratio.stories.tsx +32 -0
- package/src/components/aspect-ratio.tsx +5 -0
- package/src/components/avatar.stories.tsx +40 -0
- package/src/components/avatar.tsx +154 -0
- package/src/components/badge.stories.tsx +27 -0
- package/src/components/badge.tsx +63 -0
- package/src/components/bar-graph.stories.tsx +28 -0
- package/src/components/bar-graph.tsx +204 -0
- package/src/components/bento-grid.stories.tsx +23 -0
- package/src/components/bento-grid.tsx +67 -0
- package/src/components/blockquote.stories.tsx +28 -0
- package/src/components/blockquote.tsx +88 -0
- package/src/components/box-list.stories.tsx +25 -0
- package/src/components/box-list.tsx +108 -0
- package/src/components/bullet-list.stories.tsx +22 -0
- package/src/components/bullet-list.tsx +101 -0
- package/src/components/button-group.stories.tsx +31 -0
- package/src/components/button-group.tsx +156 -0
- package/src/components/button.stories.tsx +66 -0
- package/src/components/button.test.ts +17 -0
- package/src/components/button.tsx +139 -0
- package/src/components/calendar.stories.tsx +25 -0
- package/src/components/calendar.tsx +367 -0
- package/src/components/card.stories.tsx +44 -0
- package/src/components/card.tsx +392 -0
- package/src/components/cards-nav.stories.tsx +35 -0
- package/src/components/cards-nav.tsx +115 -0
- package/src/components/chain-of-thought.stories.tsx +67 -0
- package/src/components/chain-of-thought.test.tsx +50 -0
- package/src/components/chain-of-thought.tsx +170 -0
- package/src/components/chat-container.stories.tsx +47 -0
- package/src/components/chat-container.test.tsx +49 -0
- package/src/components/chat-container.tsx +222 -0
- package/src/components/chat-message.stories.tsx +52 -0
- package/src/components/chat-message.test.tsx +36 -0
- package/src/components/chat-message.tsx +163 -0
- package/src/components/checkbox-card.stories.tsx +27 -0
- package/src/components/checkbox-card.tsx +200 -0
- package/src/components/checkbox.stories.tsx +26 -0
- package/src/components/checkbox.tsx +61 -0
- package/src/components/citations.stories.tsx +64 -0
- package/src/components/citations.test.tsx +61 -0
- package/src/components/citations.tsx +220 -0
- package/src/components/combobox.stories.tsx +184 -0
- package/src/components/combobox.test.tsx +82 -0
- package/src/components/combobox.tsx +407 -0
- package/src/components/countdown-pill.stories.tsx +24 -0
- package/src/components/countdown-pill.tsx +129 -0
- package/src/components/cta.stories.tsx +29 -0
- package/src/components/cta.tsx +52 -0
- package/src/components/data-list.stories.tsx +50 -0
- package/src/components/data-list.test.tsx +35 -0
- package/src/components/data-list.tsx +181 -0
- package/src/components/data-table.stories.tsx +29 -0
- package/src/components/data-table.tsx +200 -0
- package/src/components/dialog.stories.tsx +42 -0
- package/src/components/dialog.tsx +200 -0
- package/src/components/drawer.stories.tsx +48 -0
- package/src/components/drawer.tsx +385 -0
- package/src/components/dropdown-menu.stories.tsx +41 -0
- package/src/components/dropdown-menu.tsx +252 -0
- package/src/components/dropzone.stories.tsx +19 -0
- package/src/components/dropzone.tsx +250 -0
- package/src/components/email-chips-input.stories.tsx +135 -0
- package/src/components/email-chips-input.tsx +210 -0
- package/src/components/empty-state.stories.tsx +22 -0
- package/src/components/empty-state.tsx +35 -0
- package/src/components/entity-header.stories.tsx +43 -0
- package/src/components/entity-header.test.tsx +35 -0
- package/src/components/entity-header.tsx +92 -0
- package/src/components/feature-grid.stories.tsx +25 -0
- package/src/components/feature-grid.tsx +87 -0
- package/src/components/feedback-bar.stories.tsx +25 -0
- package/src/components/feedback-bar.test.tsx +24 -0
- package/src/components/feedback-bar.tsx +62 -0
- package/src/components/footer.stories.tsx +23 -0
- package/src/components/footer.tsx +78 -0
- package/src/components/heading.stories.tsx +45 -0
- package/src/components/heading.test.tsx +22 -0
- package/src/components/heading.tsx +77 -0
- package/src/components/hero.stories.tsx +38 -0
- package/src/components/hero.tsx +498 -0
- package/src/components/input-button.stories.tsx +19 -0
- package/src/components/input-button.tsx +112 -0
- package/src/components/input-group.stories.tsx +38 -0
- package/src/components/input-group.tsx +157 -0
- package/src/components/input.stories.tsx +31 -0
- package/src/components/input.tsx +284 -0
- package/src/components/inset.stories.tsx +29 -0
- package/src/components/inset.tsx +70 -0
- package/src/components/kpi-card.stories.tsx +29 -0
- package/src/components/kpi-card.tsx +284 -0
- package/src/components/list-nav.stories.tsx +22 -0
- package/src/components/list-nav.tsx +145 -0
- package/src/components/logo-cloud.stories.tsx +23 -0
- package/src/components/logo-cloud.tsx +42 -0
- package/src/components/media-gallery.stories.tsx +25 -0
- package/src/components/media-gallery.tsx +347 -0
- package/src/components/message-actions.stories.tsx +45 -0
- package/src/components/message-actions.test.tsx +32 -0
- package/src/components/message-actions.tsx +119 -0
- package/src/components/nav-sidebar.stories.tsx +58 -0
- package/src/components/nav-sidebar.test.tsx +54 -0
- package/src/components/nav-sidebar.tsx +462 -0
- package/src/components/number-stepper.stories.tsx +19 -0
- package/src/components/number-stepper.tsx +158 -0
- package/src/components/page-header.stories.tsx +25 -0
- package/src/components/page-header.tsx +64 -0
- package/src/components/pagination.stories.tsx +110 -0
- package/src/components/pagination.test.tsx +46 -0
- package/src/components/pagination.tsx +144 -0
- package/src/components/popover.stories.tsx +26 -0
- package/src/components/popover.tsx +62 -0
- package/src/components/pricing.stories.tsx +42 -0
- package/src/components/pricing.tsx +130 -0
- package/src/components/progress.stories.tsx +22 -0
- package/src/components/progress.tsx +189 -0
- package/src/components/prompt-input.stories.tsx +62 -0
- package/src/components/prompt-input.test.tsx +106 -0
- package/src/components/prompt-input.tsx +343 -0
- package/src/components/prompt-suggestions.stories.tsx +53 -0
- package/src/components/prompt-suggestions.test.tsx +37 -0
- package/src/components/prompt-suggestions.tsx +122 -0
- package/src/components/quota-bar.stories.tsx +19 -0
- package/src/components/quota-bar.tsx +191 -0
- package/src/components/quote.stories.tsx +18 -0
- package/src/components/quote.tsx +43 -0
- package/src/components/radio-card.stories.tsx +27 -0
- package/src/components/radio-card.tsx +225 -0
- package/src/components/radio-group.stories.tsx +32 -0
- package/src/components/radio-group.tsx +68 -0
- package/src/components/reasoning.stories.tsx +50 -0
- package/src/components/reasoning.test.tsx +48 -0
- package/src/components/reasoning.tsx +143 -0
- package/src/components/search.stories.tsx +18 -0
- package/src/components/search.tsx +133 -0
- package/src/components/section-nav.stories.tsx +59 -0
- package/src/components/section-nav.test.tsx +36 -0
- package/src/components/section-nav.tsx +146 -0
- package/src/components/segmented-control.stories.tsx +22 -0
- package/src/components/segmented-control.tsx +301 -0
- package/src/components/select-button.stories.tsx +27 -0
- package/src/components/select-button.tsx +174 -0
- package/src/components/select.stories.tsx +27 -0
- package/src/components/select.tsx +198 -0
- package/src/components/separator.stories.tsx +22 -0
- package/src/components/separator.tsx +23 -0
- package/src/components/shimmer-text.stories.tsx +23 -0
- package/src/components/shimmer-text.test.tsx +35 -0
- package/src/components/shimmer-text.tsx +43 -0
- package/src/components/sidebar.stories.tsx +25 -0
- package/src/components/sidebar.tsx +234 -0
- package/src/components/skeleton.stories.tsx +22 -0
- package/src/components/skeleton.tsx +96 -0
- package/src/components/slider.stories.tsx +20 -0
- package/src/components/slider.tsx +176 -0
- package/src/components/slideshow.stories.tsx +30 -0
- package/src/components/slideshow.tsx +291 -0
- package/src/components/source.stories.tsx +32 -0
- package/src/components/source.test.tsx +40 -0
- package/src/components/source.tsx +161 -0
- package/src/components/spinner.stories.tsx +19 -0
- package/src/components/spinner.tsx +76 -0
- package/src/components/stat-strip.stories.tsx +36 -0
- package/src/components/stat-strip.test.tsx +25 -0
- package/src/components/stat-strip.tsx +85 -0
- package/src/components/stats.stories.tsx +24 -0
- package/src/components/stats.tsx +83 -0
- package/src/components/step-indicator.stories.tsx +18 -0
- package/src/components/step-indicator.test.tsx +18 -0
- package/src/components/step-indicator.tsx +286 -0
- package/src/components/switch.stories.tsx +26 -0
- package/src/components/switch.tsx +32 -0
- package/src/components/table.stories.tsx +38 -0
- package/src/components/table.tsx +220 -0
- package/src/components/tabs.stories.tsx +25 -0
- package/src/components/tabs.tsx +276 -0
- package/src/components/testimonials.stories.tsx +22 -0
- package/src/components/testimonials.tsx +109 -0
- package/src/components/text-link.stories.tsx +47 -0
- package/src/components/text-link.test.tsx +18 -0
- package/src/components/text-link.tsx +88 -0
- package/src/components/text.stories.tsx +49 -0
- package/src/components/text.tsx +105 -0
- package/src/components/thinking-bar.stories.tsx +19 -0
- package/src/components/thinking-bar.test.tsx +27 -0
- package/src/components/thinking-bar.tsx +64 -0
- package/src/components/thinking-steps.stories.tsx +44 -0
- package/src/components/thinking-steps.test.tsx +42 -0
- package/src/components/thinking-steps.tsx +92 -0
- package/src/components/toaster.stories.tsx +80 -0
- package/src/components/toaster.tsx +36 -0
- package/src/components/toggle.stories.tsx +21 -0
- package/src/components/toggle.tsx +103 -0
- package/src/components/tool-call-card.stories.tsx +97 -0
- package/src/components/tool-call-card.test.tsx +88 -0
- package/src/components/tool-call-card.tsx +231 -0
- package/src/components/tooltip.stories.tsx +25 -0
- package/src/components/tooltip.tsx +43 -0
- package/src/components/top-nav.stories.tsx +20 -0
- package/src/components/top-nav.tsx +76 -0
- package/src/docs/Colors.stories.tsx +192 -0
- package/src/docs/GettingStarted.mdx +72 -0
- package/src/docs/Mcp.mdx +52 -0
- package/src/docs/Typography.stories.tsx +114 -0
- package/src/hooks/use-in-view.ts +32 -0
- package/src/hooks/use-reduced-motion.ts +26 -0
- package/src/index.ts +343 -0
- package/src/lib/cn.test.ts +67 -0
- package/src/lib/cn.ts +81 -0
- package/src/lib/motion.ts +109 -0
- package/src/lib/prefix-utilities.test.ts +56 -0
- package/src/lib/prefix-utilities.ts +50 -0
- package/src/styles/base.css +489 -0
- package/src/styles/motion.css +69 -0
- package/src/styles/overrides.css +44 -0
- package/src/styles/typography.css +173 -0
- package/src/theme/theme.css +391 -0
- package/src/theme/tokens.ts +29 -0
- package/src/theme/types.ts +26 -0
- package/README.md +0 -3
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { Footer } from "./footer"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Footer> = {
|
|
6
|
+
title: "Components/Footer",
|
|
7
|
+
component: Footer,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
args: {
|
|
10
|
+
brand: <span className="ax:t-h5">Adres</span>,
|
|
11
|
+
tagline: "Multi-brand design system.",
|
|
12
|
+
columns: [
|
|
13
|
+
{ heading: "Product", links: [{ label: "Features", href: "#" }, { label: "Pricing", href: "#" }] },
|
|
14
|
+
{ heading: "Company", links: [{ label: "About", href: "#" }, { label: "Careers", href: "#" }] },
|
|
15
|
+
],
|
|
16
|
+
legal: "© 2026 Adres. All rights reserved.",
|
|
17
|
+
},
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default meta
|
|
21
|
+
type Story = StoryObj<typeof Footer>
|
|
22
|
+
|
|
23
|
+
export const Default: Story = {}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { cn } from "../lib/cn"
|
|
3
|
+
|
|
4
|
+
export interface FooterLink {
|
|
5
|
+
label: string
|
|
6
|
+
href: string
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface FooterColumn {
|
|
10
|
+
heading: string
|
|
11
|
+
links: FooterLink[]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface FooterProps extends React.HTMLAttributes<HTMLElement> {
|
|
15
|
+
brand?: React.ReactNode
|
|
16
|
+
tagline?: React.ReactNode
|
|
17
|
+
columns?: FooterColumn[]
|
|
18
|
+
legal?: React.ReactNode
|
|
19
|
+
social?: React.ReactNode
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function Footer({ className, brand, tagline, columns, legal, social, ...props }: FooterProps) {
|
|
23
|
+
return (
|
|
24
|
+
<footer
|
|
25
|
+
className={cn(
|
|
26
|
+
"ax:w-full ax:border-t ax:border-border ax:bg-card ax:text-card-foreground",
|
|
27
|
+
"ax:px-xl ax:md:px-3xl ax:py-4xl ax:md:py-5xl",
|
|
28
|
+
className
|
|
29
|
+
)}
|
|
30
|
+
{...props}
|
|
31
|
+
>
|
|
32
|
+
<div className="ax:mx-auto ax:max-w-420">
|
|
33
|
+
<div
|
|
34
|
+
className={cn(
|
|
35
|
+
"ax:grid ax:gap-3xl",
|
|
36
|
+
columns && columns.length > 0
|
|
37
|
+
? "ax:grid-cols-1 ax:md:grid-cols-[1fr_repeat(var(--col-count),auto)]"
|
|
38
|
+
: "ax:grid-cols-1"
|
|
39
|
+
)}
|
|
40
|
+
style={columns ? { "--col-count": String(Math.min(columns.length, 4)) } as React.CSSProperties : undefined}
|
|
41
|
+
>
|
|
42
|
+
{(brand || tagline) && (
|
|
43
|
+
<div className="ax:flex ax:flex-col ax:gap-sm ax:max-w-xs">
|
|
44
|
+
{brand}
|
|
45
|
+
{tagline && <p className="ax:t-body-sm ax:text-muted-foreground">{tagline}</p>}
|
|
46
|
+
{social && <div className="ax:flex ax:gap-sm ax:mt-xs">{social}</div>}
|
|
47
|
+
</div>
|
|
48
|
+
)}
|
|
49
|
+
{columns?.map((col) => (
|
|
50
|
+
<div key={col.heading} className="ax:flex ax:flex-col ax:gap-sm">
|
|
51
|
+
<div className="ax:t-overline ax:text-foreground">
|
|
52
|
+
{col.heading}
|
|
53
|
+
</div>
|
|
54
|
+
<ul className="ax:space-y-2.5">
|
|
55
|
+
{col.links.map((link) => (
|
|
56
|
+
<li key={link.label}>
|
|
57
|
+
<a
|
|
58
|
+
href={link.href}
|
|
59
|
+
className="ax:t-body-sm ax:text-muted-foreground ax:hover:text-foreground ax:transition-colors"
|
|
60
|
+
>
|
|
61
|
+
{link.label}
|
|
62
|
+
</a>
|
|
63
|
+
</li>
|
|
64
|
+
))}
|
|
65
|
+
</ul>
|
|
66
|
+
</div>
|
|
67
|
+
))}
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
{legal && (
|
|
71
|
+
<div className="ax:mt-3xl ax:pt-xl ax:border-t ax:border-border ax:t-caption ax:text-muted-foreground">
|
|
72
|
+
{legal}
|
|
73
|
+
</div>
|
|
74
|
+
)}
|
|
75
|
+
</div>
|
|
76
|
+
</footer>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { Heading, type HeadingSize } from "./heading"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Heading> = {
|
|
6
|
+
title: "Components/Heading",
|
|
7
|
+
component: Heading,
|
|
8
|
+
tags: ["autodocs"],
|
|
9
|
+
argTypes: {
|
|
10
|
+
as: { control: "select", options: ["h1", "h2", "h3", "h4", "h5", "h6"] },
|
|
11
|
+
color: { control: "select", options: ["default", "strong", "muted", "primary"] },
|
|
12
|
+
},
|
|
13
|
+
args: {
|
|
14
|
+
as: "h2",
|
|
15
|
+
children: "Manage every unit in one place",
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export default meta
|
|
20
|
+
type Story = StoryObj<typeof Heading>
|
|
21
|
+
|
|
22
|
+
export const Default: Story = {}
|
|
23
|
+
|
|
24
|
+
/** The level stays `h1` for the outline while the look drops to `h3`. */
|
|
25
|
+
export const LevelDiffersFromSize: Story = {
|
|
26
|
+
args: { as: "h1", size: "h3", children: "Welcome back" },
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const SIZES: HeadingSize[] = [
|
|
30
|
+
"display-2xl", "display-xl", "display-lg", "display-md", "display-sm",
|
|
31
|
+
"h1", "h2", "h3", "h4", "h5", "h6",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
export const Scale: Story = {
|
|
35
|
+
render: () => (
|
|
36
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "1rem" }}>
|
|
37
|
+
{SIZES.map((size) => (
|
|
38
|
+
<div key={size} style={{ display: "flex", alignItems: "baseline", gap: "1rem" }}>
|
|
39
|
+
<code style={{ minWidth: "8rem" }}>size="{size}"</code>
|
|
40
|
+
<Heading as="h2" size={size}>The quick brown fox</Heading>
|
|
41
|
+
</div>
|
|
42
|
+
))}
|
|
43
|
+
</div>
|
|
44
|
+
),
|
|
45
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import * as React from "react"
|
|
3
|
+
import { renderToStaticMarkup } from "react-dom/server"
|
|
4
|
+
import { Heading } from "./heading"
|
|
5
|
+
|
|
6
|
+
describe("Heading", () => {
|
|
7
|
+
it("defaults to an h2 styled as h2", () => {
|
|
8
|
+
const html = renderToStaticMarkup(<Heading>Title</Heading>)
|
|
9
|
+
expect(html).toMatch(/^<h2 class="[^"]*ax:t-h2/)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it("takes its size from the level when size is omitted", () => {
|
|
13
|
+
expect(renderToStaticMarkup(<Heading as="h4">Title</Heading>)).toContain("ax:t-h4")
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it("keeps the level when size differs", () => {
|
|
17
|
+
const html = renderToStaticMarkup(<Heading as="h1" size="h3">Title</Heading>)
|
|
18
|
+
expect(html).toMatch(/^<h1 /)
|
|
19
|
+
expect(html).toContain("ax:t-h3")
|
|
20
|
+
expect(html).not.toContain("ax:t-h1")
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { tv, type VariantProps } from "tailwind-variants"
|
|
3
|
+
import { cn } from "../lib/cn"
|
|
4
|
+
|
|
5
|
+
export type HeadingAs = "h1" | "h2" | "h3" | "h4" | "h5" | "h6"
|
|
6
|
+
export type HeadingSize =
|
|
7
|
+
| "display-2xl" | "display-xl" | "display-lg" | "display-md" | "display-sm"
|
|
8
|
+
| "h1" | "h2" | "h3" | "h4" | "h5" | "h6"
|
|
9
|
+
export type HeadingColor = "default" | "strong" | "muted" | "primary"
|
|
10
|
+
export type HeadingAlign = "left" | "center" | "right"
|
|
11
|
+
export type HeadingWrap = "wrap" | "balance" | "pretty"
|
|
12
|
+
|
|
13
|
+
/** Sizes are the t-* heading and display utilities from typography.css, so brand overrides apply. */
|
|
14
|
+
export const headingVariants = tv({
|
|
15
|
+
variants: {
|
|
16
|
+
size: {
|
|
17
|
+
"display-2xl": "ax:t-display-2xl",
|
|
18
|
+
"display-xl": "ax:t-display-xl",
|
|
19
|
+
"display-lg": "ax:t-display-lg",
|
|
20
|
+
"display-md": "ax:t-display-md",
|
|
21
|
+
"display-sm": "ax:t-display-sm",
|
|
22
|
+
h1: "ax:t-h1",
|
|
23
|
+
h2: "ax:t-h2",
|
|
24
|
+
h3: "ax:t-h3",
|
|
25
|
+
h4: "ax:t-h4",
|
|
26
|
+
h5: "ax:t-h5",
|
|
27
|
+
h6: "ax:t-h6",
|
|
28
|
+
},
|
|
29
|
+
color: {
|
|
30
|
+
default: "ax:text-foreground",
|
|
31
|
+
strong: "ax:text-foreground-strong",
|
|
32
|
+
muted: "ax:text-muted-foreground",
|
|
33
|
+
primary: "ax:text-primary-foreground",
|
|
34
|
+
},
|
|
35
|
+
align: {
|
|
36
|
+
left: "ax:text-left",
|
|
37
|
+
center: "ax:text-center",
|
|
38
|
+
right: "ax:text-right",
|
|
39
|
+
},
|
|
40
|
+
wrap: {
|
|
41
|
+
wrap: "ax:text-wrap",
|
|
42
|
+
balance: "ax:text-balance",
|
|
43
|
+
pretty: "ax:text-pretty",
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
defaultVariants: {
|
|
47
|
+
color: "default",
|
|
48
|
+
},
|
|
49
|
+
}, { twMerge: false })
|
|
50
|
+
|
|
51
|
+
export interface HeadingProps
|
|
52
|
+
extends Omit<React.HTMLAttributes<HTMLHeadingElement>, "color">,
|
|
53
|
+
VariantProps<typeof headingVariants> {
|
|
54
|
+
/** The heading level, chosen for document outline. Defaults to `h2`. */
|
|
55
|
+
as?: HeadingAs
|
|
56
|
+
truncate?: boolean
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Semantic heading. `as` sets the level for the document outline; `size` sets
|
|
61
|
+
* the look and defaults to the matching level, so the two can differ when a
|
|
62
|
+
* page needs, say, an `h1` that reads at `h3` size.
|
|
63
|
+
*/
|
|
64
|
+
export const Heading = React.forwardRef<HTMLHeadingElement, HeadingProps>(
|
|
65
|
+
({ as: Tag = "h2", size, color, align, wrap, truncate, className, ...props }, ref) => (
|
|
66
|
+
<Tag
|
|
67
|
+
ref={ref}
|
|
68
|
+
className={cn(
|
|
69
|
+
headingVariants({ size: size ?? Tag, color, align, wrap }),
|
|
70
|
+
truncate && "ax:truncate",
|
|
71
|
+
className,
|
|
72
|
+
)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
),
|
|
76
|
+
)
|
|
77
|
+
Heading.displayName = "Heading"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from "react"
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
3
|
+
import { Button } from "./button"
|
|
4
|
+
import { Hero } from "./hero"
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Hero> = {
|
|
7
|
+
title: "Components/Hero",
|
|
8
|
+
component: Hero,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
args: {
|
|
11
|
+
eyebrow: "Design system",
|
|
12
|
+
headline: "Build beautiful products across every brand",
|
|
13
|
+
description: "Shared components, unique themes, one codebase.",
|
|
14
|
+
actions: (
|
|
15
|
+
<>
|
|
16
|
+
<Button>Get started</Button>
|
|
17
|
+
<Button variant="outline">View docs</Button>
|
|
18
|
+
</>
|
|
19
|
+
),
|
|
20
|
+
layout: "centered",
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default meta
|
|
25
|
+
type Story = StoryObj<typeof Hero>
|
|
26
|
+
|
|
27
|
+
export const Default: Story = {}
|
|
28
|
+
|
|
29
|
+
export const Split: Story = {
|
|
30
|
+
args: {
|
|
31
|
+
layout: "split",
|
|
32
|
+
media: (
|
|
33
|
+
<div className="ax:flex ax:h-full ax:min-h-[240px] ax:items-center ax:justify-center ax:bg-muted ax:text-muted-foreground">
|
|
34
|
+
Media slot
|
|
35
|
+
</div>
|
|
36
|
+
),
|
|
37
|
+
},
|
|
38
|
+
}
|