@sproutsocial/seeds-react-narrative-kit 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +11 -11
- package/CHANGELOG.md +28 -0
- package/dist/esm/index.js +324 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/eyebrow-token.css +37 -0
- package/dist/index.d.mts +304 -1
- package/dist/index.d.ts +304 -1
- package/dist/index.js +333 -3
- package/dist/index.js.map +1 -1
- package/dist/metric-highlight.css +168 -0
- package/dist/narrative-container.css +1 -1
- package/dist/narrative-divider.css +27 -0
- package/dist/narrative-headline.css +132 -0
- package/dist/narrative-summary.css +126 -0
- package/dist/pull-quote.css +89 -0
- package/package.json +13 -3
- package/src/EyebrowToken/EyebrowToken.stories.tsx +25 -0
- package/src/EyebrowToken/EyebrowToken.tsx +25 -0
- package/src/EyebrowToken/EyebrowTokenTypes.ts +7 -0
- package/src/EyebrowToken/__tests__/EyebrowToken.test.tsx +35 -0
- package/src/EyebrowToken/index.ts +2 -0
- package/src/MetricHighlight/MetricHighlight.stories.tsx +110 -0
- package/src/MetricHighlight/MetricHighlight.tsx +116 -0
- package/src/MetricHighlight/MetricHighlightTypes.ts +58 -0
- package/src/MetricHighlight/__tests__/MetricHighlight.test.tsx +116 -0
- package/src/MetricHighlight/index.ts +5 -0
- package/src/NarrativeContainer/NarrativeContainer.stories.tsx +3 -3
- package/src/NarrativeContainer/NarrativeContainer.tsx +1 -23
- package/src/NarrativeDivider/NarrativeDivider.stories.tsx +33 -0
- package/src/NarrativeDivider/NarrativeDivider.tsx +30 -0
- package/src/NarrativeDivider/NarrativeDividerTypes.ts +4 -0
- package/src/NarrativeDivider/__tests__/NarrativeDivider.test.tsx +35 -0
- package/src/NarrativeDivider/index.ts +2 -0
- package/src/NarrativeHeadline/NarrativeHeadline.stories.tsx +68 -0
- package/src/NarrativeHeadline/NarrativeHeadline.tsx +45 -0
- package/src/NarrativeHeadline/NarrativeHeadlineHighlight.tsx +31 -0
- package/src/NarrativeHeadline/NarrativeHeadlineRoll.tsx +103 -0
- package/src/NarrativeHeadline/NarrativeHeadlineTypes.ts +63 -0
- package/src/NarrativeHeadline/__tests__/NarrativeHeadline.test.tsx +133 -0
- package/src/NarrativeHeadline/index.ts +10 -0
- package/src/NarrativeSummary/NarrativeSummary.stories.tsx +79 -0
- package/src/NarrativeSummary/NarrativeSummary.tsx +98 -0
- package/src/NarrativeSummary/NarrativeSummaryTypes.ts +59 -0
- package/src/NarrativeSummary/__tests__/NarrativeSummary.test.tsx +99 -0
- package/src/NarrativeSummary/index.ts +5 -0
- package/src/Playground/Playground.stories.tsx +163 -0
- package/src/PullQuote/PullQuote.stories.tsx +45 -0
- package/src/PullQuote/PullQuote.tsx +42 -0
- package/src/PullQuote/PullQuoteTypes.ts +18 -0
- package/src/PullQuote/__tests__/PullQuote.test.tsx +48 -0
- package/src/PullQuote/index.ts +2 -0
- package/src/_internal/cn.ts +22 -0
- package/src/eyebrow-token.css +37 -0
- package/src/index.ts +31 -0
- package/src/metric-highlight.css +168 -0
- package/src/narrative-container.css +1 -1
- package/src/narrative-divider.css +27 -0
- package/src/narrative-headline.css +132 -0
- package/src/narrative-summary.css +126 -0
- package/src/pull-quote.css +89 -0
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import Grid from "@sproutsocial/seeds-react-grid";
|
|
4
|
+
import NarrativeContainer from "../NarrativeContainer/NarrativeContainer";
|
|
5
|
+
import NarrativeHeadline from "../NarrativeHeadline/NarrativeHeadline";
|
|
6
|
+
import NarrativeHeadlineHighlight from "../NarrativeHeadline/NarrativeHeadlineHighlight";
|
|
7
|
+
import NarrativeHeadlineRoll from "../NarrativeHeadline/NarrativeHeadlineRoll";
|
|
8
|
+
import PullQuote from "../PullQuote/PullQuote";
|
|
9
|
+
import MetricHighlight from "../MetricHighlight/MetricHighlight";
|
|
10
|
+
import EyebrowToken from "../EyebrowToken/EyebrowToken";
|
|
11
|
+
import NarrativeDivider from "../NarrativeDivider/NarrativeDivider";
|
|
12
|
+
import NarrativeSummary from "../NarrativeSummary/NarrativeSummary";
|
|
13
|
+
import Button from "@sproutsocial/seeds-react-button";
|
|
14
|
+
import Text from "@sproutsocial/seeds-react-text";
|
|
15
|
+
import { SparklineChart } from "@sproutsocial/seeds-react-data-viz/sparkline";
|
|
16
|
+
import "../narrative-container.css";
|
|
17
|
+
import "../narrative-headline.css";
|
|
18
|
+
import "../pull-quote.css";
|
|
19
|
+
import "../metric-highlight.css";
|
|
20
|
+
import "../eyebrow-token.css";
|
|
21
|
+
import "../narrative-divider.css";
|
|
22
|
+
import "../narrative-summary.css";
|
|
23
|
+
import "@sproutsocial/seeds-react-button/dist/button.css";
|
|
24
|
+
import "@sproutsocial/seeds-react-data-viz/sparkline.css";
|
|
25
|
+
|
|
26
|
+
const spark = (data: number[]) => (
|
|
27
|
+
<SparklineChart
|
|
28
|
+
variant="line"
|
|
29
|
+
description="Trend"
|
|
30
|
+
data={data}
|
|
31
|
+
className="h-full w-full"
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Narrative Kit — Playground (showcase story)
|
|
37
|
+
* ============================================
|
|
38
|
+
* A living showcase that composes the narrative primitives exactly as an agent
|
|
39
|
+
* would assemble them in production. It only ever uses primitives that have
|
|
40
|
+
* actually shipped in the kit — as new ones land, drop them in here and the
|
|
41
|
+
* showcase grows with the ecosystem.
|
|
42
|
+
*
|
|
43
|
+
* Today's shipped primitives: NarrativeContainer, NarrativeHeadline
|
|
44
|
+
* (+ Highlight / + Roll), PullQuote, and MetricHighlight. Layout uses
|
|
45
|
+
* `@sproutsocial/seeds-react-grid` to arrange the containers.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
const Attribution = ({ name }: { name: string }) => (
|
|
49
|
+
<>
|
|
50
|
+
<span aria-hidden className="text-400">
|
|
51
|
+
🧵
|
|
52
|
+
</span>
|
|
53
|
+
<span>{name}</span>
|
|
54
|
+
</>
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const Brief = () => (
|
|
58
|
+
<div className="box-border min-h-screen p-600 bg-app-bg-base">
|
|
59
|
+
<div className="max-w-280 mx-auto grid gap-500">
|
|
60
|
+
<span>
|
|
61
|
+
<EyebrowToken className="mb-300 inline-flex">May 31, 2026</EyebrowToken>
|
|
62
|
+
<NarrativeHeadline headingLevel={1}>
|
|
63
|
+
The social suite built for{" "}
|
|
64
|
+
<NarrativeHeadlineRoll
|
|
65
|
+
words={["marketers", "agencies", "enterprise teams", "founders"]}
|
|
66
|
+
/>
|
|
67
|
+
</NarrativeHeadline>
|
|
68
|
+
<Text.BodyCopy mt={400} display="block" width="50ch">
|
|
69
|
+
Empowering cross-functional stakeholders to drive engagement at scale
|
|
70
|
+
and accelerate time-to-value through data-driven content strategies
|
|
71
|
+
aligned with your brand's north-star KPIs.
|
|
72
|
+
</Text.BodyCopy>
|
|
73
|
+
</span>
|
|
74
|
+
|
|
75
|
+
{/* Pull quotes ------------------------------------------------------- */}
|
|
76
|
+
<NarrativeContainer className="w-full">
|
|
77
|
+
<Grid columns={{ sm: 1, md: 1 }} gap={500}>
|
|
78
|
+
{/* Metric highlights — a row of 3 -------------------------------- */}
|
|
79
|
+
<Grid columns={{ sm: 1, md: 2, lg: 3 }} gap={400}>
|
|
80
|
+
<MetricHighlight
|
|
81
|
+
label="Impressions"
|
|
82
|
+
value="1.2M"
|
|
83
|
+
trend={{ direction: "up", value: "18%", "aria-label": "up 18%" }}
|
|
84
|
+
sparkline={spark([8, 12, 9, 15, 13, 19])}
|
|
85
|
+
/>
|
|
86
|
+
<MetricHighlight
|
|
87
|
+
label="Engagement rate"
|
|
88
|
+
value="6.4%"
|
|
89
|
+
trend={{ direction: "up", value: "240%", "aria-label": "up 240%" }}
|
|
90
|
+
sparkline={spark([3, 5, 4, 7, 6, 9])}
|
|
91
|
+
/>
|
|
92
|
+
<MetricHighlight
|
|
93
|
+
label="Response time"
|
|
94
|
+
value="2h"
|
|
95
|
+
trend={{ direction: "down", value: "12%", "aria-label": "down 12%" }}
|
|
96
|
+
sparkline={spark([18, 16, 17, 13, 14, 10])}
|
|
97
|
+
/>
|
|
98
|
+
</Grid>
|
|
99
|
+
|
|
100
|
+
{/* Divider — separates the metric row from the narrative below --- */}
|
|
101
|
+
<NarrativeDivider />
|
|
102
|
+
|
|
103
|
+
{/* Narrative summary (2-column) — between the pull quotes -------- */}
|
|
104
|
+
<NarrativeSummary
|
|
105
|
+
layout="two-column"
|
|
106
|
+
eyebrow="June 10th"
|
|
107
|
+
headline="Engagement climbed across every owned channel this month"
|
|
108
|
+
summary="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec odio leo, gravida vitae sodales vitae, tempor eget ligula. Vestibulum nec enim eget mi placerat finibus. Donec tempor tincidunt elit."
|
|
109
|
+
keyThemes={[
|
|
110
|
+
"Reply threads outperformed paid pushes for the week.",
|
|
111
|
+
"Average response time dropped nearly in half.",
|
|
112
|
+
"Enterprise segment drove the largest share of new engagement.",
|
|
113
|
+
]}
|
|
114
|
+
/>
|
|
115
|
+
|
|
116
|
+
<PullQuote
|
|
117
|
+
quote="The reply thread on the 18th outperformed our entire paid push for the week."
|
|
118
|
+
attribution={<Attribution name="Jordan Lee" />}
|
|
119
|
+
/>
|
|
120
|
+
|
|
121
|
+
<NarrativeDivider />
|
|
122
|
+
|
|
123
|
+
{/* Narrative summary (3-column) — below the pull quotes --------- */}
|
|
124
|
+
<NarrativeSummary
|
|
125
|
+
eyebrow="Quarterly review"
|
|
126
|
+
headline="Three themes defined the quarter for the brand"
|
|
127
|
+
action={<Button appearance="primary">View report</Button>}
|
|
128
|
+
summary="Praesent pretium libero vitae arcu blandit pellentesque. Aenean fermentum, nisi eu blandit placerat, ligula ligula euismod ante, id semper nibh diam ac ipsum."
|
|
129
|
+
keyThemes={[
|
|
130
|
+
"Owned channels outpaced paid across every region.",
|
|
131
|
+
"Response time held under two hours through peak weeks.",
|
|
132
|
+
"Sentiment trended positive after the product launch.",
|
|
133
|
+
]}
|
|
134
|
+
/>
|
|
135
|
+
|
|
136
|
+
<PullQuote
|
|
137
|
+
appearance="vivid"
|
|
138
|
+
quote="This rollout cut our average response time nearly in half."
|
|
139
|
+
attribution={<Attribution name="Priya Nair" />}
|
|
140
|
+
/>
|
|
141
|
+
</Grid>
|
|
142
|
+
</NarrativeContainer>
|
|
143
|
+
</div>
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
|
|
147
|
+
const meta: Meta = {
|
|
148
|
+
title: "Narrative Kit/Playground",
|
|
149
|
+
parameters: {
|
|
150
|
+
layout: "fullscreen",
|
|
151
|
+
},
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export default meta;
|
|
155
|
+
type Story = StoryObj<typeof meta>;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* The showcase brief. Resize the canvas to watch the Grid reflow from 2 → 1
|
|
159
|
+
* column. Toggle dark mode (Storybook toolbar) to verify token-driven theming.
|
|
160
|
+
*/
|
|
161
|
+
export const ExecutiveBrief: Story = {
|
|
162
|
+
render: () => <Brief />,
|
|
163
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
3
|
+
import PullQuote from "./PullQuote";
|
|
4
|
+
import "../pull-quote.css";
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Narrative Kit/PullQuote",
|
|
8
|
+
component: PullQuote,
|
|
9
|
+
args: {
|
|
10
|
+
quote: "This rollout cut our average response time nearly in half.",
|
|
11
|
+
},
|
|
12
|
+
} satisfies Meta<typeof PullQuote>;
|
|
13
|
+
|
|
14
|
+
export default meta;
|
|
15
|
+
type Story = StoryObj<typeof meta>;
|
|
16
|
+
|
|
17
|
+
const Attribution = () => (
|
|
18
|
+
<>
|
|
19
|
+
<span aria-hidden className="text-400">
|
|
20
|
+
🧵
|
|
21
|
+
</span>
|
|
22
|
+
<span>Display Name</span>
|
|
23
|
+
</>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export const Subtle: Story = {
|
|
27
|
+
args: {
|
|
28
|
+
className: "w-80",
|
|
29
|
+
attribution: <Attribution />,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export const Vivid: Story = {
|
|
34
|
+
args: {
|
|
35
|
+
className: "w-80",
|
|
36
|
+
appearance: "vivid",
|
|
37
|
+
attribution: <Attribution />,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const WithoutAttribution: Story = {
|
|
42
|
+
args: {
|
|
43
|
+
className: "w-80",
|
|
44
|
+
},
|
|
45
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { cn } from "../_internal/cn";
|
|
3
|
+
import type { TypePullQuoteProps } from "./PullQuoteTypes";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* PullQuote — a narrative primitive that spotlights a quotation on an AI
|
|
7
|
+
* gradient surface. The quote sits behind an accented vertical bar with an
|
|
8
|
+
* optional attribution row (author name, avatar, network).
|
|
9
|
+
*
|
|
10
|
+
* Rendered as semantic `<figure>` / `<blockquote>` / `<figcaption>` markup.
|
|
11
|
+
* Styled via `pull-quote.css` (Seeds CSS custom properties); consumers import
|
|
12
|
+
* the classes through `@sproutsocial/racine/css/components`. Surface overrides
|
|
13
|
+
* are done with standard `className` / `style`.
|
|
14
|
+
*/
|
|
15
|
+
const PullQuote = React.forwardRef<HTMLElement, TypePullQuoteProps>(
|
|
16
|
+
({ quote, attribution, appearance = "subtle", className, ...props }, ref) => {
|
|
17
|
+
return (
|
|
18
|
+
<figure
|
|
19
|
+
ref={ref}
|
|
20
|
+
className={cn(
|
|
21
|
+
"seeds-pull-quote",
|
|
22
|
+
{ "seeds-pull-quote-vivid": appearance === "vivid" },
|
|
23
|
+
className
|
|
24
|
+
)}
|
|
25
|
+
{...props}
|
|
26
|
+
>
|
|
27
|
+
<div className="seeds-pull-quote-bar">
|
|
28
|
+
<blockquote className="seeds-pull-quote-text">{quote}</blockquote>
|
|
29
|
+
{attribution != null && (
|
|
30
|
+
<figcaption className="seeds-pull-quote-attribution">
|
|
31
|
+
{attribution}
|
|
32
|
+
</figcaption>
|
|
33
|
+
)}
|
|
34
|
+
</div>
|
|
35
|
+
</figure>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
PullQuote.displayName = "PullQuote";
|
|
41
|
+
|
|
42
|
+
export default PullQuote;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as React from "react";
|
|
2
|
+
|
|
3
|
+
export interface TypePullQuoteProps extends React.HTMLAttributes<HTMLElement> {
|
|
4
|
+
/** The quotation text, rendered emphasized inside the accented bar. */
|
|
5
|
+
quote: React.ReactNode;
|
|
6
|
+
/**
|
|
7
|
+
* Optional attribution slot rendered beneath the quote (e.g. an author name,
|
|
8
|
+
* avatar, and network). Composed by the consumer; omitted entirely when absent.
|
|
9
|
+
*/
|
|
10
|
+
attribution?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Visual treatment of the AI gradient surface.
|
|
13
|
+
* - `subtle` — a light 20% gradient tint over the base surface with dark text.
|
|
14
|
+
* - `vivid` — the full-saturation AI gradient with white text.
|
|
15
|
+
* @default "subtle"
|
|
16
|
+
*/
|
|
17
|
+
appearance?: "subtle" | "vivid";
|
|
18
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { render, screen } from "@sproutsocial/seeds-react-testing-library";
|
|
3
|
+
import PullQuote from "../PullQuote";
|
|
4
|
+
|
|
5
|
+
describe("PullQuote", () => {
|
|
6
|
+
it("renders the quote text in a blockquote", () => {
|
|
7
|
+
render(<PullQuote quote="A memorable line" />);
|
|
8
|
+
|
|
9
|
+
const quote = screen.getByText("A memorable line");
|
|
10
|
+
expect(quote).toBeInTheDocument();
|
|
11
|
+
expect(quote.tagName).toBe("BLOCKQUOTE");
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it("renders the attribution in a figcaption when provided", () => {
|
|
15
|
+
const { container } = render(
|
|
16
|
+
<PullQuote quote="A line" attribution={<span>Jane Doe</span>} />
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
expect(screen.getByText("Jane Doe")).toBeInTheDocument();
|
|
20
|
+
expect(container.querySelector("figcaption")).toBeInTheDocument();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("omits the figcaption when no attribution is provided", () => {
|
|
24
|
+
const { container } = render(<PullQuote quote="A line" />);
|
|
25
|
+
|
|
26
|
+
expect(container.querySelector("figcaption")).not.toBeInTheDocument();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("applies the vivid modifier only for the vivid appearance", () => {
|
|
30
|
+
const { container, rerender } = render(<PullQuote quote="A line" />);
|
|
31
|
+
expect(
|
|
32
|
+
container.querySelector(".seeds-pull-quote-vivid")
|
|
33
|
+
).not.toBeInTheDocument();
|
|
34
|
+
|
|
35
|
+
rerender(<PullQuote quote="A line" appearance="vivid" />);
|
|
36
|
+
expect(
|
|
37
|
+
container.querySelector(".seeds-pull-quote-vivid")
|
|
38
|
+
).toBeInTheDocument();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("forwards its ref to the underlying figure element", () => {
|
|
42
|
+
const ref = React.createRef<HTMLElement>();
|
|
43
|
+
render(<PullQuote ref={ref} quote="A line" />);
|
|
44
|
+
|
|
45
|
+
expect(ref.current).toBeInstanceOf(HTMLElement);
|
|
46
|
+
expect(ref.current?.tagName).toBe("FIGURE");
|
|
47
|
+
});
|
|
48
|
+
});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Merge class names, supporting `{ "class": boolean }` toggles. */
|
|
2
|
+
export function cn(
|
|
3
|
+
...inputs: (string | undefined | null | false | Record<string, boolean>)[]
|
|
4
|
+
): string {
|
|
5
|
+
const classes: string[] = [];
|
|
6
|
+
|
|
7
|
+
for (const input of inputs) {
|
|
8
|
+
if (!input) continue;
|
|
9
|
+
|
|
10
|
+
if (typeof input === "string") {
|
|
11
|
+
classes.push(input);
|
|
12
|
+
} else if (typeof input === "object") {
|
|
13
|
+
for (const [key, value] of Object.entries(input)) {
|
|
14
|
+
if (value) {
|
|
15
|
+
classes.push(key);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return classes.join(" ");
|
|
22
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds EyebrowToken component classes.
|
|
3
|
+
* Use these instead of writing out individual Tailwind utility classes.
|
|
4
|
+
*
|
|
5
|
+
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css imported for
|
|
6
|
+
* CSS variable definitions and dark mode support.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* <span class="seeds-eyebrow-token">May 31, 2026</span>
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
@layer components {
|
|
13
|
+
|
|
14
|
+
/* A solid gray pill matching the design: background and border are both the
|
|
15
|
+
#dee1e1 container-border-base token, which also tracks dark mode. The two
|
|
16
|
+
pixel literals below have no exact theme token — the --space scale skips 6px
|
|
17
|
+
(4px→8px) and the --font-size scale skips 12px (11px→13px) — so the design's
|
|
18
|
+
values are kept verbatim. All colors use tokens. */
|
|
19
|
+
.seeds-eyebrow-token {
|
|
20
|
+
box-sizing: border-box;
|
|
21
|
+
display: inline-flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
justify-content: center;
|
|
24
|
+
gap: var(--space-100); /* 2px */
|
|
25
|
+
padding: var(--space-100) var(--space-300); /* 2px / 8px */
|
|
26
|
+
border: 1px solid var(--color-container-border-base); /* #dee1e1 */
|
|
27
|
+
border-radius: var(--radius-500); /* 6px */
|
|
28
|
+
background-color: var(--color-container-border-base); /* #dee1e1 */
|
|
29
|
+
font-family: var(--font-family);
|
|
30
|
+
font-size: 12px; /* text-sm */
|
|
31
|
+
line-height: 20px;
|
|
32
|
+
font-weight: var(--font-weight-normal);
|
|
33
|
+
color: var(--color-text-body);
|
|
34
|
+
white-space: nowrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -5,4 +5,35 @@ export {
|
|
|
5
5
|
type TypeNarrativeContainerProps,
|
|
6
6
|
} from "./NarrativeContainer";
|
|
7
7
|
|
|
8
|
+
export {
|
|
9
|
+
NarrativeHeadline,
|
|
10
|
+
NarrativeHeadlineHighlight,
|
|
11
|
+
NarrativeHeadlineRoll,
|
|
12
|
+
type TypeNarrativeHeadlineProps,
|
|
13
|
+
type TypeNarrativeHeadlineLevel,
|
|
14
|
+
type TypeNarrativeHeadlineHighlightProps,
|
|
15
|
+
type TypeNarrativeHeadlineRollProps,
|
|
16
|
+
} from "./NarrativeHeadline";
|
|
17
|
+
|
|
18
|
+
export { PullQuote, type TypePullQuoteProps } from "./PullQuote";
|
|
19
|
+
|
|
20
|
+
export { EyebrowToken, type TypeEyebrowTokenProps } from "./EyebrowToken";
|
|
21
|
+
|
|
22
|
+
export {
|
|
23
|
+
NarrativeDivider,
|
|
24
|
+
type TypeNarrativeDividerProps,
|
|
25
|
+
} from "./NarrativeDivider";
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
MetricHighlight,
|
|
29
|
+
type TypeMetricHighlightProps,
|
|
30
|
+
type TypeMetricHighlightTrend,
|
|
31
|
+
} from "./MetricHighlight";
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
NarrativeSummary,
|
|
35
|
+
type TypeNarrativeSummaryProps,
|
|
36
|
+
type TypeNarrativeSummaryLayout,
|
|
37
|
+
} from "./NarrativeSummary";
|
|
38
|
+
|
|
8
39
|
export type { TypeNarrativeTone } from "./_internal/types";
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds MetricHighlight component classes.
|
|
3
|
+
* Use these instead of writing out individual Tailwind utility classes.
|
|
4
|
+
*
|
|
5
|
+
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css imported for
|
|
6
|
+
* CSS variable definitions and dark mode support.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* <div class="seeds-metric-highlight">…</div> // horizontal, default
|
|
10
|
+
* <div class="seeds-metric-highlight seeds-metric-highlight-vertical">…</div>
|
|
11
|
+
* <div class="seeds-metric-highlight seeds-metric-highlight-small">…</div>
|
|
12
|
+
* <div class="seeds-metric-highlight seeds-metric-highlight-bare">…</div> // no surface
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
@layer components {
|
|
16
|
+
|
|
17
|
+
.seeds-metric-highlight {
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
display: flex;
|
|
20
|
+
align-items: flex-start;
|
|
21
|
+
gap: var(--space-350); /* 12px */
|
|
22
|
+
border-radius: var(--radius-800); /* 12px */
|
|
23
|
+
font-family: var(--font-family);
|
|
24
|
+
/* Container (default): a padded gray app surface (matches the design's
|
|
25
|
+
#f3f4f4 box). `-bare` strips it. */
|
|
26
|
+
padding: var(--space-400) var(--space-450); /* 16px / 24px */
|
|
27
|
+
background-color: var(--color-app-bg-base);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.seeds-metric-highlight-bare {
|
|
31
|
+
padding: 0;
|
|
32
|
+
background-color: transparent;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.seeds-metric-highlight-vertical {
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* The metric block: label + value/trend. Grows to fill the row in horizontal. */
|
|
40
|
+
.seeds-metric-highlight-metric {
|
|
41
|
+
box-sizing: border-box;
|
|
42
|
+
display: flex;
|
|
43
|
+
flex-direction: column;
|
|
44
|
+
align-items: flex-start;
|
|
45
|
+
gap: var(--space-200); /* 4px */
|
|
46
|
+
flex: 1 0 0;
|
|
47
|
+
min-width: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.seeds-metric-highlight-vertical .seeds-metric-highlight-metric {
|
|
51
|
+
width: 100%;
|
|
52
|
+
flex: 0 0 auto;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* Small: label and value collapse onto a single centered row. */
|
|
56
|
+
.seeds-metric-highlight-small .seeds-metric-highlight-metric {
|
|
57
|
+
flex-direction: row;
|
|
58
|
+
align-items: center;
|
|
59
|
+
gap: var(--space-300); /* 8px */
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.seeds-metric-highlight-label {
|
|
63
|
+
margin: 0;
|
|
64
|
+
font-size: var(--font-size-300); /* 16px */
|
|
65
|
+
line-height: var(--line-height-400); /* ~28px */
|
|
66
|
+
font-weight: var(--font-weight-normal);
|
|
67
|
+
color: var(--color-text-body);
|
|
68
|
+
overflow-wrap: break-word;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* In small, the label takes the slack so the value/trend align to the end. */
|
|
72
|
+
.seeds-metric-highlight-small .seeds-metric-highlight-label {
|
|
73
|
+
flex: 1 0 0;
|
|
74
|
+
min-width: 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.seeds-metric-highlight-value-row {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: var(--space-300); /* 8px */
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.seeds-metric-highlight-small .seeds-metric-highlight-value-row {
|
|
84
|
+
justify-content: flex-end;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.seeds-metric-highlight-value {
|
|
88
|
+
margin: 0;
|
|
89
|
+
/* No mono token exists yet; fall back to a system monospace stack. Mirrors the
|
|
90
|
+
font/font-mono treatment in the design. */
|
|
91
|
+
font-family: var(--font-family-mono, ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace);
|
|
92
|
+
font-size: var(--font-size-700); /* 32px */
|
|
93
|
+
line-height: var(--line-height-700); /* 40px */
|
|
94
|
+
font-weight: var(--font-weight-bold);
|
|
95
|
+
color: var(--color-text-headline);
|
|
96
|
+
white-space: nowrap;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.seeds-metric-highlight-small .seeds-metric-highlight-value {
|
|
100
|
+
font-size: var(--font-size-600); /* 24px */
|
|
101
|
+
line-height: var(--line-height-600); /* 32px */
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/* Trend badge — a rounded pill. Up is the positive (green) treatment; down
|
|
105
|
+
swaps to the negative (red) treatment. Color flows to the arrow + value via
|
|
106
|
+
currentColor. */
|
|
107
|
+
.seeds-metric-highlight-trend {
|
|
108
|
+
display: inline-flex;
|
|
109
|
+
align-items: center;
|
|
110
|
+
gap: var(--space-200); /* 4px */
|
|
111
|
+
padding: var(--space-100) var(--space-300); /* 2px / 8px */
|
|
112
|
+
border-radius: 999px;
|
|
113
|
+
font-size: var(--font-size-200); /* 13px */
|
|
114
|
+
line-height: var(--line-height-200);
|
|
115
|
+
font-weight: var(--font-weight-bold);
|
|
116
|
+
white-space: nowrap;
|
|
117
|
+
background-color: var(--color-container-bg-decorative-green);
|
|
118
|
+
color: var(--color-text-decorative-green);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.seeds-metric-highlight-trend-down {
|
|
122
|
+
background-color: var(--color-container-bg-decorative-red);
|
|
123
|
+
color: var(--color-text-decorative-red);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.seeds-metric-highlight-trend-arrow {
|
|
127
|
+
flex: 0 0 auto;
|
|
128
|
+
width: 1em;
|
|
129
|
+
height: 1em;
|
|
130
|
+
stroke: currentColor;
|
|
131
|
+
stroke-width: 1.5;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/* Slot for an injected chart (e.g. a data-viz SparklineChart). Layout only — no
|
|
135
|
+
stroke/background styling, so the injected chart controls its own look. Heights
|
|
136
|
+
are explicit (never percentage/stretch) so a Highcharts chart always measures a
|
|
137
|
+
concrete container instead of falling back to its 400px default. */
|
|
138
|
+
.seeds-metric-highlight-chart {
|
|
139
|
+
box-sizing: border-box;
|
|
140
|
+
flex: 0 0 auto;
|
|
141
|
+
align-self: center;
|
|
142
|
+
/* Center the injected chart as a flex item — an inline/inline-block child
|
|
143
|
+
(e.g. the data-viz SparklineChart) otherwise sits on the text baseline with
|
|
144
|
+
descender space below it, reading as vertically off-center in the slot. */
|
|
145
|
+
display: flex;
|
|
146
|
+
align-items: center;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.seeds-metric-highlight:not(.seeds-metric-highlight-vertical) .seeds-metric-highlight-chart {
|
|
150
|
+
width: 104px;
|
|
151
|
+
height: 48px;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.seeds-metric-highlight-small:not(.seeds-metric-highlight-vertical) .seeds-metric-highlight-chart {
|
|
155
|
+
width: 88px;
|
|
156
|
+
height: 40px;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.seeds-metric-highlight-vertical .seeds-metric-highlight-chart {
|
|
160
|
+
width: 100%;
|
|
161
|
+
height: 96px;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.seeds-metric-highlight-vertical.seeds-metric-highlight-small .seeds-metric-highlight-chart {
|
|
165
|
+
height: 56px;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds NarrativeDivider component classes.
|
|
3
|
+
* Use these instead of writing out individual Tailwind utility classes.
|
|
4
|
+
*
|
|
5
|
+
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css imported for
|
|
6
|
+
* CSS variable definitions and dark mode support.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* <hr class="seeds-narrative-divider" />
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
@layer components {
|
|
13
|
+
|
|
14
|
+
/* A full-width, 1px horizontal rule. The <hr> ships with user-agent margins
|
|
15
|
+
and a beveled border, so reset those and draw the line with a single
|
|
16
|
+
border-top using the container-border-base token (#dee1e1), which also
|
|
17
|
+
tracks dark mode. */
|
|
18
|
+
.seeds-narrative-divider {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 0;
|
|
22
|
+
margin: 0;
|
|
23
|
+
border: 0;
|
|
24
|
+
border-top: 1px solid var(--color-container-border-base); /* #dee1e1 */
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|