@vamos-ui/react 0.3.0 → 0.4.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/dist/blocks/block-image.js +1 -1
- package/dist/blocks/block-link.js +1 -1
- package/dist/blocks/index.d.ts +2 -2
- package/dist/blocks/index.js +2 -2
- package/dist/blocks/site/_kit-1.js +1 -1
- package/dist/blocks/site/announcement-bar.js +1 -1
- package/dist/blocks/site/article-layout.d.ts +1 -0
- package/dist/blocks/site/article-layout.js +2 -1
- package/dist/blocks/site/blog-list.d.ts +1 -0
- package/dist/blocks/site/blog-list.js +3 -2
- package/dist/blocks/site/contact-dock.js +3 -1
- package/dist/blocks/site/contact-form.js +1 -1
- package/dist/blocks/site/cta.d.ts +2 -2
- package/dist/blocks/site/cta.js +6 -4
- package/dist/blocks/site/feature-grid.d.ts +1 -0
- package/dist/blocks/site/feature-grid.js +5 -4
- package/dist/blocks/site/footer.d.ts +1 -1
- package/dist/blocks/site/footer.js +8 -7
- package/dist/blocks/site/gallery-section.d.ts +6 -1
- package/dist/blocks/site/gallery-section.js +5 -4
- package/dist/blocks/site/hero.d.ts +3 -2
- package/dist/blocks/site/hero.js +7 -5
- package/dist/blocks/site/logo-strip.d.ts +1 -0
- package/dist/blocks/site/logo-strip.js +1 -1
- package/dist/blocks/site/map-hours.d.ts +2 -2
- package/dist/blocks/site/map-hours.js +4 -2
- package/dist/blocks/site/media-text.d.ts +4 -1
- package/dist/blocks/site/media-text.js +4 -3
- package/dist/blocks/site/menu-list.d.ts +7 -3
- package/dist/blocks/site/menu-list.js +34 -7
- package/dist/blocks/site/navbar.d.ts +1 -0
- package/dist/blocks/site/navbar.js +6 -5
- package/dist/blocks/site/not-found.js +2 -1
- package/dist/blocks/site/page-intro.d.ts +1 -0
- package/dist/blocks/site/page-intro.js +2 -1
- package/dist/blocks/site/process.d.ts +1 -0
- package/dist/blocks/site/process.js +2 -1
- package/dist/blocks/site/registry-1.d.ts +1 -1
- package/dist/blocks/site/registry-2.d.ts +5 -0
- package/dist/blocks/site/registry-2.js +2 -2
- package/dist/blocks/site/rich-text-section.js +2 -1
- package/dist/blocks/site/shared/heading-lines.d.ts +9 -0
- package/dist/blocks/site/shared/heading-lines.js +32 -0
- package/dist/blocks/site/shared/image-sizes.d.ts +25 -0
- package/dist/blocks/site/shared/image-sizes.js +37 -0
- package/dist/blocks/site/shared/island-keys.d.ts +1 -1
- package/dist/blocks/site/shared/island-keys.js +1 -1
- package/dist/blocks/site/shared/labels-2.d.ts +9 -1
- package/dist/blocks/site/shared/labels-2.js +24 -6
- package/dist/blocks/site/shared/open-now.d.ts +1 -1
- package/dist/blocks/site/shared/open-now.js +1 -1
- package/dist/blocks/site/shared/opening-hours.d.ts +18 -2
- package/dist/blocks/site/shared/opening-hours.js +36 -7
- package/dist/blocks/site/shared/tap.d.ts +9 -0
- package/dist/blocks/site/shared/tap.js +16 -0
- package/dist/blocks/site/team.d.ts +1 -1
- package/dist/blocks/site/team.js +4 -3
- package/dist/blocks/site/testimonials.d.ts +2 -2
- package/dist/blocks/site/testimonials.js +3 -3
- package/dist/charts/bar-chart.js +1 -1
- package/dist/charts/chart-shell.d.ts +9 -2
- package/dist/charts/chart-shell.js +10 -4
- package/dist/charts/chart.js +1 -1
- package/dist/charts/combo-chart.js +5 -7
- package/dist/charts/utils.d.ts +10 -0
- package/dist/charts/utils.js +46 -0
- package/dist/components/activity-timeline.js +5 -5
- package/dist/components/aspect-ratio.d.ts +26 -0
- package/dist/components/aspect-ratio.js +42 -0
- package/dist/components/carousel.d.ts +12 -3
- package/dist/components/carousel.js +8 -5
- package/dist/components/collapsible.d.ts +36 -0
- package/dist/components/collapsible.js +37 -0
- package/dist/components/image.d.ts +18 -2
- package/dist/components/image.js +12 -5
- package/dist/components/menubar.d.ts +96 -0
- package/dist/components/menubar.js +123 -0
- package/dist/components/placeholder-art.d.ts +51 -0
- package/dist/components/placeholder-art.js +82 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/lib/value-format.js +1 -1
- package/dist/locales/ar.d.ts +2087 -0
- package/dist/locales/ar.js +2088 -0
- package/dist/locales/de.d.ts +2087 -0
- package/dist/locales/de.js +2088 -0
- package/dist/locales/en.d.ts +1 -0
- package/dist/locales/en.js +1 -0
- package/dist/locales/es.d.ts +2087 -0
- package/dist/locales/es.js +2087 -0
- package/dist/locales/fr.d.ts +2087 -0
- package/dist/locales/fr.js +2088 -0
- package/dist/locales/tr.d.ts +1 -0
- package/dist/locales/tr.js +1 -0
- package/dist/media/media-library.js +1 -1
- package/dist/motion/text-reveal.d.ts +3 -1
- package/dist/motion/text-reveal.js +5 -3
- package/dist/render/block-renderer.js +1 -1
- package/dist/styles/blocks.css +18 -9
- package/dist/styles/editors.css +2 -1
- package/dist/styles/media.css +31 -5
- package/dist/styles.css +39 -9
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type PlaceholderArtPattern = "grid" | "dots" | "lines" | "rings" | "glow";
|
|
3
|
+
export declare const PLACEHOLDER_ART_PATTERNS: PlaceholderArtPattern[];
|
|
4
|
+
/** FNV-1a 32-bit — stable across server and client, so SSR and hydration agree. */
|
|
5
|
+
export declare function hashSeed(seed: string): number;
|
|
6
|
+
export interface PlaceholderArtRecipe {
|
|
7
|
+
pattern: PlaceholderArtPattern;
|
|
8
|
+
/** Chart palette slot (1–6) used as the tint. */
|
|
9
|
+
hue: number;
|
|
10
|
+
/** Second slot for the glow. */
|
|
11
|
+
hue2: number;
|
|
12
|
+
/** Line angle in degrees (lines). */
|
|
13
|
+
angle: number;
|
|
14
|
+
/** Pattern cell in px. */
|
|
15
|
+
cell: number;
|
|
16
|
+
/** Focal point in % (rings, glow, highlight). */
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
}
|
|
20
|
+
/** The same seed always gives the same recipe. `pattern` overrides the seeded choice. */
|
|
21
|
+
export declare function placeholderArtRecipe(seed: string, pattern?: PlaceholderArtPattern | "auto"): PlaceholderArtRecipe;
|
|
22
|
+
/** CSS background for a recipe. Token colours only, mixed per theme by the browser. */
|
|
23
|
+
export declare function placeholderArtStyle(recipe: PlaceholderArtRecipe, strength?: "subtle" | "bold"): React.CSSProperties;
|
|
24
|
+
export interface PlaceholderArtProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "children"> {
|
|
25
|
+
/** Any stable string (a slug, a name, a record id). Same seed → same art, on server and client. */
|
|
26
|
+
seed?: string;
|
|
27
|
+
/** Force a pattern. Default `"auto"` (picked from the seed). */
|
|
28
|
+
pattern?: PlaceholderArtPattern | "auto";
|
|
29
|
+
/** Centre icon. Default: an image glyph. `false` hides it. */
|
|
30
|
+
icon?: React.ReactNode | false;
|
|
31
|
+
/**
|
|
32
|
+
* What the missing image would show. Set → `role="img"` with this as its name; empty → decorative
|
|
33
|
+
* (`aria-hidden`).
|
|
34
|
+
*/
|
|
35
|
+
label?: string;
|
|
36
|
+
/** Print the label (or a custom node) in the bottom corner, e.g. "Photo · Harbour terrace". */
|
|
37
|
+
caption?: boolean | React.ReactNode;
|
|
38
|
+
/** `bold` doubles the tint — for large hero areas on plain pages. Default `subtle`. */
|
|
39
|
+
strength?: "subtle" | "bold";
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A tasteful, deterministic stand-in for a missing image: a token-tinted pattern (grid, dots, lines,
|
|
43
|
+
* rings or glow) chosen from a seed, an optional glyph and caption. No assets, no network, no
|
|
44
|
+
* dependencies; follows theme and accent. Fills its parent — give the parent a size, or use it inside
|
|
45
|
+
* `AspectRatio` / `Image`.
|
|
46
|
+
*
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <AspectRatio ratio="4/3"><PlaceholderArt seed="harbour-terrace" label="Harbour terrace at dusk" /></AspectRatio>
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare const PlaceholderArt: React.ForwardRefExoticComponent<PlaceholderArtProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Image as ImageIcon } from "lucide-react";
|
|
4
|
+
import { cn } from "../lib/cn.js";
|
|
5
|
+
export const PLACEHOLDER_ART_PATTERNS = ["grid", "dots", "lines", "rings", "glow"];
|
|
6
|
+
/** FNV-1a 32-bit — stable across server and client, so SSR and hydration agree. */
|
|
7
|
+
export function hashSeed(seed) {
|
|
8
|
+
let h = 0x811c9dc5;
|
|
9
|
+
for (let i = 0; i < seed.length; i++) {
|
|
10
|
+
h ^= seed.charCodeAt(i);
|
|
11
|
+
h = Math.imul(h, 0x01000193);
|
|
12
|
+
}
|
|
13
|
+
return h >>> 0;
|
|
14
|
+
}
|
|
15
|
+
/** The same seed always gives the same recipe. `pattern` overrides the seeded choice. */
|
|
16
|
+
export function placeholderArtRecipe(seed, pattern) {
|
|
17
|
+
const h = hashSeed(seed || "vamos");
|
|
18
|
+
const pick = (shift, n) => (h >>> shift) % n;
|
|
19
|
+
const hue = pick(0, 6) + 1;
|
|
20
|
+
return {
|
|
21
|
+
pattern: pattern && pattern !== "auto" ? pattern : PLACEHOLDER_ART_PATTERNS[pick(3, PLACEHOLDER_ART_PATTERNS.length)],
|
|
22
|
+
hue,
|
|
23
|
+
hue2: ((hue + pick(6, 4)) % 6) + 1,
|
|
24
|
+
angle: [30, 45, 60, 120, 135, 150][pick(9, 6)],
|
|
25
|
+
cell: [14, 18, 22, 26][pick(12, 4)],
|
|
26
|
+
x: 15 + pick(14, 70),
|
|
27
|
+
y: 10 + pick(21, 60),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** CSS background for a recipe. Token colours only, mixed per theme by the browser. */
|
|
31
|
+
export function placeholderArtStyle(recipe, strength = "subtle") {
|
|
32
|
+
const { pattern, hue, hue2, angle, cell, x, y } = recipe;
|
|
33
|
+
const tint = `var(--chart-${hue})`;
|
|
34
|
+
const k = strength === "bold" ? 1.6 : 1;
|
|
35
|
+
const ink = `color-mix(in oklab, ${tint} ${Math.round(30 * k)}%, transparent)`;
|
|
36
|
+
const base = `color-mix(in oklab, ${tint} ${Math.round(9 * k)}%, var(--surface-2))`;
|
|
37
|
+
const highlight = `radial-gradient(120% 90% at ${x}% ${y}%, color-mix(in oklab, ${tint} ${Math.round(16 * k)}%, transparent), transparent 65%)`;
|
|
38
|
+
let layers;
|
|
39
|
+
let sizes;
|
|
40
|
+
switch (pattern) {
|
|
41
|
+
case "grid":
|
|
42
|
+
layers = [highlight, `linear-gradient(${ink} 1px, transparent 1px)`, `linear-gradient(90deg, ${ink} 1px, transparent 1px)`];
|
|
43
|
+
sizes = ["100% 100%", `${cell}px ${cell}px`, `${cell}px ${cell}px`];
|
|
44
|
+
break;
|
|
45
|
+
case "dots":
|
|
46
|
+
layers = [highlight, `radial-gradient(circle, ${ink} 1.1px, transparent 1.6px)`];
|
|
47
|
+
sizes = ["100% 100%", `${cell}px ${cell}px`];
|
|
48
|
+
break;
|
|
49
|
+
case "lines":
|
|
50
|
+
layers = [highlight, `repeating-linear-gradient(${angle}deg, ${ink} 0 1px, transparent 1px ${Math.round(cell / 2)}px)`];
|
|
51
|
+
sizes = ["100% 100%", "100% 100%"];
|
|
52
|
+
break;
|
|
53
|
+
case "rings":
|
|
54
|
+
layers = [highlight, `repeating-radial-gradient(circle at ${x}% ${y}%, transparent 0 ${cell - 1}px, ${ink} ${cell - 1}px ${cell}px)`];
|
|
55
|
+
sizes = ["100% 100%", "100% 100%"];
|
|
56
|
+
break;
|
|
57
|
+
case "glow":
|
|
58
|
+
default:
|
|
59
|
+
layers = [
|
|
60
|
+
`radial-gradient(70% 80% at ${x}% ${y}%, color-mix(in oklab, ${tint} ${Math.round(34 * k)}%, transparent), transparent 70%)`,
|
|
61
|
+
`radial-gradient(60% 70% at ${100 - x}% ${100 - y}%, color-mix(in oklab, var(--chart-${hue2}) ${Math.round(26 * k)}%, transparent), transparent 70%)`,
|
|
62
|
+
];
|
|
63
|
+
sizes = ["100% 100%", "100% 100%"];
|
|
64
|
+
}
|
|
65
|
+
return { backgroundColor: base, backgroundImage: layers.join(", "), backgroundSize: sizes.join(", "), backgroundPosition: "center" };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* A tasteful, deterministic stand-in for a missing image: a token-tinted pattern (grid, dots, lines,
|
|
69
|
+
* rings or glow) chosen from a seed, an optional glyph and caption. No assets, no network, no
|
|
70
|
+
* dependencies; follows theme and accent. Fills its parent — give the parent a size, or use it inside
|
|
71
|
+
* `AspectRatio` / `Image`.
|
|
72
|
+
*
|
|
73
|
+
* ```tsx
|
|
74
|
+
* <AspectRatio ratio="4/3"><PlaceholderArt seed="harbour-terrace" label="Harbour terrace at dusk" /></AspectRatio>
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export const PlaceholderArt = React.forwardRef(function PlaceholderArt({ seed, pattern = "auto", icon, label, caption, strength = "subtle", className, style, ...props }, ref) {
|
|
78
|
+
const recipe = placeholderArtRecipe(seed ?? label ?? "", pattern);
|
|
79
|
+
const a11y = label ? { role: "img", "aria-label": label } : { "aria-hidden": true };
|
|
80
|
+
const captionNode = caption === true ? label : caption || null;
|
|
81
|
+
return (_jsxs("div", { ref: ref, "data-slot": "placeholder-art", "data-pattern": recipe.pattern, ...a11y, className: cn("relative flex size-full min-h-16 items-center justify-center overflow-hidden text-fg-subtle", className), style: { ...placeholderArtStyle(recipe, strength), ...style }, ...props, children: [icon !== false ? (_jsx("span", { "aria-hidden": true, "data-slot": "placeholder-art-icon", className: "inline-flex size-10 items-center justify-center rounded-full border border-line bg-[color-mix(in_oklab,var(--surface)_72%,transparent)] [&_svg]:size-[18px]", children: icon ?? _jsx(ImageIcon, { strokeWidth: 1.5 }) })) : null, captionNode ? (_jsx("span", { "aria-hidden": true, "data-slot": "placeholder-art-caption", className: "absolute start-3 bottom-2.5 max-w-[calc(100%-1.5rem)] truncate font-mono text-[10.5px] tracking-[0.06em] text-fg-muted uppercase", children: captionNode })) : null] }));
|
|
82
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export * from "./components/address-field.js";
|
|
|
5
5
|
export * from "./components/alert-dialog.js";
|
|
6
6
|
export * from "./components/alert.js";
|
|
7
7
|
export * from "./components/app-shell.js";
|
|
8
|
+
export * from "./components/aspect-ratio.js";
|
|
8
9
|
export * from "./components/attachment-list.js";
|
|
9
10
|
export * from "./components/audit-log.js";
|
|
10
11
|
export * from "./components/avatar.js";
|
|
@@ -17,6 +18,7 @@ export * from "./components/calendar.js";
|
|
|
17
18
|
export * from "./components/card.js";
|
|
18
19
|
export * from "./components/carousel.js";
|
|
19
20
|
export * from "./components/checkbox.js";
|
|
21
|
+
export * from "./components/collapsible.js";
|
|
20
22
|
export * from "./components/color-picker.js";
|
|
21
23
|
export * from "./components/combobox.js";
|
|
22
24
|
export * from "./components/command.js";
|
|
@@ -43,6 +45,7 @@ export * from "./components/input.js";
|
|
|
43
45
|
export * from "./components/item.js";
|
|
44
46
|
export * from "./components/kbd.js";
|
|
45
47
|
export * from "./components/list-layout.js";
|
|
48
|
+
export * from "./components/menubar.js";
|
|
46
49
|
export * from "./components/native-select.js";
|
|
47
50
|
export * from "./components/navigation-menu.js";
|
|
48
51
|
export * from "./components/notification-center.js";
|
|
@@ -50,6 +53,7 @@ export * from "./components/page-header.js";
|
|
|
50
53
|
export * from "./components/pagination.js";
|
|
51
54
|
export * from "./components/phone-input.js";
|
|
52
55
|
export * from "./components/pin-map.js";
|
|
56
|
+
export * from "./components/placeholder-art.js";
|
|
53
57
|
export * from "./components/popover.js";
|
|
54
58
|
export * from "./components/progress.js";
|
|
55
59
|
export * from "./components/qr-code.js";
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./components/address-field.js";
|
|
|
6
6
|
export * from "./components/alert-dialog.js";
|
|
7
7
|
export * from "./components/alert.js";
|
|
8
8
|
export * from "./components/app-shell.js";
|
|
9
|
+
export * from "./components/aspect-ratio.js";
|
|
9
10
|
export * from "./components/attachment-list.js";
|
|
10
11
|
export * from "./components/audit-log.js";
|
|
11
12
|
export * from "./components/avatar.js";
|
|
@@ -18,6 +19,7 @@ export * from "./components/calendar.js";
|
|
|
18
19
|
export * from "./components/card.js";
|
|
19
20
|
export * from "./components/carousel.js";
|
|
20
21
|
export * from "./components/checkbox.js";
|
|
22
|
+
export * from "./components/collapsible.js";
|
|
21
23
|
export * from "./components/color-picker.js";
|
|
22
24
|
export * from "./components/combobox.js";
|
|
23
25
|
export * from "./components/command.js";
|
|
@@ -44,6 +46,7 @@ export * from "./components/input.js";
|
|
|
44
46
|
export * from "./components/item.js";
|
|
45
47
|
export * from "./components/kbd.js";
|
|
46
48
|
export * from "./components/list-layout.js";
|
|
49
|
+
export * from "./components/menubar.js";
|
|
47
50
|
export * from "./components/native-select.js";
|
|
48
51
|
export * from "./components/navigation-menu.js";
|
|
49
52
|
export * from "./components/notification-center.js";
|
|
@@ -51,6 +54,7 @@ export * from "./components/page-header.js";
|
|
|
51
54
|
export * from "./components/pagination.js";
|
|
52
55
|
export * from "./components/phone-input.js";
|
|
53
56
|
export * from "./components/pin-map.js";
|
|
57
|
+
export * from "./components/placeholder-art.js";
|
|
54
58
|
export * from "./components/popover.js";
|
|
55
59
|
export * from "./components/progress.js";
|
|
56
60
|
export * from "./components/qr-code.js";
|
package/dist/lib/value-format.js
CHANGED
|
@@ -25,7 +25,7 @@ export function formatValue(f, value, spec = "number", extra) {
|
|
|
25
25
|
case "compact":
|
|
26
26
|
return f.compact(n, opts);
|
|
27
27
|
case "compact-currency":
|
|
28
|
-
return f.currency(n, currency ?? f.currencyCode, { notation: "compact", maximumFractionDigits: 1, ...opts });
|
|
28
|
+
return f.currency(n, currency ?? f.currencyCode, { notation: "compact", minimumFractionDigits: 0, maximumFractionDigits: 1, ...opts });
|
|
29
29
|
case "percent":
|
|
30
30
|
return f.percent(n, opts);
|
|
31
31
|
case "duration":
|