@keystone-sites/marketing-design-system 1.0.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 (130) hide show
  1. package/AGENTS.md +163 -0
  2. package/README.md +85 -0
  3. package/assets/media/brand/ks-lockup.svg +13 -0
  4. package/assets/media/brand/ks-logomark.svg +4 -0
  5. package/assets/media/brand/ks-wordmark-inline.svg +13 -0
  6. package/assets/media/brand/ks-wordmark.svg +11 -0
  7. package/assets/media/fonts/gt-standard-standard-vf.woff2 +0 -0
  8. package/assets/media/fonts/pp-kyoto-variable-upright-vf.woff2 +0 -0
  9. package/base.css +111 -0
  10. package/css-vars.d.ts +10 -0
  11. package/grid/engine.css +368 -0
  12. package/grid/field-hash.ts +31 -0
  13. package/grid/field.tsx +48 -0
  14. package/grid/gates.cjs +34 -0
  15. package/grid/region.tsx +97 -0
  16. package/icons.tsx +1224 -0
  17. package/index.css +77 -0
  18. package/lib/autoplay-gate.ts +88 -0
  19. package/lib/focus-trap.ts +42 -0
  20. package/lib/grader.ts +131 -0
  21. package/lib/legal-data.ts +1 -0
  22. package/lib/legal.ts +41 -0
  23. package/lib/noise.tsx +114 -0
  24. package/lib/render-boundary.tsx +27 -0
  25. package/lib/scroll-lock.ts +25 -0
  26. package/lib/swipe.ts +124 -0
  27. package/lib/use-active-section.ts +43 -0
  28. package/lib/use-count-up.ts +26 -0
  29. package/lib/use-grader-search.ts +118 -0
  30. package/lib/use-video-carousel.ts +271 -0
  31. package/media.ts +558 -0
  32. package/package.json +201 -0
  33. package/primitives/button-inline.css +52 -0
  34. package/primitives/button-inline.tsx +38 -0
  35. package/primitives/buttons.css +449 -0
  36. package/primitives/buttons.tsx +263 -0
  37. package/primitives/case-study-button.css +71 -0
  38. package/primitives/case-study-button.tsx +28 -0
  39. package/primitives/case-study-card.css +318 -0
  40. package/primitives/case-study-card.tsx +116 -0
  41. package/primitives/closer-row.css +14 -0
  42. package/primitives/closer-row.tsx +22 -0
  43. package/primitives/cta-row.css +41 -0
  44. package/primitives/cta-row.tsx +39 -0
  45. package/primitives/disclosure.css +210 -0
  46. package/primitives/disclosure.tsx +144 -0
  47. package/primitives/faq-question.css +220 -0
  48. package/primitives/faq-question.tsx +55 -0
  49. package/primitives/field.css +225 -0
  50. package/primitives/field.tsx +266 -0
  51. package/primitives/footer-item.css +72 -0
  52. package/primitives/footer-item.tsx +42 -0
  53. package/primitives/grader-menu.tsx +84 -0
  54. package/primitives/grader.css +302 -0
  55. package/primitives/grader.tsx +284 -0
  56. package/primitives/modal.css +151 -0
  57. package/primitives/modal.tsx +90 -0
  58. package/primitives/notice.css +39 -0
  59. package/primitives/notice.tsx +56 -0
  60. package/primitives/persona-card.css +374 -0
  61. package/primitives/persona-card.tsx +74 -0
  62. package/primitives/picture.css +11 -0
  63. package/primitives/picture.tsx +41 -0
  64. package/primitives/plan-card.css +378 -0
  65. package/primitives/plan-card.tsx +91 -0
  66. package/primitives/prose.css +118 -0
  67. package/primitives/prose.tsx +170 -0
  68. package/primitives/ramps.css +84 -0
  69. package/primitives/slider.css +179 -0
  70. package/primitives/slider.tsx +69 -0
  71. package/primitives/slug.css +87 -0
  72. package/primitives/slug.tsx +37 -0
  73. package/primitives/status.css +298 -0
  74. package/primitives/status.tsx +222 -0
  75. package/primitives/strip.css +40 -0
  76. package/primitives/surface.css +78 -0
  77. package/primitives/surface.tsx +95 -0
  78. package/primitives/table.css +226 -0
  79. package/primitives/table.tsx +122 -0
  80. package/primitives/tabs.css +85 -0
  81. package/primitives/tabs.tsx +122 -0
  82. package/primitives/text.css +110 -0
  83. package/primitives/toc.css +65 -0
  84. package/primitives/toc.tsx +42 -0
  85. package/rules/design-system.md +154 -0
  86. package/rules/grid-and-layout.md +166 -0
  87. package/scripts/generate-exports.mjs +61 -0
  88. package/scripts/generate-type-css.mjs +130 -0
  89. package/sections/faq-island.tsx +102 -0
  90. package/sections/faq.css +213 -0
  91. package/sections/faq.tsx +46 -0
  92. package/sections/footer-nav.tsx +95 -0
  93. package/sections/footer-signature.css +183 -0
  94. package/sections/footer-signature.tsx +114 -0
  95. package/sections/footer.css +735 -0
  96. package/sections/footer.tsx +283 -0
  97. package/sections/gallery-overlay.css +213 -0
  98. package/sections/gallery-overlay.tsx +267 -0
  99. package/sections/landing-benefits.css +59 -0
  100. package/sections/landing-benefits.tsx +81 -0
  101. package/sections/landing-closer.css +23 -0
  102. package/sections/landing-closer.tsx +26 -0
  103. package/sections/landing-hero.css +80 -0
  104. package/sections/landing-hero.tsx +69 -0
  105. package/sections/landing-quote.css +19 -0
  106. package/sections/landing-quote.tsx +30 -0
  107. package/sections/landing-sample.ts +66 -0
  108. package/sections/landing.css +45 -0
  109. package/sections/landing.tsx +69 -0
  110. package/sections/load-orchestrator.tsx +43 -0
  111. package/sections/load.css +138 -0
  112. package/sections/nav-desktop.css +530 -0
  113. package/sections/nav-desktop.tsx +155 -0
  114. package/sections/nav-mobile.css +571 -0
  115. package/sections/nav-mobile.tsx +222 -0
  116. package/sections/nav.css +126 -0
  117. package/sections/nav.tsx +394 -0
  118. package/sections/site-chat-data.ts +16 -0
  119. package/sections/site-chat-open.tsx +25 -0
  120. package/sections/site-chat.tsx +67 -0
  121. package/site-links.ts +36 -0
  122. package/site.ts +2 -0
  123. package/themes/inverted.css +139 -0
  124. package/tokens/fonts.css +38 -0
  125. package/tokens/motion.css +125 -0
  126. package/tokens/primitives.css +163 -0
  127. package/tokens/semantic.css +153 -0
  128. package/tokens/type-styles.json +145 -0
  129. package/tokens/type.css +1548 -0
  130. package/widgets.css +78 -0
@@ -0,0 +1,222 @@
1
+ "use client";
2
+
3
+ import { useEffect, useRef, useState } from "react";
4
+ import type { ReactNode } from "react";
5
+ import { trapModalTab } from "../lib/focus-trap";
6
+ import { lockScroll } from "../lib/scroll-lock";
7
+ import { IconChevronDownMedium, IconNavMenu } from "../icons";
8
+
9
+ interface BandTicks {
10
+ rm: number;
11
+ rs: number;
12
+ rt: number;
13
+ }
14
+
15
+ /** Plain rows link; drawer rows disclose. */
16
+ export type NavMobileRow =
17
+ | { id: string; label: string; href: string }
18
+ | {
19
+ id: string;
20
+ label: string;
21
+ drawer: ReactNode;
22
+ /** Whole-tick push-down per band. */
23
+ group: BandTicks;
24
+ /** The open box height; it can be shorter than its push-down group. */
25
+ boxTicks: BandTicks;
26
+ };
27
+
28
+ /** Both glyphs share a grid cell so CSS can crossfade them. */
29
+ function GlyphStack() {
30
+ return (
31
+ <span className="knav-glyphstack" aria-hidden="true">
32
+ <IconNavMenu className="knav-glyph-menu" />
33
+ <IconNavMenu className="knav-glyph-x" open />
34
+ </span>
35
+ );
36
+ }
37
+
38
+ /* Extra rail cells are clipped to the available panel height. */
39
+ const RAIL_CELL_COUNT = 40;
40
+
41
+ export function NavMobile({
42
+ homeHref,
43
+ rows,
44
+ buttons,
45
+ }: {
46
+ homeHref: string;
47
+ rows: NavMobileRow[];
48
+ buttons: ReactNode;
49
+ }) {
50
+ const [open, setOpen] = useState(false);
51
+ const [openDrawer, setOpenDrawer] = useState<string | null>(null);
52
+ /** Defer same-page anchors until scroll-lock cleanup restores position. */
53
+ const pendingHashRef = useRef<string | null>(null);
54
+ const panelRef = useRef<HTMLDivElement>(null);
55
+ const toggleRef = useRef<HTMLButtonElement>(null);
56
+
57
+ useEffect(() => {
58
+ if (!open) return;
59
+ const unlock = lockScroll();
60
+ panelRef.current?.focus({ preventScroll: true });
61
+ return unlock;
62
+ }, [open]);
63
+
64
+ useEffect(() => {
65
+ if (open) return;
66
+ const hash = pendingHashRef.current;
67
+ if (!hash) return;
68
+ pendingHashRef.current = null;
69
+ /* scrollIntoView also handles repeated clicks on the current hash. */
70
+ window.location.hash = hash;
71
+ document.getElementById(hash.slice(1))?.scrollIntoView();
72
+ }, [open]);
73
+
74
+ /** Pointer closes suppress Safari's programmatic focus ring; keyboard closes keep it. */
75
+ const close = (viaKeyboard = false) => {
76
+ setOpen(false);
77
+ setOpenDrawer(null);
78
+ const toggle = toggleRef.current;
79
+ if (toggle) {
80
+ if (viaKeyboard) delete toggle.dataset.quietFocus;
81
+ else toggle.dataset.quietFocus = "";
82
+ toggle.focus({ preventScroll: true });
83
+ }
84
+ };
85
+
86
+ return (
87
+ <div
88
+ className="knav-m"
89
+ data-open={open || undefined}
90
+ onKeyDown={(e) => {
91
+ if (!open) return;
92
+ if (e.key === "Escape") close(true);
93
+ else if (panelRef.current) trapModalTab(e, panelRef.current);
94
+ }}
95
+ >
96
+ <div className="knav-mbar">
97
+ <a className="knav-logo" href={homeHref} aria-label="Keystone — home">
98
+ <i className="knav-mark" aria-hidden="true" />
99
+ </a>
100
+ <i className="knav-vr knav-mvr" aria-hidden="true" />
101
+ <button
102
+ ref={toggleRef}
103
+ type="button"
104
+ className="knav-mtoggle"
105
+ aria-expanded={open}
106
+ aria-controls="knav-panel"
107
+ aria-label="Menu"
108
+ onClick={() => (open ? close() : setOpen(true))}
109
+ onBlur={(e) => delete e.currentTarget.dataset.quietFocus}
110
+ onKeyDown={(e) => delete e.currentTarget.dataset.quietFocus}
111
+ >
112
+ <GlyphStack />
113
+ </button>
114
+ </div>
115
+
116
+ <div className="knav-catch" aria-hidden="true" onClick={() => close()} />
117
+
118
+ <div
119
+ id="knav-panel"
120
+ ref={panelRef}
121
+ className="knav-panel"
122
+ role="dialog"
123
+ aria-modal="true"
124
+ aria-label="Menu"
125
+ tabIndex={-1}
126
+ onClick={(e) => {
127
+ /* Same-page anchors wait for scroll unlock; other links navigate normally. */
128
+ const a = (e.target as HTMLElement).closest("a");
129
+ if (!a) return;
130
+ const url = new URL(a.href, window.location.href);
131
+ if (url.hash && url.pathname === window.location.pathname) {
132
+ e.preventDefault();
133
+ pendingHashRef.current = url.hash;
134
+ }
135
+ close();
136
+ }}
137
+ >
138
+ <div className="knav-pin">
139
+ <div className="knav-ptop">
140
+ <a className="knav-wordmark" href={homeHref} aria-label="Keystone — home">
141
+ <i className="knav-wmark" aria-hidden="true" />
142
+ </a>
143
+ <div className="knav-prailtop">
144
+ <span className="knav-plogo">
145
+ <i className="knav-mark" aria-hidden="true" />
146
+ </span>
147
+ <i className="knav-vr knav-mvr" aria-hidden="true" />
148
+ <button
149
+ type="button"
150
+ className="knav-mtoggle"
151
+ aria-expanded={open}
152
+ aria-controls="knav-panel"
153
+ aria-label="Close menu"
154
+ onClick={() => close()}
155
+ >
156
+ <GlyphStack />
157
+ </button>
158
+ </div>
159
+ </div>
160
+
161
+ <ul className="knav-list">
162
+ {rows.map((row) => {
163
+ if ("href" in row) {
164
+ return (
165
+ <li key={row.id} className="knav-slot">
166
+ <a className="knav-row" href={row.href}>
167
+ <span className="type ts-display-sans-2xs-light knav-rlabel">
168
+ {row.label}
169
+ </span>
170
+ </a>
171
+ </li>
172
+ );
173
+ }
174
+ const isOpen = openDrawer === row.id;
175
+ return (
176
+ <li
177
+ key={row.id}
178
+ className="knav-slot knav-gslot"
179
+ data-open={isOpen || undefined}
180
+ style={{
181
+ "--g-rm": row.group.rm,
182
+ "--g-rs": row.group.rs,
183
+ "--g-rt": row.group.rt,
184
+ "--bt-rm": row.boxTicks.rm,
185
+ "--bt-rs": row.boxTicks.rs,
186
+ "--bt-rt": row.boxTicks.rt,
187
+ }}
188
+ >
189
+ <div className="knav-gbox">
190
+ <button
191
+ type="button"
192
+ className="knav-row knav-gtrigger"
193
+ aria-expanded={isOpen}
194
+ aria-controls={`knav-g-${row.id}`}
195
+ onClick={() => setOpenDrawer(isOpen ? null : row.id)}
196
+ >
197
+ <span className="type ts-display-sans-2xs-light knav-rlabel">
198
+ {row.label}
199
+ </span>
200
+ <IconChevronDownMedium className="knav-rchev" />
201
+ </button>
202
+ <div className="knav-chips" id={`knav-g-${row.id}`}>
203
+ <div className="knav-chipsin">{row.drawer}</div>
204
+ </div>
205
+ </div>
206
+ </li>
207
+ );
208
+ })}
209
+ </ul>
210
+
211
+ <div className="knav-prail" aria-hidden="true">
212
+ {Array.from({ length: RAIL_CELL_COUNT }, (_, i) => (
213
+ <i key={i} className="knav-pcell" />
214
+ ))}
215
+ </div>
216
+
217
+ <div className="knav-pbtns">{buttons}</div>
218
+ </div>
219
+ </div>
220
+ </div>
221
+ );
222
+ }
@@ -0,0 +1,126 @@
1
+ /* Site navigation, shared: constants, the logo mark, engine colors, focus
2
+ rings, and the desktop/mobile switch at rd1. The two trees are different
3
+ designed components (bar with drawers · full-screen menu), so each has its
4
+ own file: nav-desktop.css and nav-mobile.css. Every child of the chrome is
5
+ fixed or absolute, so these wrappers are zero-height boxes that preserve the
6
+ navigation landmark without affecting layout. */
7
+
8
+ /* Designed constants for this file. */
9
+ :root {
10
+ --z-nav: 50;
11
+ --z-portal: 9999;
12
+ --knav-btn-pr: 14px;
13
+ --knav-drawer-lg: 890px;
14
+ --knav-drawer-md: 800px;
15
+ --knav-drawer-work: 593px;
16
+ --knav-drawer-h: 338px;
17
+ --knav-sub-w-lg: 264px;
18
+ --knav-sub-w-md: 255px;
19
+ --knav-card-w-md: 208px;
20
+ --knav-label-w: 280px;
21
+ --knav-sub-pt: 10px;
22
+ --knav-copy-w: 216px;
23
+ --knav-rchip-pl: 10px;
24
+ --knav-decor-cell: 112px;
25
+ --knav-decor-top: -78px;
26
+ --knav-decor-cx: -76px;
27
+ --knav-decor-teal: #d4ece7;
28
+ --knav-decor-brown: #eee5dd;
29
+ --knav-decor-yellow: #fbebcb;
30
+ --knav-underline-dur: 320ms;
31
+ --knav-ink-dur: 180ms;
32
+ --knav-chev-dur: 300ms;
33
+ --knav-reveal-fade: 180ms;
34
+ --knav-reveal-slide: 240ms;
35
+ --knav-reveal-rise: 6px;
36
+ --knav-blk-fade: 320ms;
37
+ --knav-blk-slide: 380ms;
38
+ --knav-blk-rise: 12px;
39
+ --knav-stagger: 50ms;
40
+ --knav-stagger-res: calc(7 * var(--knav-stagger) / 3);
41
+ --knav-stagger-work: calc(7 * var(--knav-stagger) / 2);
42
+ --knav-stagger-base: 60ms;
43
+ --icon-swap-dur: 250ms;
44
+ --icon-swap-blur: 2px;
45
+ --icon-swap-start-scale: 0.25;
46
+ --knav-card-slide-dur: var(--motion-cell-slide-dur);
47
+ --knav-card-shadow-dur: var(--motion-card-shadow-dur);
48
+ --knav-card-shadow-out-dur: var(--motion-card-shadow-out-dur);
49
+ --knav-card-ease: var(--motion-drawer-ease);
50
+ --knav-card-slide-ease: var(--motion-cell-slide-ease);
51
+ --knav-sub-fill-dur: 300ms;
52
+ --knav-sub-fill-out-dur: 400ms;
53
+ --knav-dot-morph-dur: var(--motion-dot-morph-dur);
54
+ --knav-dot-morph-out-dur: var(--motion-dot-morph-out-dur);
55
+ --knav-dot-morph-out-ease: var(--motion-dot-morph-out-ease);
56
+ --knav-dot-rotation: var(--motion-dot-rotation);
57
+ }
58
+
59
+ .ks-nav,
60
+ .ks-nav > nav {
61
+ display: block;
62
+ }
63
+
64
+ .knav-d {
65
+ display: none;
66
+ }
67
+ @container (--rd1) {
68
+ .knav-d {
69
+ display: block;
70
+ }
71
+ .knav-m {
72
+ display: none;
73
+ }
74
+ }
75
+
76
+ .knav-logo {
77
+ display: grid;
78
+ place-items: center;
79
+ flex: none;
80
+ width: var(--knav-bar-h);
81
+ height: var(--knav-bar-h);
82
+ background: var(--color-bg-200);
83
+ transition: background-color var(--icon-swap-dur) var(--motion-drawer-ease-open);
84
+ }
85
+ /* A page with no rail keeps only the mark, on the first tick. */
86
+ .knav-solo {
87
+ position: relative;
88
+ top: 0;
89
+ left: var(--t);
90
+ }
91
+ .knav-mark {
92
+ display: block;
93
+ width: var(--knav-logomark);
94
+ height: var(--knav-logomark);
95
+ background: var(--color-text-200);
96
+ -webkit-mask: url("/media/brand/ks-logomark.svg") center / contain no-repeat;
97
+ mask: url("/media/brand/ks-logomark.svg") center / contain no-repeat;
98
+ }
99
+
100
+ .knav-vr {
101
+ flex: none;
102
+ align-self: center;
103
+ width: 1px;
104
+ height: var(--space-3xl);
105
+ background: var(--color-bg-400);
106
+ transition: background-color var(--icon-swap-dur) var(--motion-drawer-ease-open);
107
+ }
108
+
109
+ .ks-nav [data-engine="brand"] { --_eng: var(--color-orange-400); }
110
+ .ks-nav [data-engine="visibility"] { --_eng: var(--color-yellow-400); }
111
+ .ks-nav [data-engine="ads"] { --_eng: var(--color-pink-400); }
112
+ .ks-nav [data-engine="reception"] { --_eng: var(--color-purple-400); }
113
+ .ks-nav [data-engine="engagement"] { --_eng: var(--color-blue-400); }
114
+
115
+ .knav-logo:focus-visible,
116
+ .knav-btn:focus-visible,
117
+ .knav-mtoggle:focus-visible,
118
+ .knav-row:focus-visible,
119
+ .knav-sub:focus-visible,
120
+ .knav-card:focus-visible,
121
+ .knav-chip:focus-visible,
122
+ .knav-rchip:focus-visible {
123
+ outline: none;
124
+ box-shadow: 0 0 0 var(--ring-w) var(--color-border-200);
125
+ z-index: 1;
126
+ }