@keystone-sites/marketing-design-system 1.0.27 → 2.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 (219) hide show
  1. package/README.md +47 -67
  2. package/fonts/gt-america-300-italic.woff2 +0 -0
  3. package/fonts/gt-america-300.woff2 +0 -0
  4. package/fonts/gt-america-400-italic.woff2 +0 -0
  5. package/fonts/gt-america-400.woff2 +0 -0
  6. package/fonts/gt-america-500.woff2 +0 -0
  7. package/fonts/gt-america-extended-300.woff2 +0 -0
  8. package/fonts/gt-america-extended-400.woff2 +0 -0
  9. package/fonts/gt-america-extended-500.woff2 +0 -0
  10. package/fonts/gt-america-extended-700.woff2 +0 -0
  11. package/fonts/gt-america-mono-300.woff2 +0 -0
  12. package/fonts/gt-america-mono-500.woff2 +0 -0
  13. package/fonts/pp-kyoto-vf.woff2 +0 -0
  14. package/package.json +46 -225
  15. package/src/base.css +300 -0
  16. package/src/fonts.css +131 -0
  17. package/src/hue.ts +17 -0
  18. package/src/icon.tsx +56 -0
  19. package/src/mark.tsx +14 -0
  20. package/src/motion.ts +123 -0
  21. package/src/parts/chip.css +84 -0
  22. package/src/parts/chip.tsx +40 -0
  23. package/src/parts/composer.css +195 -0
  24. package/src/parts/composer.tsx +220 -0
  25. package/src/parts/cx.ts +2 -0
  26. package/src/parts/faq.css +77 -0
  27. package/src/parts/faq.tsx +25 -0
  28. package/src/parts/footer.css +51 -0
  29. package/src/parts/footer.tsx +27 -0
  30. package/src/parts/nav.css +180 -0
  31. package/src/parts/nav.tsx +101 -0
  32. package/src/parts/photo.css +15 -0
  33. package/src/parts/photo.tsx +24 -0
  34. package/src/parts/plans.css +89 -0
  35. package/src/parts/plans.tsx +56 -0
  36. package/src/parts/prose.css +86 -0
  37. package/src/parts/prose.tsx +49 -0
  38. package/src/parts/shape.css +47 -0
  39. package/src/parts/shape.tsx +68 -0
  40. package/src/parts/split.tsx +49 -0
  41. package/src/parts/stamp.css +85 -0
  42. package/src/parts/stamp.tsx +36 -0
  43. package/src/parts/work-card.css +51 -0
  44. package/src/parts/work-card.tsx +40 -0
  45. package/src/set.css +439 -0
  46. package/src/styles.css +20 -0
  47. package/src/tokens/color.css +471 -0
  48. package/src/tokens/roles.css +12 -0
  49. package/src/tokens/type.css +11 -0
  50. package/src/wordmark.tsx +34 -0
  51. package/AGENTS.md +0 -216
  52. package/assets/media/brand/ks-lockup.svg +0 -13
  53. package/assets/media/brand/ks-logomark.svg +0 -4
  54. package/assets/media/brand/ks-wordmark-inline.svg +0 -13
  55. package/assets/media/brand/ks-wordmark.svg +0 -11
  56. package/assets/media/fonts/gt-standard-standard-vf.woff2 +0 -0
  57. package/assets/media/fonts/pp-kyoto-variable-upright-vf.woff2 +0 -0
  58. package/base.css +0 -113
  59. package/css-vars.d.ts +0 -10
  60. package/grid/engine.css +0 -388
  61. package/grid/field-hash.ts +0 -31
  62. package/grid/field.tsx +0 -48
  63. package/grid/gates.cjs +0 -35
  64. package/grid/region.tsx +0 -97
  65. package/icons.tsx +0 -1508
  66. package/index.css +0 -94
  67. package/lib/autoplay-gate.ts +0 -88
  68. package/lib/focus-trap.ts +0 -42
  69. package/lib/grader.ts +0 -123
  70. package/lib/legal-data.ts +0 -1
  71. package/lib/legal.ts +0 -41
  72. package/lib/markdown.ts +0 -200
  73. package/lib/noise.tsx +0 -114
  74. package/lib/phone.ts +0 -294
  75. package/lib/render-boundary.tsx +0 -27
  76. package/lib/scroll-lock.ts +0 -25
  77. package/lib/swipe.ts +0 -124
  78. package/lib/use-active-section.ts +0 -43
  79. package/lib/use-copy.ts +0 -41
  80. package/lib/use-count-up.ts +0 -26
  81. package/lib/use-grader-search.ts +0 -143
  82. package/lib/use-popover.ts +0 -30
  83. package/lib/use-video-carousel.ts +0 -271
  84. package/media.ts +0 -558
  85. package/primitives/ask-cursor.tsx +0 -74
  86. package/primitives/ask.css +0 -103
  87. package/primitives/ask.tsx +0 -28
  88. package/primitives/breadcrumb.css +0 -51
  89. package/primitives/breadcrumb.tsx +0 -46
  90. package/primitives/business-picker.css +0 -135
  91. package/primitives/business-picker.tsx +0 -298
  92. package/primitives/button-inline.css +0 -58
  93. package/primitives/button-inline.tsx +0 -48
  94. package/primitives/buttons.css +0 -551
  95. package/primitives/buttons.tsx +0 -330
  96. package/primitives/case-study-button.css +0 -71
  97. package/primitives/case-study-button.tsx +0 -28
  98. package/primitives/case-study-card.css +0 -318
  99. package/primitives/case-study-card.tsx +0 -116
  100. package/primitives/chart.css +0 -110
  101. package/primitives/chart.tsx +0 -198
  102. package/primitives/chat-copy.tsx +0 -30
  103. package/primitives/chat.css +0 -1086
  104. package/primitives/chat.tsx +0 -684
  105. package/primitives/chip.css +0 -127
  106. package/primitives/chip.tsx +0 -53
  107. package/primitives/closer-row.css +0 -14
  108. package/primitives/closer-row.tsx +0 -22
  109. package/primitives/cta-row.css +0 -41
  110. package/primitives/cta-row.tsx +0 -39
  111. package/primitives/disclosure.css +0 -302
  112. package/primitives/disclosure.tsx +0 -277
  113. package/primitives/faq-question.css +0 -220
  114. package/primitives/faq-question.tsx +0 -55
  115. package/primitives/field.css +0 -279
  116. package/primitives/field.tsx +0 -376
  117. package/primitives/footer-item.css +0 -72
  118. package/primitives/footer-item.tsx +0 -42
  119. package/primitives/glyph-toggle.css +0 -62
  120. package/primitives/glyph-toggle.tsx +0 -42
  121. package/primitives/grader-menu.tsx +0 -84
  122. package/primitives/grader.css +0 -369
  123. package/primitives/grader.tsx +0 -285
  124. package/primitives/keystone-score.css +0 -156
  125. package/primitives/keystone-score.tsx +0 -204
  126. package/primitives/markdown.css +0 -232
  127. package/primitives/markdown.tsx +0 -359
  128. package/primitives/modal.css +0 -193
  129. package/primitives/modal.tsx +0 -204
  130. package/primitives/month-range.css +0 -80
  131. package/primitives/month-range.tsx +0 -183
  132. package/primitives/notice.css +0 -39
  133. package/primitives/notice.tsx +0 -56
  134. package/primitives/persona-card.css +0 -374
  135. package/primitives/persona-card.tsx +0 -74
  136. package/primitives/picture.css +0 -11
  137. package/primitives/picture.tsx +0 -41
  138. package/primitives/plan-card.css +0 -398
  139. package/primitives/plan-card.tsx +0 -153
  140. package/primitives/prompt.css +0 -588
  141. package/primitives/prompt.tsx +0 -440
  142. package/primitives/prose.css +0 -164
  143. package/primitives/prose.tsx +0 -194
  144. package/primitives/ramps.css +0 -77
  145. package/primitives/report-nav.css +0 -382
  146. package/primitives/report-nav.tsx +0 -353
  147. package/primitives/report.css +0 -601
  148. package/primitives/report.tsx +0 -357
  149. package/primitives/skeleton.css +0 -82
  150. package/primitives/skeleton.tsx +0 -56
  151. package/primitives/slider.css +0 -179
  152. package/primitives/slider.tsx +0 -69
  153. package/primitives/slug.css +0 -87
  154. package/primitives/slug.tsx +0 -37
  155. package/primitives/status.css +0 -427
  156. package/primitives/status.tsx +0 -323
  157. package/primitives/strip.css +0 -43
  158. package/primitives/surface.css +0 -88
  159. package/primitives/surface.tsx +0 -100
  160. package/primitives/table.css +0 -227
  161. package/primitives/table.tsx +0 -122
  162. package/primitives/tabs.css +0 -85
  163. package/primitives/tabs.tsx +0 -122
  164. package/primitives/tag.css +0 -46
  165. package/primitives/tag.tsx +0 -33
  166. package/primitives/text.css +0 -127
  167. package/primitives/toc.css +0 -65
  168. package/primitives/toc.tsx +0 -42
  169. package/primitives/tooltip.css +0 -56
  170. package/primitives/tooltip.tsx +0 -103
  171. package/rules/design-system.md +0 -154
  172. package/rules/grid-and-layout.md +0 -174
  173. package/scripts/generate-exports.mjs +0 -61
  174. package/scripts/generate-type-css.mjs +0 -130
  175. package/sections/faq-island.tsx +0 -102
  176. package/sections/faq.css +0 -213
  177. package/sections/faq.tsx +0 -46
  178. package/sections/footer-nav.tsx +0 -95
  179. package/sections/footer-signature.css +0 -223
  180. package/sections/footer-signature.tsx +0 -127
  181. package/sections/footer.css +0 -735
  182. package/sections/footer.tsx +0 -286
  183. package/sections/gallery-overlay.css +0 -212
  184. package/sections/gallery-overlay.tsx +0 -267
  185. package/sections/landing-benefits.css +0 -59
  186. package/sections/landing-benefits.tsx +0 -81
  187. package/sections/landing-closer.css +0 -23
  188. package/sections/landing-closer.tsx +0 -26
  189. package/sections/landing-hero.css +0 -80
  190. package/sections/landing-hero.tsx +0 -69
  191. package/sections/landing-quote.css +0 -19
  192. package/sections/landing-quote.tsx +0 -30
  193. package/sections/landing-sample.ts +0 -66
  194. package/sections/landing.css +0 -45
  195. package/sections/landing.tsx +0 -69
  196. package/sections/load-orchestrator.tsx +0 -43
  197. package/sections/load.css +0 -138
  198. package/sections/nav-desktop.css +0 -530
  199. package/sections/nav-desktop.tsx +0 -155
  200. package/sections/nav-menu.css +0 -57
  201. package/sections/nav-menu.tsx +0 -112
  202. package/sections/nav-mobile.css +0 -571
  203. package/sections/nav-mobile.tsx +0 -222
  204. package/sections/nav-solo.tsx +0 -28
  205. package/sections/nav.css +0 -135
  206. package/sections/nav.tsx +0 -394
  207. package/sections/site-chat-data.ts +0 -16
  208. package/sections/site-chat-open.tsx +0 -25
  209. package/sections/site-chat.tsx +0 -67
  210. package/site-links.ts +0 -41
  211. package/site.ts +0 -2
  212. package/themes/inverted.css +0 -177
  213. package/tokens/fonts.css +0 -38
  214. package/tokens/motion.css +0 -158
  215. package/tokens/primitives.css +0 -163
  216. package/tokens/semantic.css +0 -174
  217. package/tokens/type-styles.json +0 -145
  218. package/tokens/type.css +0 -1548
  219. package/widgets.css +0 -78
@@ -1,227 +0,0 @@
1
- /* Table: dense rows on a surface. Hairline row dividers, a raised head
2
- row, and sort controls in the tab vocabulary (ink on hover, teal
3
- tick when active). The wrap scrolls sideways so columns keep their
4
- widths from the tablet band; below it, marked columns drop instead.
5
- The body's type is the table's ts- step; cells restate only the
6
- step that differs (head, primary, secondary, mono). `.pager-btn` is
7
- the round step button the month range's year stepper shares. */
8
-
9
- /* Designed constants for this file. */
10
- :root {
11
- --table-pager-btn: 32px;
12
- }
13
-
14
- .table-wrap {
15
- width: 100%;
16
- overflow-x: auto;
17
- scrollbar-width: thin;
18
- }
19
- .table {
20
- width: 100%;
21
- min-width: var(--table-min, 0);
22
- border-collapse: collapse;
23
- text-align: left;
24
- color: var(--color-text-200);
25
- }
26
- .table thead th {
27
- position: sticky;
28
- top: 0;
29
- z-index: 1;
30
- padding: var(--space-md) var(--space-xl);
31
- background: var(--color-bg-200);
32
- border-bottom: 1px solid var(--color-border-050);
33
- color: var(--color-text-400);
34
- --font: var(--ts-text-xs-medium-font);
35
- --ls: 0.06em;
36
- --opsz: var(--ts-text-xs-medium-opsz);
37
- font: var(--font);
38
- letter-spacing: var(--ls);
39
- font-variation-settings:
40
- "opsz" var(--opsz),
41
- var(--font-sans-slnt);
42
- text-transform: uppercase;
43
- white-space: nowrap;
44
- vertical-align: bottom;
45
- }
46
- .table tbody td {
47
- padding: var(--space-lg) var(--space-xl);
48
- border-top: 1px solid var(--color-border-050);
49
- vertical-align: top;
50
- }
51
- .table tbody tr:first-child td {
52
- border-top: 0;
53
- }
54
- .table [data-align="end"],
55
- .table [data-align="end"] .table-sort {
56
- text-align: right;
57
- justify-content: flex-end;
58
- }
59
- .table [data-numeric] {
60
- font-variant-numeric: tabular-nums;
61
- }
62
- .table [data-nowrap] {
63
- white-space: nowrap;
64
- }
65
- /* The phone band: no sideways scroll, marked columns drop. */
66
- .table {
67
- min-width: 0;
68
- }
69
- .table [data-narrow-hide] {
70
- display: none;
71
- }
72
- @container (--rt) {
73
- .table {
74
- min-width: var(--table-min, 0);
75
- }
76
- .table [data-narrow-hide] {
77
- display: revert;
78
- }
79
- }
80
- .table :is(th, td):first-child {
81
- padding-left: var(--space-2xl);
82
- }
83
- .table :is(th, td):last-child {
84
- padding-right: var(--space-2xl);
85
- }
86
- .table tbody tr[data-interactive] {
87
- cursor: pointer;
88
- transition: background var(--motion-hover-duration) var(--motion-hover-ease);
89
- }
90
- @media (hover: hover) {
91
- .table tbody tr[data-interactive]:hover td {
92
- background: var(--color-bg-300);
93
- }
94
- }
95
- .table tbody tr[data-interactive]:focus-visible {
96
- outline: none;
97
- }
98
- .table tbody tr[data-interactive]:focus-visible td {
99
- box-shadow: inset 0 0 0 var(--ring-w) var(--color-teal-200);
100
- }
101
- .table tbody tr[data-tone="group"] td {
102
- background: var(--color-bg-100);
103
- color: var(--color-text-100);
104
- font: var(--ts-text-sm-medium-font);
105
- letter-spacing: var(--ts-text-sm-medium-ls);
106
- }
107
- .table-primary {
108
- color: var(--color-text-100);
109
- font: var(--ts-text-sm-medium-font);
110
- letter-spacing: var(--ts-text-sm-medium-ls);
111
- }
112
- .table-secondary {
113
- display: block;
114
- margin-top: var(--space-2xs);
115
- color: var(--color-text-500);
116
- font: var(--ts-text-xs-light-font);
117
- letter-spacing: var(--ts-text-xs-light-ls);
118
- }
119
- .table-mono {
120
- font-family: var(--font-mono);
121
- font-size: 0.75rem;
122
- }
123
- .table-empty td {
124
- padding-block: calc(var(--t) * 0.75);
125
- text-align: center;
126
- color: var(--color-text-400);
127
- }
128
-
129
- /* Sort control in the head cell. */
130
- .table-sort {
131
- appearance: none;
132
- display: inline-flex;
133
- align-items: center;
134
- gap: var(--space-xs);
135
- margin: 0;
136
- padding: 0;
137
- border: 0;
138
- background: none;
139
- color: inherit;
140
- font: inherit;
141
- letter-spacing: inherit;
142
- text-transform: inherit;
143
- cursor: pointer;
144
- transition: color var(--motion-hover-duration) var(--motion-hover-ease);
145
- }
146
- .table-sort:hover {
147
- color: var(--color-text-200);
148
- }
149
- .table-sort[data-active] {
150
- color: var(--color-text-100);
151
- }
152
- .table-sort:focus-visible {
153
- outline: none;
154
- box-shadow: 0 0 0 var(--ring-w) var(--color-teal-200);
155
- border-radius: var(--radius-xs);
156
- }
157
- .table-sort-tick {
158
- flex: none;
159
- opacity: 0.4;
160
- transition:
161
- transform var(--motion-hover-duration) var(--motion-hover-ease),
162
- opacity var(--motion-hover-duration) var(--motion-hover-ease);
163
- }
164
- .table-sort[data-active] .table-sort-tick {
165
- opacity: 1;
166
- color: var(--color-teal-300);
167
- }
168
- .table-sort[data-dir="asc"] .table-sort-tick {
169
- transform: rotate(180deg);
170
- }
171
-
172
- /* Pager: a summary on the left, page count and chevrons on the right. */
173
- .pager {
174
- display: flex;
175
- align-items: center;
176
- justify-content: space-between;
177
- gap: var(--space-lg);
178
- flex-wrap: wrap;
179
- }
180
- .pager-summary {
181
- color: var(--color-text-400);
182
- }
183
- .pager-controls {
184
- display: flex;
185
- align-items: center;
186
- gap: var(--space-sm);
187
- margin-left: auto;
188
- }
189
- .pager-controls > p {
190
- margin-right: var(--space-sm);
191
- }
192
- .pager-of {
193
- color: var(--color-text-400);
194
- }
195
- .pager-btn {
196
- appearance: none;
197
- display: grid;
198
- place-items: center;
199
- width: var(--table-pager-btn);
200
- height: var(--table-pager-btn);
201
- border: 1px solid var(--color-border-100);
202
- border-radius: var(--radius-full);
203
- background: transparent;
204
- color: var(--color-text-200);
205
- cursor: pointer;
206
- transition:
207
- background var(--motion-hover-duration) var(--motion-hover-ease),
208
- color var(--motion-hover-duration) var(--motion-hover-ease),
209
- opacity var(--motion-hover-duration) var(--motion-hover-ease);
210
- }
211
- @media (hover: hover) {
212
- .pager-btn:not(:disabled):hover {
213
- background: var(--color-bg-300);
214
- color: var(--color-text-100);
215
- }
216
- }
217
- .pager-btn:disabled {
218
- opacity: 0.35;
219
- cursor: default;
220
- }
221
- .pager-btn:focus-visible {
222
- outline: none;
223
- box-shadow: 0 0 0 var(--ring-w) var(--color-teal-200);
224
- }
225
- .pager-btn svg {
226
- display: block;
227
- }
@@ -1,122 +0,0 @@
1
- /** Table: dense rows of data with sortable columns, and the pager that
2
- * walks them. Styles live in table.css. The consumer owns the rows,
3
- * the sort state and the page. */
4
-
5
- import type { ReactNode } from "react";
6
- import { IconChevronDownSmall, IconChevronLeftSm, IconChevronRightSm } from "../icons";
7
- import { Copy } from "./prose";
8
-
9
- export type SortDir = "asc" | "desc";
10
-
11
- export function Table({
12
- label,
13
- minWidth,
14
- className,
15
- children,
16
- }: {
17
- /** Accessible name for the table. */
18
- label: string;
19
- /** From the tablet anchor, columns keep this width and the wrap
20
- * scrolls sideways; phones drop `data-narrow-hide` columns instead. */
21
- minWidth?: number;
22
- className?: string;
23
- children: ReactNode;
24
- }) {
25
- return (
26
- <div className={className ? `table-wrap ${className}` : "table-wrap"}>
27
- <table
28
- className="type type-fixed ts-text-sm-light table"
29
- aria-label={label}
30
- style={minWidth ? { "--table-min": `${minWidth}px` } : undefined}
31
- >
32
- {children}
33
- </table>
34
- </div>
35
- );
36
- }
37
-
38
- export function SortHeader({
39
- active,
40
- dir,
41
- onSort,
42
- align,
43
- narrowHide,
44
- children,
45
- }: {
46
- active: boolean;
47
- dir: SortDir;
48
- onSort: () => void;
49
- align?: "end";
50
- /** Drop the column on phones. */
51
- narrowHide?: boolean;
52
- children: ReactNode;
53
- }) {
54
- return (
55
- <th
56
- scope="col"
57
- aria-sort={active ? (dir === "asc" ? "ascending" : "descending") : "none"}
58
- data-align={align}
59
- data-narrow-hide={narrowHide || undefined}
60
- >
61
- <button
62
- type="button"
63
- className="table-sort"
64
- data-active={active || undefined}
65
- data-dir={active ? dir : undefined}
66
- onClick={onSort}
67
- >
68
- <span>{children}</span>
69
- <IconChevronDownSmall className="table-sort-tick" />
70
- </button>
71
- </th>
72
- );
73
- }
74
-
75
- export function Pager({
76
- page,
77
- pages,
78
- onPage,
79
- disabled,
80
- label,
81
- summary,
82
- }: {
83
- page: number;
84
- pages: number;
85
- onPage: (page: number) => void;
86
- disabled?: boolean;
87
- /** Accessible name for the pager. */
88
- label: string;
89
- /** Optional text on the left, e.g. "25 of 1,204 businesses". */
90
- summary?: ReactNode;
91
- }) {
92
- const last = Math.max(1, pages);
93
- return (
94
- <nav className="pager" aria-label={label}>
95
- <Copy className="pager-summary">{summary}</Copy>
96
- <div className="pager-controls">
97
- <Copy weight="medium" num>
98
- <span className="pager-page">{page}</span>
99
- <span className="type type-fixed ts-text-sm-light pager-of"> / {last}</span>
100
- </Copy>
101
- <button
102
- type="button"
103
- className="pager-btn"
104
- aria-label="Previous page"
105
- disabled={disabled || page <= 1}
106
- onClick={() => onPage(page - 1)}
107
- >
108
- <IconChevronLeftSm />
109
- </button>
110
- <button
111
- type="button"
112
- className="pager-btn"
113
- aria-label="Next page"
114
- disabled={disabled || page >= last}
115
- onClick={() => onPage(page + 1)}
116
- >
117
- <IconChevronRightSm />
118
- </button>
119
- </div>
120
- </nav>
121
- );
122
- }
@@ -1,85 +0,0 @@
1
- /* Tabs: a strip of equal cells in the nav-bar vocabulary. The same
2
- strip serves in-page anchor navigation (aria-current). Raised
3
- chrome, hairline dividers, an underline that scales in like the nav
4
- buttons. The strip is line-inclusive so its edges share lattice
5
- pixels. Type comes from the cell's ts- step. */
6
-
7
- .tabs {
8
- display: flex;
9
- align-items: stretch;
10
- box-sizing: border-box;
11
- width: calc(var(--t) * 12 + 1px);
12
- height: calc(var(--knav-bar-h) + 1px);
13
- margin: -1px 0 0;
14
- padding: var(--space-none);
15
- list-style: none;
16
- border: 1px solid var(--color-border-000);
17
- background: var(--color-bg-200);
18
- overflow-x: auto;
19
- scrollbar-width: none;
20
- }
21
- .tabs::-webkit-scrollbar {
22
- display: none;
23
- }
24
- .tabs > li {
25
- display: flex;
26
- flex: 1 1 0;
27
- min-width: max-content;
28
- }
29
- .tabs > li + li {
30
- border-left: 1px solid var(--color-border-000);
31
- }
32
- .tab {
33
- position: relative;
34
- display: flex;
35
- flex: 1 1 auto;
36
- align-items: center;
37
- justify-content: center;
38
- gap: var(--space-sm);
39
- padding-inline: var(--space-xl);
40
- border: 0;
41
- background: transparent;
42
- color: var(--color-text-400);
43
- text-decoration: none;
44
- white-space: nowrap;
45
- cursor: pointer;
46
- transition: color var(--knav-ink-dur) var(--motion-hover-ease);
47
- }
48
- .tab::after {
49
- content: "";
50
- position: absolute;
51
- left: 0;
52
- right: 0;
53
- bottom: -1px;
54
- height: 2px;
55
- background: var(--color-teal-300);
56
- transform: scaleX(0);
57
- transform-origin: center;
58
- transition: transform var(--knav-underline-dur) var(--motion-drawer-ease);
59
- }
60
- .tab:hover {
61
- color: var(--color-text-200);
62
- }
63
- .tab[aria-selected="true"],
64
- .tab[aria-current="true"] {
65
- color: var(--color-text-100);
66
- }
67
- .tab[aria-selected="true"]::after,
68
- .tab[aria-current="true"]::after {
69
- transform: scaleX(1);
70
- }
71
- .tab:focus-visible {
72
- outline: none;
73
- box-shadow: inset 0 0 0 var(--ring-w) var(--color-border-200);
74
- z-index: 1;
75
- }
76
- .tab-count {
77
- display: inline-grid;
78
- place-items: center;
79
- min-width: 18px;
80
- height: 18px;
81
- padding-inline: var(--space-xs);
82
- border-radius: var(--radius-full);
83
- background: var(--color-bg-400);
84
- color: var(--color-text-200);
85
- }
@@ -1,122 +0,0 @@
1
- "use client";
2
-
3
- /** Tabs: a strip of equal cells with roving keyboard focus. Styles live
4
- * in tabs.css. The consumer owns the selected id and the panels. */
5
-
6
- import { useEffect, useRef, type KeyboardEvent, type ReactNode } from "react";
7
-
8
- export interface TabItem<Id extends string> {
9
- id: Id;
10
- label: ReactNode;
11
- count?: number;
12
- }
13
-
14
- export function Tabs<Id extends string>({
15
- items,
16
- selected,
17
- onSelect,
18
- label,
19
- idPrefix = "tab",
20
- className,
21
- }: {
22
- items: readonly TabItem<Id>[];
23
- selected: Id;
24
- onSelect: (id: Id) => void;
25
- /** Accessible name for the tab list. */
26
- label: string;
27
- idPrefix?: string;
28
- className?: string;
29
- }) {
30
- const listRef = useRef<HTMLUListElement>(null);
31
-
32
- function onKeyDown(e: KeyboardEvent<HTMLButtonElement>, index: number) {
33
- const count = items.length;
34
- let next: number | null = null;
35
- if (e.key === "ArrowRight") next = (index + 1) % count;
36
- else if (e.key === "ArrowLeft") next = (index + count - 1) % count;
37
- else if (e.key === "Home") next = 0;
38
- else if (e.key === "End") next = count - 1;
39
- if (next == null) return;
40
- e.preventDefault();
41
- const target = items[next];
42
- onSelect(target.id);
43
- listRef.current?.querySelectorAll<HTMLButtonElement>(".tab")[next]?.focus();
44
- }
45
-
46
- return (
47
- <ul
48
- className={className ? `tabs ${className}` : "tabs"}
49
- role="tablist"
50
- aria-label={label}
51
- ref={listRef}
52
- >
53
- {items.map((item, i) => {
54
- const active = item.id === selected;
55
- return (
56
- <li key={item.id} role="presentation">
57
- <button
58
- type="button"
59
- role="tab"
60
- id={`${idPrefix}-${item.id}`}
61
- className="type type-fixed ts-text-sm-regular tab"
62
- aria-selected={active}
63
- aria-controls={`${idPrefix}-panel-${item.id}`}
64
- tabIndex={active ? 0 : -1}
65
- onClick={() => onSelect(item.id)}
66
- onKeyDown={(e) => onKeyDown(e, i)}
67
- >
68
- {item.label}
69
- {item.count != null && (
70
- <span className="type type-fixed ts-text-2xs-medium tab-count">{item.count}</span>
71
- )}
72
- </button>
73
- </li>
74
- );
75
- })}
76
- </ul>
77
- );
78
- }
79
-
80
- export interface AnchorItem {
81
- id: string;
82
- label: ReactNode;
83
- }
84
-
85
- /** The tab strip as in-page navigation: links to section ids with the
86
- * current one marked. The consumer owns the scroll spy. */
87
- export function AnchorNav({
88
- items,
89
- activeId,
90
- label,
91
- className,
92
- }: {
93
- items: readonly AnchorItem[];
94
- activeId: string;
95
- label: string;
96
- className?: string;
97
- }) {
98
- const listRef = useRef<HTMLUListElement>(null);
99
- useEffect(() => {
100
- const link = listRef.current?.querySelector<HTMLAnchorElement>(
101
- `a[href="#${CSS.escape(activeId)}"]`,
102
- );
103
- link?.scrollIntoView({ block: "nearest", inline: "center", behavior: "smooth" });
104
- }, [activeId]);
105
- return (
106
- <nav aria-label={label} className={className}>
107
- <ul className="tabs" ref={listRef}>
108
- {items.map((item) => (
109
- <li key={item.id}>
110
- <a
111
- className="type type-fixed ts-text-sm-regular tab"
112
- href={`#${item.id}`}
113
- aria-current={item.id === activeId ? "true" : undefined}
114
- >
115
- {item.label}
116
- </a>
117
- </li>
118
- ))}
119
- </ul>
120
- </nav>
121
- );
122
- }
@@ -1,46 +0,0 @@
1
- /* Tag: a hue tint behind a label, square-cornered (1184:51697). Fixed
2
- geometry per size; the label's type rides the size keyword the way the
3
- buttons' does, so a mount declares `--tag-size` per band on an ancestor
4
- and one tag serves every band. The tint and ink come from the status
5
- hue ramps through data-hue. */
6
-
7
- .tag {
8
- display: inline-flex;
9
- align-items: center;
10
- box-sizing: border-box;
11
- border-radius: var(--radius-xs);
12
- background: var(--_fill);
13
- color: var(--_ink);
14
- white-space: nowrap;
15
- }
16
- .tag[data-size="md"] { --tag-size: md; }
17
- .tag[data-size="sm"] { --tag-size: sm; }
18
- /* The teal chip tints a step deeper than the status ramp's teal fill
19
- (1184:51697, color/teal/300); every other hue matches its ramp. */
20
- .tag[data-hue="teal"] {
21
- --_fill: var(--color-teal-300);
22
- }
23
-
24
- /* The label sits one pixel high in its box (3 over, 4 under), as drawn. */
25
- .tag-body {
26
- display: block;
27
- padding: var(--_pt) var(--space-md) var(--_pb);
28
- }
29
- @container style(--tag-size: md) {
30
- .tag-body {
31
- --_pt: 3px;
32
- --_pb: 4px;
33
- --font: var(--ts-text-sm-regular-font);
34
- --ls: var(--ts-text-sm-regular-ls);
35
- --opsz: var(--ts-text-sm-regular-opsz);
36
- }
37
- }
38
- @container style(--tag-size: sm) {
39
- .tag-body {
40
- --_pt: 2px;
41
- --_pb: 3px;
42
- --font: var(--ts-text-xs-regular-font);
43
- --ls: var(--ts-text-xs-regular-ls);
44
- --opsz: var(--ts-text-xs-regular-opsz);
45
- }
46
- }
@@ -1,33 +0,0 @@
1
- /** Tag: a square-cornered hue tint with a label — the category mark of
2
- * the usage price list (ks-MarketingSite 1184:51697). Material: fixed px
3
- * per size, never band-aware; a mount picks the size per band with
4
- * `--tag-size`. Colour arrives through `data-hue` and the status ramps.
5
- * Styles live in tag.css. */
6
-
7
- import type { ReactNode } from "react";
8
- import type { Hue } from "./status";
9
-
10
- export type TagSize = "md" | "sm" | "inherit";
11
-
12
- export function Tag({
13
- hue,
14
- size = "md",
15
- className,
16
- children,
17
- }: {
18
- hue: Hue;
19
- /** `inherit` takes `--tag-size` from an ancestor. */
20
- size?: TagSize;
21
- className?: string;
22
- children: ReactNode;
23
- }) {
24
- return (
25
- <span
26
- className={className ? `tag ${className}` : "tag"}
27
- data-hue={hue}
28
- data-size={size === "inherit" ? undefined : size}
29
- >
30
- <span className="type type-fixed tag-body">{children}</span>
31
- </span>
32
- );
33
- }