@sproutsocial/seeds-react-narrative-kit 0.1.0 → 0.2.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 (46) hide show
  1. package/.turbo/turbo-build.log +11 -11
  2. package/CHANGELOG.md +9 -0
  3. package/dist/esm/index.js +296 -2
  4. package/dist/esm/index.js.map +1 -1
  5. package/dist/eyebrow-token.css +37 -0
  6. package/dist/index.d.mts +205 -1
  7. package/dist/index.d.ts +205 -1
  8. package/dist/index.js +303 -3
  9. package/dist/index.js.map +1 -1
  10. package/dist/metric-highlight.css +178 -0
  11. package/dist/narrative-container.css +1 -1
  12. package/dist/narrative-headline.css +125 -0
  13. package/dist/pull-quote.css +89 -0
  14. package/package.json +9 -3
  15. package/src/EyebrowToken/EyebrowToken.stories.tsx +25 -0
  16. package/src/EyebrowToken/EyebrowToken.tsx +29 -0
  17. package/src/EyebrowToken/EyebrowTokenTypes.ts +7 -0
  18. package/src/EyebrowToken/__tests__/EyebrowToken.test.tsx +35 -0
  19. package/src/EyebrowToken/index.ts +2 -0
  20. package/src/MetricHighlight/MetricHighlight.stories.tsx +87 -0
  21. package/src/MetricHighlight/MetricHighlight.tsx +196 -0
  22. package/src/MetricHighlight/MetricHighlightTypes.ts +61 -0
  23. package/src/MetricHighlight/__tests__/MetricHighlight.test.tsx +151 -0
  24. package/src/MetricHighlight/index.ts +5 -0
  25. package/src/NarrativeContainer/NarrativeContainer.stories.tsx +3 -3
  26. package/src/NarrativeContainer/NarrativeContainer.tsx +1 -23
  27. package/src/NarrativeHeadline/NarrativeHeadline.stories.tsx +68 -0
  28. package/src/NarrativeHeadline/NarrativeHeadline.tsx +36 -0
  29. package/src/NarrativeHeadline/NarrativeHeadlineHighlight.tsx +31 -0
  30. package/src/NarrativeHeadline/NarrativeHeadlineRoll.tsx +100 -0
  31. package/src/NarrativeHeadline/NarrativeHeadlineTypes.ts +54 -0
  32. package/src/NarrativeHeadline/__tests__/NarrativeHeadline.test.tsx +138 -0
  33. package/src/NarrativeHeadline/index.ts +9 -0
  34. package/src/Playground/Playground.stories.tsx +113 -0
  35. package/src/PullQuote/PullQuote.stories.tsx +43 -0
  36. package/src/PullQuote/PullQuote.tsx +42 -0
  37. package/src/PullQuote/PullQuoteTypes.ts +19 -0
  38. package/src/PullQuote/__tests__/PullQuote.test.tsx +48 -0
  39. package/src/PullQuote/index.ts +2 -0
  40. package/src/_internal/cn.ts +22 -0
  41. package/src/eyebrow-token.css +37 -0
  42. package/src/index.ts +20 -0
  43. package/src/metric-highlight.css +178 -0
  44. package/src/narrative-container.css +1 -1
  45. package/src/narrative-headline.css +125 -0
  46. package/src/pull-quote.css +89 -0
@@ -17,7 +17,7 @@
17
17
  box-sizing: border-box;
18
18
  display: flex;
19
19
  flex-direction: column;
20
- align-items: flex-start;
20
+ align-items: stretch;
21
21
  padding: var(--space-500);
22
22
  border-radius: var(--radius-800);
23
23
  box-shadow: var(--shadow-low);
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Seeds NarrativeHeadline 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
+ * <h2 class="seeds-narrative-headline">
10
+ * Headline with a
11
+ * <span class="seeds-narrative-headline-highlight">highlighted</span>
12
+ * word
13
+ * </h2>
14
+ */
15
+
16
+ @layer components {
17
+
18
+ /* Headline text. Rendered as an h1–h6, so reset the UA heading margins. */
19
+ .seeds-narrative-headline {
20
+ box-sizing: border-box;
21
+ margin: 0;
22
+ font-family: var(--font-family);
23
+ font-size: var(--font-size-700);
24
+ line-height: var(--line-height-700);
25
+ font-weight: var(--font-weight-bold);
26
+ letter-spacing: -0.02em;
27
+ color: var(--color-text-headline);
28
+ }
29
+
30
+ /* Static gradient accent for a span of headline text ("highlighted word").
31
+ Paints the AI brand gradient onto the glyphs via background-clip. */
32
+ .seeds-narrative-headline-highlight {
33
+ background: var(--color-gradient-ai);
34
+ -webkit-background-clip: text;
35
+ background-clip: text;
36
+ color: transparent;
37
+ }
38
+
39
+ /* -------------------------------------------------------------------------
40
+ "Roll" variant — vertical word roll. The active word slides into view
41
+ while the previous one rolls out.
42
+ ------------------------------------------------------------------------- */
43
+ .seeds-narrative-headline-roll {
44
+ display: inline-block;
45
+ position: relative;
46
+ /* clip-path rather than overflow:hidden: overflow:hidden on an inline-block
47
+ snaps its baseline to the bottom margin edge, dropping the rolling word
48
+ below the surrounding text. clip-path keeps the natural baseline. */
49
+ clip-path: inset(0);
50
+ }
51
+
52
+ /* Invisible word that holds the box width to the active word. */
53
+ .seeds-narrative-headline-roll-sizer {
54
+ display: inline-block;
55
+ visibility: hidden;
56
+ white-space: nowrap;
57
+ pointer-events: none;
58
+ }
59
+
60
+ .seeds-narrative-headline-roll-word {
61
+ display: inline-block;
62
+ position: absolute;
63
+ top: 0;
64
+ left: 0;
65
+ white-space: nowrap;
66
+ transform: translateY(100%);
67
+ opacity: 0;
68
+ transition:
69
+ transform var(--seeds-narrative-headline-roll-ms, 500ms) ease,
70
+ opacity var(--seeds-narrative-headline-roll-ms, 500ms) ease;
71
+ }
72
+
73
+ .seeds-narrative-headline-roll-word-active {
74
+ transform: translateY(0);
75
+ opacity: 1;
76
+ }
77
+
78
+ .seeds-narrative-headline-roll-word-past {
79
+ transform: translateY(-100%);
80
+ opacity: 0;
81
+ }
82
+
83
+ /* Reverse the roll direction. */
84
+ .seeds-narrative-headline-roll-down .seeds-narrative-headline-roll-word {
85
+ transform: translateY(-100%);
86
+ }
87
+ .seeds-narrative-headline-roll-down .seeds-narrative-headline-roll-word-active {
88
+ transform: translateY(0);
89
+ }
90
+ .seeds-narrative-headline-roll-down .seeds-narrative-headline-roll-word-past {
91
+ transform: translateY(100%);
92
+ }
93
+
94
+ /* Gradient-painted rolling words with a slow shimmer. */
95
+ .seeds-narrative-headline-roll-gradient .seeds-narrative-headline-roll-word {
96
+ background: var(--color-gradient-ai);
97
+ background-size: 200% 200%;
98
+ -webkit-background-clip: text;
99
+ background-clip: text;
100
+ color: transparent;
101
+ animation: seeds-narrative-headline-grad-shift 8s ease infinite;
102
+ }
103
+
104
+ @keyframes seeds-narrative-headline-grad-shift {
105
+ 0%,
106
+ 100% {
107
+ background-position: 0% 50%;
108
+ }
109
+ 50% {
110
+ background-position: 100% 50%;
111
+ }
112
+ }
113
+
114
+ /* The JS cycle is already disabled under reduced-motion (the first word holds);
115
+ also flatten the transition and shimmer so any in-flight motion settles. */
116
+ @media (prefers-reduced-motion: reduce) {
117
+ .seeds-narrative-headline-roll-word {
118
+ transition: none;
119
+ }
120
+ .seeds-narrative-headline-roll-gradient .seeds-narrative-headline-roll-word {
121
+ animation: none;
122
+ }
123
+ }
124
+
125
+ }
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Seeds PullQuote 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
+ * <figure class="seeds-pull-quote">…</figure> // subtle (default)
10
+ * <figure class="seeds-pull-quote seeds-pull-quote-vivid">…</figure>
11
+ */
12
+
13
+ @layer components {
14
+
15
+ .seeds-pull-quote {
16
+ position: relative;
17
+ overflow: hidden;
18
+ box-sizing: border-box;
19
+ width: 100%;
20
+ display: flex;
21
+ flex-direction: column;
22
+ align-items: flex-start;
23
+ margin: 0; /* reset the browser default <figure> margin */
24
+ /* 40px block / 48px inline — 48px is off the space scale, so derive it from
25
+ two tokens (40 + 8) rather than hardcoding an off-scale value. */
26
+ 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
+ }
46
+
47
+ /* The accented bar holding the quote and attribution. */
48
+ .seeds-pull-quote-bar {
49
+ box-sizing: border-box;
50
+ display: flex;
51
+ flex-direction: column;
52
+ align-items: flex-start;
53
+ gap: var(--space-450); /* 24px */
54
+ width: 100%;
55
+ padding-left: var(--space-450); /* 24px */
56
+ /* 4px is off the border-width scale (max token is 3px); the bar is a
57
+ decorative accent, mirroring NarrativeContainer's hardcoded 4px ring. The
58
+ subtle accent uses the AI gradient mid stop (#9747ff — no exact token). */
59
+ border-left: 4px solid #9747ff;
60
+ }
61
+
62
+ .seeds-pull-quote-vivid .seeds-pull-quote-bar {
63
+ border-left-color: #fff;
64
+ }
65
+
66
+ .seeds-pull-quote-text {
67
+ margin: 0; /* reset the browser default <blockquote> margin */
68
+ font-size: var(--font-size-600);
69
+ line-height: var(--line-height-600);
70
+ font-style: italic;
71
+ font-weight: var(--font-weight-normal);
72
+ color: inherit;
73
+ overflow-wrap: break-word;
74
+ }
75
+
76
+ /* Attribution row — a flex container for author name, avatar, network, etc.
77
+ Direct text inherits a bold, small treatment to match the display-name style;
78
+ richer content (e.g. an Avatar) composes freely. */
79
+ .seeds-pull-quote-attribution {
80
+ display: flex;
81
+ align-items: center;
82
+ gap: var(--space-300); /* 8px */
83
+ font-size: var(--font-size-200);
84
+ line-height: var(--line-height-200);
85
+ font-weight: var(--font-weight-bold);
86
+ color: inherit;
87
+ }
88
+
89
+ }