@meetreeve/ui 0.19.0 → 0.20.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 +2 -0
- package/dist/index.d.mts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +74 -1
- package/dist/index.mjs +74 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -100,6 +100,8 @@ import { ResponsiveHeader } from "@meetreeve/ui";
|
|
|
100
100
|
/>;
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
+
Pass `wordmark` (and optionally `wordmarkDark`) on `brand` when the brand has a real wordmark image: the header shows it in place of the glyph and text name at md and up, and below md its `favicon` bare, or the glyph when there is none (DEV-16425).
|
|
104
|
+
|
|
103
105
|
Search is the primary slot — always inline, floored at a minimum width from `@meetreeve/ui/tokens`. Under width pressure everything ELSE collapses first: the wordmark drops to glyph-only, secondary controls fold into a hamburger disclosure below `md`.
|
|
104
106
|
|
|
105
107
|
### CSS container-query collapse (DEV-4260)
|
package/dist/index.d.mts
CHANGED
|
@@ -22,6 +22,16 @@ interface Brand {
|
|
|
22
22
|
favicon?: string | null;
|
|
23
23
|
/** Wider brand logo URL (second cascade step, rendered `object-contain`). */
|
|
24
24
|
logo?: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Full wordmark image URL (DEV-16425). When set, `ResponsiveHeader` shows it
|
|
27
|
+
* in place of the glyph + text lockup at md and up; below md it shows
|
|
28
|
+
* `favicon` bare (no contrast tile), or the glyph when there is no favicon.
|
|
29
|
+
* Supply a tightly cropped image — it renders at the text wordmark's 20px
|
|
30
|
+
* line height.
|
|
31
|
+
*/
|
|
32
|
+
wordmark?: string | null;
|
|
33
|
+
/** Wordmark for dark backgrounds, shown under the `dark` variant. Falls back to `wordmark`. */
|
|
34
|
+
wordmarkDark?: string | null;
|
|
25
35
|
/** Override the deterministic monogram letter colour. */
|
|
26
36
|
color?: string | null;
|
|
27
37
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,16 @@ interface Brand {
|
|
|
22
22
|
favicon?: string | null;
|
|
23
23
|
/** Wider brand logo URL (second cascade step, rendered `object-contain`). */
|
|
24
24
|
logo?: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Full wordmark image URL (DEV-16425). When set, `ResponsiveHeader` shows it
|
|
27
|
+
* in place of the glyph + text lockup at md and up; below md it shows
|
|
28
|
+
* `favicon` bare (no contrast tile), or the glyph when there is no favicon.
|
|
29
|
+
* Supply a tightly cropped image — it renders at the text wordmark's 20px
|
|
30
|
+
* line height.
|
|
31
|
+
*/
|
|
32
|
+
wordmark?: string | null;
|
|
33
|
+
/** Wordmark for dark backgrounds, shown under the `dark` variant. Falls back to `wordmark`. */
|
|
34
|
+
wordmarkDark?: string | null;
|
|
25
35
|
/** Override the deterministic monogram letter colour. */
|
|
26
36
|
color?: string | null;
|
|
27
37
|
/**
|
package/dist/index.js
CHANGED
|
@@ -345,7 +345,80 @@ function ResponsiveHeader({
|
|
|
345
345
|
};
|
|
346
346
|
}, [open]);
|
|
347
347
|
const hasSecondary = Boolean(nav && nav.length > 0 || auth || themeToggle);
|
|
348
|
-
const
|
|
348
|
+
const [failed, setFailed] = (0, import_react3.useState)(() => /* @__PURE__ */ new Set());
|
|
349
|
+
const onImageError = (src) => () => setFailed((prev) => new Set(prev).add(src));
|
|
350
|
+
const { wordmark, wordmarkDark, favicon } = brand;
|
|
351
|
+
const lightOk = !!wordmark && !failed.has(wordmark);
|
|
352
|
+
const darkOk = !!wordmarkDark && !failed.has(wordmarkDark);
|
|
353
|
+
const glyphBrand = favicon && failed.has(favicon) ? { ...brand, favicon: null } : brand;
|
|
354
|
+
const brandLockup = wordmark ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { "data-testid": "header-lockup", className: "flex items-center", children: [
|
|
355
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "flex @min-[768px]:hidden", children: favicon && !failed.has(favicon) ? (
|
|
356
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
357
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
358
|
+
"img",
|
|
359
|
+
{
|
|
360
|
+
src: favicon,
|
|
361
|
+
alt: brand.name,
|
|
362
|
+
width: 28,
|
|
363
|
+
height: 28,
|
|
364
|
+
"data-testid": "header-mark-image",
|
|
365
|
+
onError: onImageError(favicon),
|
|
366
|
+
className: "h-7 w-7 object-contain"
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BrandGlyph, { brand: glyphBrand, size: "lg" }) }),
|
|
370
|
+
lightOk ? (
|
|
371
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
372
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
373
|
+
"img",
|
|
374
|
+
{
|
|
375
|
+
src: wordmark,
|
|
376
|
+
alt: brand.name,
|
|
377
|
+
"data-testid": "header-wordmark-image",
|
|
378
|
+
onError: onImageError(wordmark),
|
|
379
|
+
className: cn(
|
|
380
|
+
"hidden h-5 w-auto object-contain @min-[768px]:block",
|
|
381
|
+
darkOk && "@min-[768px]:dark:hidden"
|
|
382
|
+
),
|
|
383
|
+
style: { maxWidth: MIN_SIZES.wordmarkMaxWidth }
|
|
384
|
+
}
|
|
385
|
+
)
|
|
386
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
|
|
387
|
+
"span",
|
|
388
|
+
{
|
|
389
|
+
"data-testid": "header-wordmark-fallback",
|
|
390
|
+
className: cn(
|
|
391
|
+
"hidden @min-[768px]:flex items-baseline",
|
|
392
|
+
LOCKUP_GAP,
|
|
393
|
+
darkOk && "@min-[768px]:dark:hidden"
|
|
394
|
+
),
|
|
395
|
+
children: [
|
|
396
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BrandGlyph, { brand: glyphBrand, size: "lg" }),
|
|
397
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
398
|
+
"span",
|
|
399
|
+
{
|
|
400
|
+
"data-testid": "header-wordmark",
|
|
401
|
+
className: cn("truncate text-foreground", WORDMARK_TEXT_LG, WORDMARK_WEIGHT_CLASS),
|
|
402
|
+
style: { maxWidth: MIN_SIZES.wordmarkMaxWidth },
|
|
403
|
+
children: brand.name
|
|
404
|
+
}
|
|
405
|
+
)
|
|
406
|
+
]
|
|
407
|
+
}
|
|
408
|
+
),
|
|
409
|
+
darkOk && // eslint-disable-next-line @next/next/no-img-element
|
|
410
|
+
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
411
|
+
"img",
|
|
412
|
+
{
|
|
413
|
+
src: wordmarkDark,
|
|
414
|
+
alt: brand.name,
|
|
415
|
+
"data-testid": "header-wordmark-image-dark",
|
|
416
|
+
onError: onImageError(wordmarkDark),
|
|
417
|
+
className: "hidden h-5 w-auto object-contain @min-[768px]:dark:block",
|
|
418
|
+
style: { maxWidth: MIN_SIZES.wordmarkMaxWidth }
|
|
419
|
+
}
|
|
420
|
+
)
|
|
421
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { "data-testid": "header-lockup", className: cn(LOCKUP_ROW, LOCKUP_GAP), children: [
|
|
349
422
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(BrandGlyph, { brand, size: "lg" }),
|
|
350
423
|
/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
351
424
|
"span",
|
package/dist/index.mjs
CHANGED
|
@@ -284,7 +284,80 @@ function ResponsiveHeader({
|
|
|
284
284
|
};
|
|
285
285
|
}, [open]);
|
|
286
286
|
const hasSecondary = Boolean(nav && nav.length > 0 || auth || themeToggle);
|
|
287
|
-
const
|
|
287
|
+
const [failed, setFailed] = useState3(() => /* @__PURE__ */ new Set());
|
|
288
|
+
const onImageError = (src) => () => setFailed((prev) => new Set(prev).add(src));
|
|
289
|
+
const { wordmark, wordmarkDark, favicon } = brand;
|
|
290
|
+
const lightOk = !!wordmark && !failed.has(wordmark);
|
|
291
|
+
const darkOk = !!wordmarkDark && !failed.has(wordmarkDark);
|
|
292
|
+
const glyphBrand = favicon && failed.has(favicon) ? { ...brand, favicon: null } : brand;
|
|
293
|
+
const brandLockup = wordmark ? /* @__PURE__ */ jsxs2("span", { "data-testid": "header-lockup", className: "flex items-center", children: [
|
|
294
|
+
/* @__PURE__ */ jsx2("span", { className: "flex @min-[768px]:hidden", children: favicon && !failed.has(favicon) ? (
|
|
295
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
296
|
+
/* @__PURE__ */ jsx2(
|
|
297
|
+
"img",
|
|
298
|
+
{
|
|
299
|
+
src: favicon,
|
|
300
|
+
alt: brand.name,
|
|
301
|
+
width: 28,
|
|
302
|
+
height: 28,
|
|
303
|
+
"data-testid": "header-mark-image",
|
|
304
|
+
onError: onImageError(favicon),
|
|
305
|
+
className: "h-7 w-7 object-contain"
|
|
306
|
+
}
|
|
307
|
+
)
|
|
308
|
+
) : /* @__PURE__ */ jsx2(BrandGlyph, { brand: glyphBrand, size: "lg" }) }),
|
|
309
|
+
lightOk ? (
|
|
310
|
+
// eslint-disable-next-line @next/next/no-img-element
|
|
311
|
+
/* @__PURE__ */ jsx2(
|
|
312
|
+
"img",
|
|
313
|
+
{
|
|
314
|
+
src: wordmark,
|
|
315
|
+
alt: brand.name,
|
|
316
|
+
"data-testid": "header-wordmark-image",
|
|
317
|
+
onError: onImageError(wordmark),
|
|
318
|
+
className: cn(
|
|
319
|
+
"hidden h-5 w-auto object-contain @min-[768px]:block",
|
|
320
|
+
darkOk && "@min-[768px]:dark:hidden"
|
|
321
|
+
),
|
|
322
|
+
style: { maxWidth: MIN_SIZES.wordmarkMaxWidth }
|
|
323
|
+
}
|
|
324
|
+
)
|
|
325
|
+
) : /* @__PURE__ */ jsxs2(
|
|
326
|
+
"span",
|
|
327
|
+
{
|
|
328
|
+
"data-testid": "header-wordmark-fallback",
|
|
329
|
+
className: cn(
|
|
330
|
+
"hidden @min-[768px]:flex items-baseline",
|
|
331
|
+
LOCKUP_GAP,
|
|
332
|
+
darkOk && "@min-[768px]:dark:hidden"
|
|
333
|
+
),
|
|
334
|
+
children: [
|
|
335
|
+
/* @__PURE__ */ jsx2(BrandGlyph, { brand: glyphBrand, size: "lg" }),
|
|
336
|
+
/* @__PURE__ */ jsx2(
|
|
337
|
+
"span",
|
|
338
|
+
{
|
|
339
|
+
"data-testid": "header-wordmark",
|
|
340
|
+
className: cn("truncate text-foreground", WORDMARK_TEXT_LG, WORDMARK_WEIGHT_CLASS),
|
|
341
|
+
style: { maxWidth: MIN_SIZES.wordmarkMaxWidth },
|
|
342
|
+
children: brand.name
|
|
343
|
+
}
|
|
344
|
+
)
|
|
345
|
+
]
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
darkOk && // eslint-disable-next-line @next/next/no-img-element
|
|
349
|
+
/* @__PURE__ */ jsx2(
|
|
350
|
+
"img",
|
|
351
|
+
{
|
|
352
|
+
src: wordmarkDark,
|
|
353
|
+
alt: brand.name,
|
|
354
|
+
"data-testid": "header-wordmark-image-dark",
|
|
355
|
+
onError: onImageError(wordmarkDark),
|
|
356
|
+
className: "hidden h-5 w-auto object-contain @min-[768px]:dark:block",
|
|
357
|
+
style: { maxWidth: MIN_SIZES.wordmarkMaxWidth }
|
|
358
|
+
}
|
|
359
|
+
)
|
|
360
|
+
] }) : /* @__PURE__ */ jsxs2("span", { "data-testid": "header-lockup", className: cn(LOCKUP_ROW, LOCKUP_GAP), children: [
|
|
288
361
|
/* @__PURE__ */ jsx2(BrandGlyph, { brand, size: "lg" }),
|
|
289
362
|
/* @__PURE__ */ jsx2(
|
|
290
363
|
"span",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@meetreeve/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "Shared brand-adaptive UI primitives for MindFortress frontends — min-size tokens, a favicon→logo→monogram BrandGlyph, a responsive header that keeps the search bar usable on mobile, AppSidebar's viewport-driven auto-collapse ladder, and the StageRail flow-of-cards primitives, and the tenant SiteFooter.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"main": "./dist/index.js",
|