@sproutsocial/seeds-react-narrative-kit 0.2.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.
Files changed (41) hide show
  1. package/.turbo/turbo-build.log +11 -11
  2. package/CHANGELOG.md +19 -0
  3. package/dist/esm/index.js +119 -91
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/index.d.mts +110 -11
  6. package/dist/index.d.ts +110 -11
  7. package/dist/index.js +123 -93
  8. package/dist/index.js.map +1 -1
  9. package/dist/metric-highlight.css +17 -27
  10. package/dist/narrative-divider.css +27 -0
  11. package/dist/narrative-headline.css +7 -0
  12. package/dist/narrative-summary.css +126 -0
  13. package/package.json +7 -3
  14. package/src/EyebrowToken/EyebrowToken.tsx +1 -5
  15. package/src/MetricHighlight/MetricHighlight.stories.tsx +37 -14
  16. package/src/MetricHighlight/MetricHighlight.tsx +19 -99
  17. package/src/MetricHighlight/MetricHighlightTypes.ts +6 -9
  18. package/src/MetricHighlight/__tests__/MetricHighlight.test.tsx +13 -48
  19. package/src/NarrativeDivider/NarrativeDivider.stories.tsx +33 -0
  20. package/src/NarrativeDivider/NarrativeDivider.tsx +30 -0
  21. package/src/NarrativeDivider/NarrativeDividerTypes.ts +4 -0
  22. package/src/NarrativeDivider/__tests__/NarrativeDivider.test.tsx +35 -0
  23. package/src/NarrativeDivider/index.ts +2 -0
  24. package/src/NarrativeHeadline/NarrativeHeadline.tsx +21 -12
  25. package/src/NarrativeHeadline/NarrativeHeadlineRoll.tsx +4 -1
  26. package/src/NarrativeHeadline/NarrativeHeadlineTypes.ts +9 -0
  27. package/src/NarrativeHeadline/__tests__/NarrativeHeadline.test.tsx +2 -7
  28. package/src/NarrativeHeadline/index.ts +1 -0
  29. package/src/NarrativeSummary/NarrativeSummary.stories.tsx +79 -0
  30. package/src/NarrativeSummary/NarrativeSummary.tsx +98 -0
  31. package/src/NarrativeSummary/NarrativeSummaryTypes.ts +59 -0
  32. package/src/NarrativeSummary/__tests__/NarrativeSummary.test.tsx +99 -0
  33. package/src/NarrativeSummary/index.ts +5 -0
  34. package/src/Playground/Playground.stories.tsx +86 -36
  35. package/src/PullQuote/PullQuote.stories.tsx +3 -1
  36. package/src/PullQuote/PullQuoteTypes.ts +1 -2
  37. package/src/index.ts +11 -0
  38. package/src/metric-highlight.css +17 -27
  39. package/src/narrative-divider.css +27 -0
  40. package/src/narrative-headline.css +7 -0
  41. package/src/narrative-summary.css +126 -0
@@ -8,12 +8,29 @@ import NarrativeHeadlineRoll from "../NarrativeHeadline/NarrativeHeadlineRoll";
8
8
  import PullQuote from "../PullQuote/PullQuote";
9
9
  import MetricHighlight from "../MetricHighlight/MetricHighlight";
10
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";
11
14
  import Text from "@sproutsocial/seeds-react-text";
15
+ import { SparklineChart } from "@sproutsocial/seeds-react-data-viz/sparkline";
12
16
  import "../narrative-container.css";
13
17
  import "../narrative-headline.css";
14
18
  import "../pull-quote.css";
15
19
  import "../metric-highlight.css";
16
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
+ );
17
34
 
18
35
  /**
19
36
  * Narrative Kit — Playground (showcase story)
@@ -40,49 +57,82 @@ const Attribution = ({ name }: { name: string }) => (
40
57
  const Brief = () => (
41
58
  <div className="box-border min-h-screen p-600 bg-app-bg-base">
42
59
  <div className="max-w-280 mx-auto grid gap-500">
43
- <span>
44
- <EyebrowToken className="mb-300 inline-flex">May 31, 2026</EyebrowToken>
45
- <NarrativeHeadline headingLevel={1}>
46
- The social suite built for{" "}
47
- <NarrativeHeadlineRoll
48
- words={["marketers", "agencies", "enterprise teams", "founders"]}
49
- />
50
- </NarrativeHeadline>
51
- <Text.BodyCopy mt={400} display="block" width="50ch">
52
- Empowering cross-functional stakeholders to drive engagement at scale and accelerate time-to-value through data-driven content strategies aligned with your brand's north-star KPIs.
53
- </Text.BodyCopy>
54
- </span>
55
-
56
-
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>
57
74
 
58
75
  {/* Pull quotes ------------------------------------------------------- */}
59
76
  <NarrativeContainer className="w-full">
60
- <Grid columns={{ sm: 1, md: 1 }} gap={400}>
61
- {/* Metric highlights — a row of 3 -------------------------------- */}
62
- <Grid columns={{ sm: 1, md: 2, lg: 3 }} gap={400}>
63
- <MetricHighlight
64
- label="Impressions"
65
- value="1.2M"
66
- trend={{ direction: "up", value: "18%", "aria-label": "up 18%" }}
67
- data={[8, 12, 9, 15, 13, 19]}
68
- />
69
- <MetricHighlight
70
- label="Engagement rate"
71
- value="6.4%"
72
- trend={{ direction: "up", value: "240%", "aria-label": "up 240%" }}
73
- data={[3, 5, 4, 7, 6, 9]}
74
- />
75
- <MetricHighlight
76
- label="Response time"
77
- value="2h"
78
- trend={{ direction: "down", value: "12%", "aria-label": "down 12%" }}
79
- data={[18, 16, 17, 13, 14, 10]}
80
- />
81
- </Grid>
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
+
82
116
  <PullQuote
83
117
  quote="The reply thread on the 18th outperformed our entire paid push for the week."
84
118
  attribution={<Attribution name="Jordan Lee" />}
85
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
+
86
136
  <PullQuote
87
137
  appearance="vivid"
88
138
  quote="This rollout cut our average response time nearly in half."
@@ -16,7 +16,9 @@ type Story = StoryObj<typeof meta>;
16
16
 
17
17
  const Attribution = () => (
18
18
  <>
19
- <span aria-hidden className="text-400">🧵</span>
19
+ <span aria-hidden className="text-400">
20
+ 🧵
21
+ </span>
20
22
  <span>Display Name</span>
21
23
  </>
22
24
  );
@@ -1,7 +1,6 @@
1
1
  import type * as React from "react";
2
2
 
3
- export interface TypePullQuoteProps
4
- extends React.HTMLAttributes<HTMLElement> {
3
+ export interface TypePullQuoteProps extends React.HTMLAttributes<HTMLElement> {
5
4
  /** The quotation text, rendered emphasized inside the accented bar. */
6
5
  quote: React.ReactNode;
7
6
  /**
package/src/index.ts CHANGED
@@ -19,10 +19,21 @@ export { PullQuote, type TypePullQuoteProps } from "./PullQuote";
19
19
 
20
20
  export { EyebrowToken, type TypeEyebrowTokenProps } from "./EyebrowToken";
21
21
 
22
+ export {
23
+ NarrativeDivider,
24
+ type TypeNarrativeDividerProps,
25
+ } from "./NarrativeDivider";
26
+
22
27
  export {
23
28
  MetricHighlight,
24
29
  type TypeMetricHighlightProps,
25
30
  type TypeMetricHighlightTrend,
26
31
  } from "./MetricHighlight";
27
32
 
33
+ export {
34
+ NarrativeSummary,
35
+ type TypeNarrativeSummaryProps,
36
+ type TypeNarrativeSummaryLayout,
37
+ } from "./NarrativeSummary";
38
+
28
39
  export type { TypeNarrativeTone } from "./_internal/types";
@@ -131,47 +131,37 @@
131
131
  stroke-width: 1.5;
132
132
  }
133
133
 
134
- /* Sparkline a single normalized polyline stretched to fit. The non-scaling
135
- stroke keeps a crisp 2px line at any aspect ratio. */
136
- .seeds-metric-highlight-spark {
137
- display: block;
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;
138
140
  flex: 0 0 auto;
139
- /* Matches the design's Data Viz / Categorical 01 line color (#0b968f). */
140
- stroke: var(--color-teal-700);
141
- }
142
-
143
- /* Downward trend: the red analog at the same scale step (#db3e3e). */
144
- .seeds-metric-highlight-spark-negative {
145
- stroke: var(--color-red-700);
146
- }
147
-
148
- .seeds-metric-highlight-spark path {
149
- stroke: inherit;
150
- stroke-width: 2;
151
- vector-effect: non-scaling-stroke;
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;
152
147
  }
153
148
 
154
- /* Horizontal: a compact fixed-width chart beside the metric, matched to the
155
- metric block's height. */
156
- .seeds-metric-highlight:not(.seeds-metric-highlight-vertical) .seeds-metric-highlight-spark {
149
+ .seeds-metric-highlight:not(.seeds-metric-highlight-vertical) .seeds-metric-highlight-chart {
157
150
  width: 104px;
158
- align-self: stretch;
159
- min-height: 40px;
151
+ height: 48px;
160
152
  }
161
153
 
162
- .seeds-metric-highlight-small:not(.seeds-metric-highlight-vertical) .seeds-metric-highlight-spark {
154
+ .seeds-metric-highlight-small:not(.seeds-metric-highlight-vertical) .seeds-metric-highlight-chart {
163
155
  width: 88px;
164
156
  height: 40px;
165
- align-self: center;
166
157
  }
167
158
 
168
- /* Vertical: a full-width chart stacked beneath the metric. */
169
- .seeds-metric-highlight-vertical .seeds-metric-highlight-spark {
159
+ .seeds-metric-highlight-vertical .seeds-metric-highlight-chart {
170
160
  width: 100%;
171
161
  height: 96px;
172
162
  }
173
163
 
174
- .seeds-metric-highlight-vertical.seeds-metric-highlight-small .seeds-metric-highlight-spark {
164
+ .seeds-metric-highlight-vertical.seeds-metric-highlight-small .seeds-metric-highlight-chart {
175
165
  height: 56px;
176
166
  }
177
167
 
@@ -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
+ }
@@ -27,6 +27,13 @@
27
27
  color: var(--color-text-headline);
28
28
  }
29
29
 
30
+ /* Compact size for denser layouts (e.g. NarrativeSummary). Weight, letter
31
+ spacing, and color are inherited from the base class. */
32
+ .seeds-narrative-headline-small {
33
+ font-size: var(--font-size-600); /* 24px */
34
+ line-height: var(--line-height-600); /* 32px */
35
+ }
36
+
30
37
  /* Static gradient accent for a span of headline text ("highlighted word").
31
38
  Paints the AI brand gradient onto the glyphs via background-clip. */
32
39
  .seeds-narrative-headline-highlight {
@@ -0,0 +1,126 @@
1
+ /**
2
+ * Seeds NarrativeSummary 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. Also relies on
7
+ * narrative-headline.css (headline) and eyebrow-token.css (eyebrow).
8
+ *
9
+ * The layout is a CSS grid driven by a container query on the root, so the
10
+ * columns collapse based on the width the component is given, not the viewport.
11
+ *
12
+ * Usage:
13
+ * <div class="seeds-narrative-summary">
14
+ * <div class="seeds-narrative-summary-grid">…</div>
15
+ * </div>
16
+ */
17
+
18
+ @layer components {
19
+
20
+ /* Establishes the query container. The grid inside reacts to this element's
21
+ inline size. */
22
+ .seeds-narrative-summary {
23
+ container-type: inline-size;
24
+ box-sizing: border-box;
25
+ font-family: var(--font-family);
26
+ }
27
+
28
+ /* Stacked single column by default (narrow). The container query below expands
29
+ it once there is room. */
30
+ .seeds-narrative-summary-grid {
31
+ display: grid;
32
+ grid-template-columns: 1fr;
33
+ gap: var(--space-450); /* 24px */
34
+ }
35
+
36
+ /* The lead column: eyebrow, headline, optional action. align-items:flex-start
37
+ keeps the eyebrow pill and the action sized to their content — without it the
38
+ column's default stretch would blow the eyebrow out to full width. The
39
+ headline still fills and wraps because its text is wider than the track. */
40
+ .seeds-narrative-summary-lead {
41
+ display: flex;
42
+ flex-direction: column;
43
+ align-items: flex-start;
44
+ gap: var(--space-300); /* 8px */
45
+ min-width: 0;
46
+ }
47
+
48
+ /* The headline area grows so the action anchors toward the bottom of the lead
49
+ column when the neighboring columns are taller. align-self:stretch fills the
50
+ track width (the lead column pins other items to flex-start) so the headline
51
+ wraps at the column edge regardless of its length. */
52
+ .seeds-narrative-summary-headline {
53
+ flex: 1 1 auto;
54
+ align-self: stretch;
55
+ }
56
+
57
+ /* In three-column mode the content wrapper is transparent to the grid, so its
58
+ two sections become grid items in their own columns. In two-column mode the
59
+ container query below turns it into a real, stacking grid item. */
60
+ .seeds-narrative-summary-content {
61
+ display: contents;
62
+ }
63
+
64
+ .seeds-narrative-summary-section {
65
+ display: flex;
66
+ flex-direction: column;
67
+ gap: var(--space-300); /* 8px */
68
+ min-width: 0;
69
+ }
70
+
71
+ /* Section label. 14px / 24px has no exact type token (the scale skips from
72
+ 13px to 16px), so the design value is kept verbatim — same rationale as
73
+ eyebrow-token.css. All other values use tokens. */
74
+ .seeds-narrative-summary-label {
75
+ margin: 0;
76
+ font-size: 14px;
77
+ line-height: 24px;
78
+ font-weight: var(--font-weight-bold);
79
+ color: var(--color-text-headline);
80
+ }
81
+
82
+ .seeds-narrative-summary-text {
83
+ margin: 0;
84
+ font-size: 14px; /* off-scale, see label above */
85
+ line-height: 24px;
86
+ font-weight: var(--font-weight-normal);
87
+ color: var(--color-text-body);
88
+ }
89
+
90
+ .seeds-narrative-summary-list {
91
+ margin: 0;
92
+ padding-inline-start: 21px;
93
+ list-style: disc;
94
+ font-size: 14px; /* off-scale, see label above */
95
+ line-height: 24px;
96
+ font-weight: var(--font-weight-normal);
97
+ color: var(--color-text-body);
98
+ }
99
+
100
+ .seeds-narrative-summary-list li {
101
+ margin: 0;
102
+ }
103
+
104
+ /* Expand to the multi-column layout once the component is wide enough. The
105
+ threshold is on the component's own width (container query), so a narrow card
106
+ on a wide screen still stacks. 640px = Tailwind/Seeds sm breakpoint. */
107
+ @container (min-width: 640px) {
108
+ .seeds-narrative-summary-grid {
109
+ grid-template-columns: repeat(3, 1fr);
110
+ }
111
+
112
+ /* 1/3 lead + 2/3 content. */
113
+ .seeds-narrative-summary-two-column {
114
+ grid-template-columns: 1fr 2fr;
115
+ }
116
+
117
+ /* The content wrapper becomes a real grid item that stacks its two sections. */
118
+ .seeds-narrative-summary-two-column .seeds-narrative-summary-content {
119
+ display: flex;
120
+ flex-direction: column;
121
+ gap: var(--space-450); /* 24px */
122
+ min-width: 0;
123
+ }
124
+ }
125
+
126
+ }