@vvedantb/ui 0.47.0 → 0.48.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/README.md CHANGED
@@ -916,6 +916,8 @@ It is plain markup with no motion and needs no `createLandingKit`.
916
916
  | Prop | |
917
917
  | --- | --- |
918
918
  | `app` | `vibot`, `vmem`, `verve`, `velth` or `vhub`. |
919
+ | `brand` | In place of `app`, for a site that is not a product app (0.48.0): the site's own wordmark node. Set `githubLabel` for the GitHub button's `aria-label`. |
920
+ | `actions` | Optional small control before the CTA, shown at every width, for example a theme toggle (0.48.0). |
919
921
  | `homeLabel` | `aria-label` of the home wordmark link. |
920
922
  | `homeHref` | Default `#home`. |
921
923
  | `links` | `{ label, href }[]`, at most 4. More logs a development warning and only the first 4 render. |
@@ -129,7 +129,7 @@ function SiteHeaderMenu(t0) {
129
129
  * Marketing header for the Project V apps: a `FloatingBar` with `AppWordmark` at `SITE_HEADER_WORDMARK_SIZE`, up to
130
130
  * four links, one `cta` and an optional GitHub button. Below `md` the menu button sits on the left, the wordmark is
131
131
  * centred, and the links, the CTA and GitHub move into one dropdown menu. Plain markup with no motion, so any app can
132
- * use it.
132
+ * use it. A site that is not a product app passes `brand` in place of `app`.
133
133
  */
134
134
  function _temp(link) {
135
135
  return /*#__PURE__*/_jsx(DropdownMenuItem, {
@@ -142,14 +142,17 @@ function _temp(link) {
142
142
  }, link.href);
143
143
  }
144
144
  export function SiteHeader(t0) {
145
- const $ = _c(35);
145
+ const $ = _c(38);
146
146
  const {
147
147
  app,
148
+ brand,
149
+ githubLabel,
148
150
  homeHref: t1,
149
151
  homeLabel,
150
152
  links,
151
153
  cta,
152
154
  githubUrl,
155
+ actions,
153
156
  className
154
157
  } = t0;
155
158
  const homeHref = t1 === undefined ? "#home" : t1;
@@ -208,53 +211,54 @@ export function SiteHeader(t0) {
208
211
  t6 = $[10];
209
212
  }
210
213
  let t7;
211
- if ($[11] !== app) {
212
- t7 = /*#__PURE__*/_jsx(AppWordmark, {
214
+ if ($[11] !== app || $[12] !== brand) {
215
+ t7 = app ? /*#__PURE__*/_jsx(AppWordmark, {
213
216
  app: app,
214
217
  size: SITE_HEADER_WORDMARK_SIZE
215
- });
218
+ }) : brand;
216
219
  $[11] = app;
217
- $[12] = t7;
220
+ $[12] = brand;
221
+ $[13] = t7;
218
222
  } else {
219
- t7 = $[12];
223
+ t7 = $[13];
220
224
  }
221
225
  let t8;
222
- if ($[13] !== homeHref || $[14] !== homeLabel || $[15] !== t7) {
226
+ if ($[14] !== homeHref || $[15] !== homeLabel || $[16] !== t7) {
223
227
  t8 = /*#__PURE__*/_jsx("a", {
224
228
  href: homeHref,
225
229
  className: t6,
226
230
  "aria-label": homeLabel,
227
231
  children: t7
228
232
  });
229
- $[13] = homeHref;
230
- $[14] = homeLabel;
231
- $[15] = t7;
232
- $[16] = t8;
233
+ $[14] = homeHref;
234
+ $[15] = homeLabel;
235
+ $[16] = t7;
236
+ $[17] = t8;
233
237
  } else {
234
- t8 = $[16];
238
+ t8 = $[17];
235
239
  }
236
240
  let t9;
237
- if ($[17] !== shown) {
241
+ if ($[18] !== shown) {
238
242
  t9 = shown.map(_temp2);
239
- $[17] = shown;
240
- $[18] = t9;
243
+ $[18] = shown;
244
+ $[19] = t9;
241
245
  } else {
242
- t9 = $[18];
246
+ t9 = $[19];
243
247
  }
244
248
  let t10;
245
- if ($[19] !== t9) {
249
+ if ($[20] !== t9) {
246
250
  t10 = /*#__PURE__*/_jsx("nav", {
247
251
  className: "hidden items-center gap-1 md:flex",
248
252
  "aria-label": "Page",
249
253
  children: t9
250
254
  });
251
- $[19] = t9;
252
- $[20] = t10;
255
+ $[20] = t9;
256
+ $[21] = t10;
253
257
  } else {
254
- t10 = $[20];
258
+ t10 = $[21];
255
259
  }
256
260
  let t11;
257
- if ($[21] !== app || $[22] !== githubUrl) {
261
+ if ($[22] !== app || $[23] !== githubLabel || $[24] !== githubUrl) {
258
262
  t11 = githubUrl ? /*#__PURE__*/_jsx(Button, {
259
263
  asChild: true,
260
264
  variant: "ghost",
@@ -264,56 +268,58 @@ export function SiteHeader(t0) {
264
268
  href: githubUrl,
265
269
  target: "_blank",
266
270
  rel: "noreferrer",
267
- "aria-label": `${app} on GitHub`,
271
+ "aria-label": app ? `${app} on GitHub` : githubLabel ?? "GitHub",
268
272
  children: /*#__PURE__*/_jsx(GitHubIcon, {
269
273
  size: 18
270
274
  })
271
275
  })
272
276
  }) : null;
273
- $[21] = app;
274
- $[22] = githubUrl;
275
- $[23] = t11;
277
+ $[22] = app;
278
+ $[23] = githubLabel;
279
+ $[24] = githubUrl;
280
+ $[25] = t11;
276
281
  } else {
277
- t11 = $[23];
282
+ t11 = $[25];
278
283
  }
279
284
  let t12;
280
- if ($[24] !== cta) {
285
+ if ($[26] !== cta) {
281
286
  t12 = /*#__PURE__*/_jsx("div", {
282
287
  className: "hidden md:flex",
283
288
  children: cta
284
289
  });
285
- $[24] = cta;
286
- $[25] = t12;
290
+ $[26] = cta;
291
+ $[27] = t12;
287
292
  } else {
288
- t12 = $[25];
293
+ t12 = $[27];
289
294
  }
290
295
  let t13;
291
- if ($[26] !== t11 || $[27] !== t12) {
296
+ if ($[28] !== actions || $[29] !== t11 || $[30] !== t12) {
292
297
  t13 = /*#__PURE__*/_jsxs("div", {
293
298
  className: "flex items-center gap-1.5",
294
- children: [t11, t12]
299
+ children: [t11, actions, t12]
295
300
  });
296
- $[26] = t11;
297
- $[27] = t12;
298
- $[28] = t13;
301
+ $[28] = actions;
302
+ $[29] = t11;
303
+ $[30] = t12;
304
+ $[31] = t13;
299
305
  } else {
300
- t13 = $[28];
306
+ t13 = $[31];
301
307
  }
302
308
  let t14;
303
- if ($[29] !== className || $[30] !== t10 || $[31] !== t13 || $[32] !== t5 || $[33] !== t8) {
309
+ if ($[32] !== className || $[33] !== t10 || $[34] !== t13 || $[35] !== t5 || $[36] !== t8) {
304
310
  t14 = /*#__PURE__*/_jsxs(FloatingBar, {
305
311
  className: className,
306
312
  barClassName: "justify-between gap-3 md:pl-5",
307
313
  children: [t5, t8, t10, t13]
308
314
  });
309
- $[29] = className;
310
- $[30] = t10;
311
- $[31] = t13;
312
- $[32] = t5;
313
- $[33] = t8;
314
- $[34] = t14;
315
+ $[32] = className;
316
+ $[33] = t10;
317
+ $[34] = t13;
318
+ $[35] = t5;
319
+ $[36] = t8;
320
+ $[37] = t14;
315
321
  } else {
316
- t14 = $[34];
322
+ t14 = $[37];
317
323
  }
318
324
  return t14;
319
325
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vvedantb/ui",
3
- "version": "0.47.0",
3
+ "version": "0.48.0",
4
4
  "license": "MIT",
5
5
  "description": "Shared React 19 UI for web apps: one main JavaScript entry (primitives, shell pieces, app helpers including the Convex and Clerk provider, VITE env parsing and ensure-user, artifact viewers over the @vvedantb/server artifacts core, native tokens), third-party brand logos (also @vvedantb/ui/logos), motion-driven animated SVG icons (@vvedantb/ui/icons/animated), a client entry without @vvedantb/server, convex or Clerk for Chrome extensions, design-token CSS, shared Tailwind v4 CSS, a Tailwind preset and packaged Instrument Sans fonts.",
6
6
  "type": "module",
@@ -21,9 +21,22 @@ const MAX_LINKS = 4;
21
21
 
22
22
  export type SiteHeaderLink = { label: string; href: string };
23
23
 
24
- export type SiteHeaderProps = {
25
- /** Product app id for `AppWordmark`. */
26
- app: ProductAppName;
24
+ type SiteHeaderIdentity =
25
+ | {
26
+ /** Product app id for `AppWordmark`. */
27
+ app: ProductAppName;
28
+ brand?: undefined;
29
+ githubLabel?: undefined;
30
+ }
31
+ | {
32
+ app?: undefined;
33
+ /** The site's own wordmark, for a site that is not a product app. It replaces `AppWordmark`. */
34
+ brand: ReactNode;
35
+ /** `aria-label` of the GitHub button, for example "Bee on GitHub". Default "GitHub". */
36
+ githubLabel?: string;
37
+ };
38
+
39
+ export type SiteHeaderProps = SiteHeaderIdentity & {
27
40
  /** Home link `href`. Default `#home`. */
28
41
  homeHref?: string;
29
42
  /** `aria-label` of the home wordmark link. */
@@ -38,6 +51,8 @@ export type SiteHeaderProps = {
38
51
  cta: ReactNode;
39
52
  /** Optional GitHub URL. An icon button from `sm`, and the last item in the mobile menu. */
40
53
  githubUrl?: string;
54
+ /** Optional small control before the CTA, shown at every width, for example a theme toggle. */
55
+ actions?: ReactNode;
41
56
  /** Classes for the fixed `<header>` wrapper. */
42
57
  className?: string;
43
58
  };
@@ -88,9 +103,20 @@ function SiteHeaderMenu({ links, cta, githubUrl }: Pick<SiteHeaderProps, "links"
88
103
  * Marketing header for the Project V apps: a `FloatingBar` with `AppWordmark` at `SITE_HEADER_WORDMARK_SIZE`, up to
89
104
  * four links, one `cta` and an optional GitHub button. Below `md` the menu button sits on the left, the wordmark is
90
105
  * centred, and the links, the CTA and GitHub move into one dropdown menu. Plain markup with no motion, so any app can
91
- * use it.
106
+ * use it. A site that is not a product app passes `brand` in place of `app`.
92
107
  */
93
- export function SiteHeader({ app, homeHref = "#home", homeLabel, links, cta, githubUrl, className }: SiteHeaderProps) {
108
+ export function SiteHeader({
109
+ app,
110
+ brand,
111
+ githubLabel,
112
+ homeHref = "#home",
113
+ homeLabel,
114
+ links,
115
+ cta,
116
+ githubUrl,
117
+ actions,
118
+ className,
119
+ }: SiteHeaderProps) {
94
120
  const tooMany = links.length > MAX_LINKS;
95
121
  useEffect(() => {
96
122
  if (!tooMany) return;
@@ -112,7 +138,7 @@ export function SiteHeader({ app, homeHref = "#home", homeLabel, links, cta, git
112
138
  )}
113
139
  aria-label={homeLabel}
114
140
  >
115
- <AppWordmark app={app} size={SITE_HEADER_WORDMARK_SIZE} />
141
+ {app ? <AppWordmark app={app} size={SITE_HEADER_WORDMARK_SIZE} /> : brand}
116
142
  </a>
117
143
 
118
144
  <nav className="hidden items-center gap-1 md:flex" aria-label="Page">
@@ -126,11 +152,12 @@ export function SiteHeader({ app, homeHref = "#home", homeLabel, links, cta, git
126
152
  <div className="flex items-center gap-1.5">
127
153
  {githubUrl ? (
128
154
  <Button asChild variant="ghost" size="icon-sm" className="hidden rounded-full sm:inline-flex">
129
- <a href={githubUrl} target="_blank" rel="noreferrer" aria-label={`${app} on GitHub`}>
155
+ <a href={githubUrl} target="_blank" rel="noreferrer" aria-label={app ? `${app} on GitHub` : (githubLabel ?? "GitHub")}>
130
156
  <GitHubIcon size={18} />
131
157
  </a>
132
158
  </Button>
133
159
  ) : null}
160
+ {actions}
134
161
  <div className="hidden md:flex">{cta}</div>
135
162
  </div>
136
163
  </FloatingBar>