@sproutsocial/seeds-react-narrative-kit 0.2.0 → 0.4.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 +46 -0
- package/dist/ai-container.css +39 -0
- package/dist/esm/index.js +217 -91
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +232 -14
- package/dist/index.d.ts +232 -14
- package/dist/index.js +224 -93
- package/dist/index.js.map +1 -1
- package/dist/metric-highlight.css +17 -27
- package/dist/narrative-data-callout.css +103 -0
- package/dist/narrative-divider.css +27 -0
- package/dist/narrative-headline.css +7 -0
- package/dist/narrative-ordered-list.css +112 -0
- package/dist/narrative-summary.css +126 -0
- package/dist/pull-quote.css +4 -25
- package/package.json +12 -5
- package/src/AIContainer/AIContainer.stories.tsx +54 -0
- package/src/AIContainer/AIContainer.tsx +35 -0
- package/src/AIContainer/AIContainerTypes.ts +14 -0
- package/src/AIContainer/__tests__/AIContainer.test.tsx +61 -0
- package/src/AIContainer/index.ts +2 -0
- package/src/EyebrowToken/EyebrowToken.tsx +1 -5
- package/src/MetricHighlight/MetricHighlight.stories.tsx +37 -14
- package/src/MetricHighlight/MetricHighlight.tsx +19 -99
- package/src/MetricHighlight/MetricHighlightTypes.ts +6 -9
- package/src/MetricHighlight/__tests__/MetricHighlight.test.tsx +13 -48
- package/src/NarrativeDataCallout/NarrativeDataCallout.stories.tsx +71 -0
- package/src/NarrativeDataCallout/NarrativeDataCallout.tsx +50 -0
- package/src/NarrativeDataCallout/NarrativeDataCalloutTypes.ts +18 -0
- package/src/NarrativeDataCallout/__tests__/NarrativeDataCallout.test.tsx +69 -0
- package/src/NarrativeDataCallout/index.ts +2 -0
- 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.tsx +21 -12
- package/src/NarrativeHeadline/NarrativeHeadlineRoll.tsx +4 -1
- package/src/NarrativeHeadline/NarrativeHeadlineTypes.ts +9 -0
- package/src/NarrativeHeadline/__tests__/NarrativeHeadline.test.tsx +2 -7
- package/src/NarrativeHeadline/index.ts +1 -0
- package/src/NarrativeOrderedList/NarrativeOrderedList.stories.tsx +69 -0
- package/src/NarrativeOrderedList/NarrativeOrderedList.tsx +74 -0
- package/src/NarrativeOrderedList/NarrativeOrderedListTypes.ts +39 -0
- package/src/NarrativeOrderedList/__tests__/NarrativeOrderedList.test.tsx +89 -0
- package/src/NarrativeOrderedList/index.ts +6 -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 +174 -36
- package/src/PullQuote/PullQuote.stories.tsx +4 -1
- package/src/PullQuote/PullQuote.tsx +6 -3
- package/src/PullQuote/PullQuoteTypes.ts +1 -2
- package/src/ai-container.css +39 -0
- package/src/index.ts +25 -0
- package/src/metric-highlight.css +17 -27
- package/src/narrative-data-callout.css +103 -0
- package/src/narrative-divider.css +27 -0
- package/src/narrative-headline.css +7 -0
- package/src/narrative-ordered-list.css +112 -0
- package/src/narrative-summary.css +126 -0
- package/src/pull-quote.css +4 -25
|
@@ -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,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Seeds NarrativeOrderedList 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-narrative-ordered-list">
|
|
10
|
+
* <ol class="seeds-narrative-ordered-list-track">
|
|
11
|
+
* <li class="seeds-narrative-ordered-list-item">…</li>
|
|
12
|
+
* </ol>
|
|
13
|
+
* </div>
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
@layer components {
|
|
17
|
+
|
|
18
|
+
/* Establishes the query container. The track inside reacts to this element's
|
|
19
|
+
inline size — a container query can only style descendants of the container,
|
|
20
|
+
never the container element itself. */
|
|
21
|
+
.seeds-narrative-ordered-list {
|
|
22
|
+
container-type: inline-size;
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
font-family: var(--font-family);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/* The list itself, and the default (stacked) layout. The horizontal modifier
|
|
28
|
+
only expands to a row once the container query below has room, so horizontal
|
|
29
|
+
collapses back to this stack when narrow. */
|
|
30
|
+
.seeds-narrative-ordered-list-track {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: var(--space-400); /* 16px */
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
list-style: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/* An item row: the ordinal beside the body, on its own rounded surface. */
|
|
40
|
+
.seeds-narrative-ordered-list-item {
|
|
41
|
+
display: flex;
|
|
42
|
+
gap: var(--space-450); /* 24px */
|
|
43
|
+
align-items: flex-start;
|
|
44
|
+
box-sizing: border-box;
|
|
45
|
+
min-width: 0;
|
|
46
|
+
padding: var(--space-400) var(--space-450); /* 16px 24px */
|
|
47
|
+
border-radius: var(--radius-800); /* 12px */
|
|
48
|
+
background-color: var(--color-app-bg-base);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/* The ordinal (01, 02, …). No mono token exists yet, so fall back to a system
|
|
52
|
+
monospace stack — mirrors the value treatment in metric-highlight.css. */
|
|
53
|
+
.seeds-narrative-ordered-list-number {
|
|
54
|
+
margin: 0;
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
font-family: var(--font-family-mono, ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace);
|
|
57
|
+
font-size: var(--font-size-700); /* 32px */
|
|
58
|
+
line-height: var(--line-height-700); /* 40px */
|
|
59
|
+
font-weight: var(--font-weight-bold);
|
|
60
|
+
color: var(--color-text-headline);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/* Title + description + optional action, stacked. */
|
|
64
|
+
.seeds-narrative-ordered-list-body {
|
|
65
|
+
flex: 1 1 auto;
|
|
66
|
+
display: flex;
|
|
67
|
+
flex-direction: column;
|
|
68
|
+
gap: var(--space-200); /* 4px */
|
|
69
|
+
min-width: 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Title. 16px / 28px — the 28px line-height has no exact type token (the scale
|
|
73
|
+
skips from 24px to 32px), so the design value is kept verbatim. Same
|
|
74
|
+
rationale as narrative-summary.css. */
|
|
75
|
+
.seeds-narrative-ordered-list-title {
|
|
76
|
+
margin: 0;
|
|
77
|
+
font-size: var(--font-size-300); /* 16px */
|
|
78
|
+
line-height: 28px; /* off-scale, see comment above */
|
|
79
|
+
font-weight: var(--font-weight-bold);
|
|
80
|
+
color: var(--color-text-body);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/* Description. 14px / 24px has no exact type token, so it is kept verbatim —
|
|
84
|
+
same rationale as the title above. */
|
|
85
|
+
.seeds-narrative-ordered-list-description {
|
|
86
|
+
margin: 0;
|
|
87
|
+
font-size: 14px; /* off-scale, see title above */
|
|
88
|
+
line-height: 24px;
|
|
89
|
+
font-weight: var(--font-weight-normal);
|
|
90
|
+
color: var(--color-text-body);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.seeds-narrative-ordered-list-action {
|
|
94
|
+
padding-top: var(--space-350); /* 12px */
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* Expand the horizontal variant to a row of equal columns once the component is
|
|
98
|
+
wide enough. The threshold is on the component's own width (container query),
|
|
99
|
+
so a narrow card on a wide screen still stacks. 640px = Tailwind/Seeds sm
|
|
100
|
+
breakpoint, matching narrative-summary.css. */
|
|
101
|
+
@container (min-width: 640px) {
|
|
102
|
+
.seeds-narrative-ordered-list-horizontal {
|
|
103
|
+
flex-direction: row;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.seeds-narrative-ordered-list-horizontal > .seeds-narrative-ordered-list-item {
|
|
107
|
+
flex: 1 1 0;
|
|
108
|
+
min-width: 0;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
}
|
|
@@ -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
|
+
}
|
package/src/pull-quote.css
CHANGED
|
@@ -2,20 +2,17 @@
|
|
|
2
2
|
* Seeds PullQuote component classes.
|
|
3
3
|
* Use these instead of writing out individual Tailwind utility classes.
|
|
4
4
|
*
|
|
5
|
-
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css
|
|
6
|
-
* CSS variable definitions and
|
|
5
|
+
* Requires @sproutsocial/seeds-react-theme/dist/theme-all.css and
|
|
6
|
+
* ai-container.css imported for CSS variable definitions and surface styles.
|
|
7
7
|
*
|
|
8
8
|
* Usage:
|
|
9
|
-
* <figure class="seeds-pull-quote">…</figure> // subtle (default)
|
|
10
|
-
* <figure class="seeds-pull-quote seeds-pull-quote-vivid">…</figure>
|
|
9
|
+
* <figure class="seeds-pull-quote seeds-ai-container">…</figure> // subtle (default)
|
|
10
|
+
* <figure class="seeds-pull-quote seeds-ai-container seeds-ai-container-vivid seeds-pull-quote-vivid">…</figure>
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
@layer components {
|
|
14
14
|
|
|
15
15
|
.seeds-pull-quote {
|
|
16
|
-
position: relative;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
box-sizing: border-box;
|
|
19
16
|
width: 100%;
|
|
20
17
|
display: flex;
|
|
21
18
|
flex-direction: column;
|
|
@@ -24,24 +21,6 @@
|
|
|
24
21
|
/* 40px block / 48px inline — 48px is off the space scale, so derive it from
|
|
25
22
|
two tokens (40 + 8) rather than hardcoding an off-scale value. */
|
|
26
23
|
padding: var(--space-600) calc(var(--space-600) + var(--space-300));
|
|
27
|
-
border-radius: var(--radius-800);
|
|
28
|
-
box-shadow: var(--shadow-low);
|
|
29
|
-
font-family: var(--font-family);
|
|
30
|
-
/* Subtle (default): the 20% AI gradient tint composited over the base
|
|
31
|
-
surface. --color-gradient-ai-subtle is already translucent, so layering it
|
|
32
|
-
over the opaque base color produces the soft wash. */
|
|
33
|
-
background-color: var(--color-container-bg-base);
|
|
34
|
-
background-image: var(--color-gradient-ai-subtle);
|
|
35
|
-
color: var(--color-text-headline);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/* Vivid: the full-saturation AI gradient with white content. White has no
|
|
39
|
-
semantic Seeds token; it is part of the AI gradient treatment (mirrors the
|
|
40
|
-
raw brand hex used in --color-gradient-ai). */
|
|
41
|
-
.seeds-pull-quote-vivid {
|
|
42
|
-
background-color: transparent;
|
|
43
|
-
background-image: var(--color-gradient-ai);
|
|
44
|
-
color: #fff;
|
|
45
24
|
}
|
|
46
25
|
|
|
47
26
|
/* The accented bar holding the quote and attribution. */
|