@designa8/vibedesign-linear-internal-v1-b737 0.6.0 → 0.7.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 +1 -1
- package/dist/index.cjs +1223 -1137
- package/dist/index.js +1251 -1165
- package/dist/styles.css +10 -0
- package/package.json +6 -1
- package/src/atoms/ComponentCard/ComponentCard.tsx +127 -0
- package/src/atoms/ComponentCard/index.ts +6 -0
- package/src/atoms/ComponentCard/preview.tsx +107 -0
- package/src/atoms/Icon/icons.data.ts +1 -0
- package/src/index.ts +1 -0
package/dist/styles.css
CHANGED
|
@@ -776,6 +776,9 @@
|
|
|
776
776
|
.w-1\/3 {
|
|
777
777
|
width: calc(1 / 3 * 100%);
|
|
778
778
|
}
|
|
779
|
+
.w-1\/4 {
|
|
780
|
+
width: calc(1 / 4 * 100%);
|
|
781
|
+
}
|
|
779
782
|
.w-1\/5 {
|
|
780
783
|
width: calc(1 / 5 * 100%);
|
|
781
784
|
}
|
|
@@ -797,6 +800,9 @@
|
|
|
797
800
|
.w-3\.5 {
|
|
798
801
|
width: calc(var(--spacing) * 3.5);
|
|
799
802
|
}
|
|
803
|
+
.w-3\/4 {
|
|
804
|
+
width: calc(3 / 4 * 100%);
|
|
805
|
+
}
|
|
800
806
|
.w-3\/5 {
|
|
801
807
|
width: calc(3 / 5 * 100%);
|
|
802
808
|
}
|
|
@@ -1284,6 +1290,10 @@
|
|
|
1284
1290
|
.rounded-xs {
|
|
1285
1291
|
border-radius: var(--radius-xs);
|
|
1286
1292
|
}
|
|
1293
|
+
.rounded-t-lg {
|
|
1294
|
+
border-top-left-radius: var(--radius-lg);
|
|
1295
|
+
border-top-right-radius: var(--radius-lg);
|
|
1296
|
+
}
|
|
1287
1297
|
.rounded-t-xs {
|
|
1288
1298
|
border-top-left-radius: var(--radius-xs);
|
|
1289
1299
|
border-top-right-radius: var(--radius-xs);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@designa8/vibedesign-linear-internal-v1-b737",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Complete design system \"My Project linear-internal-v1\" generated by Atoms Design.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -159,6 +159,11 @@
|
|
|
159
159
|
"kind": "Organism",
|
|
160
160
|
"description": null
|
|
161
161
|
},
|
|
162
|
+
{
|
|
163
|
+
"name": "ComponentCard",
|
|
164
|
+
"kind": "Molecule",
|
|
165
|
+
"description": null
|
|
166
|
+
},
|
|
162
167
|
{
|
|
163
168
|
"name": "DataTable",
|
|
164
169
|
"kind": "Organism",
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Badge } from "../Badge";
|
|
3
|
+
import type { BadgeTone } from "../Badge";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
import { Icon } from "../Icon";
|
|
6
|
+
import type { IconProps } from "../Icon";
|
|
7
|
+
|
|
8
|
+
export type ComponentKind = "Atom" | "Molecule" | "Organism" | "Template";
|
|
9
|
+
|
|
10
|
+
/** The badge hue encodes the atomic level of the card's component. */
|
|
11
|
+
export const KIND_BADGE_TONE: Record<ComponentKind, BadgeTone> = {
|
|
12
|
+
Atom: "info",
|
|
13
|
+
Molecule: "warning",
|
|
14
|
+
Organism: "success",
|
|
15
|
+
Template: "primary",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const KIND_ICON: Record<ComponentKind, IconProps["name"]> = {
|
|
19
|
+
Atom: "circle-dot",
|
|
20
|
+
Molecule: "component",
|
|
21
|
+
Organism: "layers",
|
|
22
|
+
Template: "layout-template",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const cn = (...parts: Array<string | false | null | undefined>) =>
|
|
26
|
+
parts.filter(Boolean).join(" ");
|
|
27
|
+
|
|
28
|
+
export interface KindBadgeProps {
|
|
29
|
+
kind: ComponentKind;
|
|
30
|
+
className?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The uppercase kind pill used in the card footer, exported for reuse. */
|
|
34
|
+
export function KindBadge({ kind, className }: KindBadgeProps) {
|
|
35
|
+
return (
|
|
36
|
+
<Badge
|
|
37
|
+
size="sm"
|
|
38
|
+
tone={KIND_BADGE_TONE[kind]}
|
|
39
|
+
className={cn("uppercase", className)}
|
|
40
|
+
>
|
|
41
|
+
{kind}
|
|
42
|
+
</Badge>
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface ComponentCardProps
|
|
47
|
+
extends Omit<React.ComponentPropsWithoutRef<"button">, "children"> {
|
|
48
|
+
/** Component name shown in the footer. */
|
|
49
|
+
name: string;
|
|
50
|
+
/** Atomic level — drives the badge tone and the default glyph tile. */
|
|
51
|
+
kind?: ComponentKind;
|
|
52
|
+
/** Meta line under the name. Defaults to "<Kind> • Generated". */
|
|
53
|
+
description?: string;
|
|
54
|
+
/** Anything rendered inside the 4:3 thumbnail (live preview, overlay…). */
|
|
55
|
+
thumbnailContent?: React.ReactNode;
|
|
56
|
+
/** Swap the thumbnail background with another token utility. */
|
|
57
|
+
thumbnailBg?: string;
|
|
58
|
+
/** Marks the card as the current selection (primary ring). */
|
|
59
|
+
selected?: boolean;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Gallery card for one design-system component in a catalog grid.
|
|
64
|
+
* The whole card is a single button: Enter / Space activate it, the footer
|
|
65
|
+
* name is the accessible label, and the selection ring sits on the surface.
|
|
66
|
+
*/
|
|
67
|
+
export const ComponentCard = React.forwardRef<
|
|
68
|
+
HTMLButtonElement,
|
|
69
|
+
ComponentCardProps
|
|
70
|
+
>(
|
|
71
|
+
(
|
|
72
|
+
{
|
|
73
|
+
name,
|
|
74
|
+
kind = "Organism",
|
|
75
|
+
description,
|
|
76
|
+
thumbnailContent,
|
|
77
|
+
thumbnailBg,
|
|
78
|
+
selected = false,
|
|
79
|
+
className,
|
|
80
|
+
type = "button",
|
|
81
|
+
...rest
|
|
82
|
+
},
|
|
83
|
+
ref,
|
|
84
|
+
) => (
|
|
85
|
+
<div
|
|
86
|
+
className={cn(
|
|
87
|
+
"group relative min-w-0 w-full rounded-lg border border-hairline-soft bg-surface shadow-card",
|
|
88
|
+
"transition duration-200 ease-out hover:border-hairline-strong hover:shadow-md",
|
|
89
|
+
selected && "border-primary ring-2 ring-primary",
|
|
90
|
+
className,
|
|
91
|
+
)}
|
|
92
|
+
>
|
|
93
|
+
<Button
|
|
94
|
+
ref={ref}
|
|
95
|
+
type={type}
|
|
96
|
+
variant="media"
|
|
97
|
+
aria-pressed={selected}
|
|
98
|
+
className="flex w-full min-w-0 flex-col items-stretch overflow-hidden rounded-lg focus-visible:ring-2 focus-visible:ring-focus-blue"
|
|
99
|
+
{...rest}
|
|
100
|
+
>
|
|
101
|
+
<span
|
|
102
|
+
className={cn(
|
|
103
|
+
"relative flex aspect-[4/3] w-full items-center justify-center overflow-hidden rounded-t-lg",
|
|
104
|
+
thumbnailBg ?? "bg-surface-soft",
|
|
105
|
+
)}
|
|
106
|
+
>
|
|
107
|
+
{thumbnailContent ?? (
|
|
108
|
+
<span className="flex size-16 items-center justify-center rounded-lg bg-primary-soft text-primary">
|
|
109
|
+
<Icon name={KIND_ICON[kind]} size={32} strokeWidth={1.75} />
|
|
110
|
+
</span>
|
|
111
|
+
)}
|
|
112
|
+
</span>
|
|
113
|
+
|
|
114
|
+
<span className="flex min-w-0 items-center justify-between gap-sm border-t border-hairline-soft bg-canvas px-md py-sm">
|
|
115
|
+
<span className="flex min-w-0 flex-col gap-xxs overflow-hidden">
|
|
116
|
+
<span className="truncate text-label text-ink">{name}</span>
|
|
117
|
+
<span className="truncate text-caption text-muted">
|
|
118
|
+
{description ?? `${kind} • Generated`}
|
|
119
|
+
</span>
|
|
120
|
+
</span>
|
|
121
|
+
<KindBadge kind={kind} />
|
|
122
|
+
</span>
|
|
123
|
+
</Button>
|
|
124
|
+
</div>
|
|
125
|
+
),
|
|
126
|
+
);
|
|
127
|
+
ComponentCard.displayName = "ComponentCard";
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ComponentCard } from "./ComponentCard";
|
|
3
|
+
import type { ComponentKind } from "./ComponentCard";
|
|
4
|
+
import { Icon } from "../Icon";
|
|
5
|
+
|
|
6
|
+
const ITEMS: Array<{
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
kind: ComponentKind;
|
|
10
|
+
description?: string;
|
|
11
|
+
}> = [
|
|
12
|
+
{ id: "button", name: "Button", kind: "Atom", description: "8 variants • 3 sizes" },
|
|
13
|
+
{ id: "formfield", name: "FormField", kind: "Molecule", description: "Label + input + hint" },
|
|
14
|
+
{ id: "datatable", name: "DataTable", kind: "Organism" },
|
|
15
|
+
{ id: "settings-template", name: "SettingsPageTemplate", kind: "Template", description: "Full-page settings layout" },
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
/** A token-driven stand-in for a live preview produced by the catalog. */
|
|
19
|
+
function MockPreview({ kind }: { kind: ComponentKind }) {
|
|
20
|
+
if (kind === "Template") {
|
|
21
|
+
return (
|
|
22
|
+
<span className="flex h-full w-full flex-col gap-xs p-sm">
|
|
23
|
+
<span className="h-3 w-full rounded-xs bg-surface-strong" />
|
|
24
|
+
<span className="flex min-h-0 flex-1 gap-xs">
|
|
25
|
+
<span className="w-1/4 rounded-xs bg-surface-strong" />
|
|
26
|
+
<span className="flex-1 rounded-xs bg-canvas" />
|
|
27
|
+
</span>
|
|
28
|
+
</span>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
if (kind === "Organism") {
|
|
32
|
+
return (
|
|
33
|
+
<span className="flex w-full max-w-[80%] flex-col gap-xs rounded-md border border-hairline-soft bg-canvas p-sm">
|
|
34
|
+
<span className="h-2 w-1/2 rounded-xs bg-surface-strong" />
|
|
35
|
+
<span className="h-2 w-full rounded-xs bg-surface-strong" />
|
|
36
|
+
<span className="h-2 w-3/4 rounded-xs bg-surface-strong" />
|
|
37
|
+
</span>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
return (
|
|
41
|
+
<span className="flex items-center gap-xs rounded-md border border-hairline-soft bg-canvas px-sm py-xs text-caption text-muted">
|
|
42
|
+
<Icon name="circle" size={12} />
|
|
43
|
+
Live preview
|
|
44
|
+
</span>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export default function ComponentCardPreview() {
|
|
49
|
+
const [selected, setSelected] = React.useState<string>("datatable");
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<div className="w-full max-w-3xl mx-auto space-y-lg p-lg">
|
|
53
|
+
<div className="space-y-xxs">
|
|
54
|
+
<p className="text-label text-ink">Component catalog</p>
|
|
55
|
+
<p className="text-caption text-muted">
|
|
56
|
+
Click a card to select it — Enter and Space select it too.
|
|
57
|
+
</p>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div className="grid grid-cols-1 gap-sm sm:grid-cols-2">
|
|
61
|
+
{ITEMS.map((item) => (
|
|
62
|
+
<ComponentCard
|
|
63
|
+
key={item.id}
|
|
64
|
+
name={item.name}
|
|
65
|
+
kind={item.kind}
|
|
66
|
+
description={item.description}
|
|
67
|
+
selected={selected === item.id}
|
|
68
|
+
onClick={() =>
|
|
69
|
+
setSelected((current) => (current === item.id ? "" : item.id))
|
|
70
|
+
}
|
|
71
|
+
thumbnailContent={
|
|
72
|
+
<span className="flex h-full w-full items-center justify-center p-md">
|
|
73
|
+
<MockPreview kind={item.kind} />
|
|
74
|
+
</span>
|
|
75
|
+
}
|
|
76
|
+
/>
|
|
77
|
+
))}
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<div className="space-y-sm">
|
|
81
|
+
<p className="text-caption text-muted">Default glyph tile and custom thumbnail background</p>
|
|
82
|
+
<div className="grid grid-cols-1 gap-sm sm:grid-cols-2">
|
|
83
|
+
<ComponentCard name="Tooltip" kind="Atom" />
|
|
84
|
+
<ComponentCard
|
|
85
|
+
name="NowPlayingTemplate"
|
|
86
|
+
kind="Template"
|
|
87
|
+
description="Custom thumbnail surface"
|
|
88
|
+
thumbnailBg="bg-primary-soft"
|
|
89
|
+
thumbnailContent={
|
|
90
|
+
<span className="flex flex-col items-center gap-xs text-primary">
|
|
91
|
+
<Icon name="layers" size={28} />
|
|
92
|
+
<span className="text-caption">Rendered preview</span>
|
|
93
|
+
</span>
|
|
94
|
+
}
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
<div className="space-y-sm">
|
|
100
|
+
<p className="text-caption text-muted">Disabled</p>
|
|
101
|
+
<div className="grid grid-cols-1 gap-sm sm:grid-cols-2">
|
|
102
|
+
<ComponentCard name="Carousel" kind="Organism" disabled />
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
);
|
|
107
|
+
}
|
|
@@ -98,6 +98,7 @@ export const ICON_REGISTRY = {
|
|
|
98
98
|
"layout-grid": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "7", height: "7", x: "3", y: "3", rx: "1" }, { tag: "rect", width: "7", height: "7", x: "14", y: "3", rx: "1" }, { tag: "rect", width: "7", height: "7", x: "14", y: "14", rx: "1" }, { tag: "rect", width: "7", height: "7", x: "3", y: "14", rx: "1" }] },
|
|
99
99
|
"smartphone": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "14", height: "20", x: "5", y: "2", rx: "2", ry: "2" }, { tag: "path", d: "M12 18h.01" }] },
|
|
100
100
|
"folder": { viewBox: "0 0 24 24", nodes: [{ tag: "path", d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }] },
|
|
101
|
+
"layout-template": { viewBox: "0 0 24 24", nodes: [{ tag: "rect", width: "18", height: "7", x: "3", y: "3", rx: "1" }, { tag: "rect", width: "9", height: "7", x: "3", y: "14", rx: "1" }, { tag: "rect", width: "5", height: "7", x: "16", y: "14", rx: "1" }] },
|
|
101
102
|
} as const;
|
|
102
103
|
|
|
103
104
|
export type IconName = keyof typeof ICON_REGISTRY;
|
package/src/index.ts
CHANGED
|
@@ -25,6 +25,7 @@ export * from "./atoms/CodePreview";
|
|
|
25
25
|
export * from "./atoms/ColorPicker";
|
|
26
26
|
export * from "./atoms/Combobox";
|
|
27
27
|
export * from "./atoms/CommentThread";
|
|
28
|
+
export * from "./atoms/ComponentCard";
|
|
28
29
|
export * from "./atoms/DataTable";
|
|
29
30
|
export * from "./atoms/DataTableDesktop";
|
|
30
31
|
export * from "./atoms/DataTableMobile";
|