@designa8/vibedesign-linear-internal-v1-b737 0.2.0 → 0.3.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 +1584 -1490
- package/dist/index.js +1613 -1519
- package/dist/styles.css +26 -0
- package/package.json +6 -1
- package/src/atoms/AttachmentChip/AttachmentChip.tsx +126 -0
- package/src/atoms/AttachmentChip/index.ts +2 -0
- package/src/atoms/AttachmentChip/preview.tsx +144 -0
- package/src/index.ts +1 -0
package/dist/styles.css
CHANGED
|
@@ -100,6 +100,7 @@
|
|
|
100
100
|
--text-overline: 11px;
|
|
101
101
|
--text-overline--font-weight: 500;
|
|
102
102
|
--text-overline--line-height: 1.3;
|
|
103
|
+
--tracking-overline: 1.2px;
|
|
103
104
|
--text-overline--letter-spacing: 1.2px;
|
|
104
105
|
--text-label: 13px;
|
|
105
106
|
--text-label--font-weight: 500;
|
|
@@ -612,6 +613,10 @@
|
|
|
612
613
|
width: calc(var(--spacing) * 16);
|
|
613
614
|
height: calc(var(--spacing) * 16);
|
|
614
615
|
}
|
|
616
|
+
.size-full {
|
|
617
|
+
width: 100%;
|
|
618
|
+
height: 100%;
|
|
619
|
+
}
|
|
615
620
|
.h-1 {
|
|
616
621
|
height: var(--spacing);
|
|
617
622
|
}
|
|
@@ -843,6 +848,9 @@
|
|
|
843
848
|
.max-w-5xl {
|
|
844
849
|
max-width: var(--container-5xl);
|
|
845
850
|
}
|
|
851
|
+
.max-w-40 {
|
|
852
|
+
max-width: calc(var(--spacing) * 40);
|
|
853
|
+
}
|
|
846
854
|
.max-w-48 {
|
|
847
855
|
max-width: calc(var(--spacing) * 48);
|
|
848
856
|
}
|
|
@@ -852,6 +860,9 @@
|
|
|
852
860
|
.max-w-md {
|
|
853
861
|
max-width: var(--spacing-md);
|
|
854
862
|
}
|
|
863
|
+
.max-w-prose {
|
|
864
|
+
max-width: 65ch;
|
|
865
|
+
}
|
|
855
866
|
.max-w-sm {
|
|
856
867
|
max-width: var(--spacing-sm);
|
|
857
868
|
}
|
|
@@ -1594,6 +1605,9 @@
|
|
|
1594
1605
|
.pr-xs {
|
|
1595
1606
|
padding-right: var(--spacing-xs);
|
|
1596
1607
|
}
|
|
1608
|
+
.pr-xxs {
|
|
1609
|
+
padding-right: var(--spacing-xxs);
|
|
1610
|
+
}
|
|
1597
1611
|
.pb-base {
|
|
1598
1612
|
padding-bottom: var(--spacing-base);
|
|
1599
1613
|
}
|
|
@@ -1630,6 +1644,9 @@
|
|
|
1630
1644
|
.pl-xs {
|
|
1631
1645
|
padding-left: var(--spacing-xs);
|
|
1632
1646
|
}
|
|
1647
|
+
.pl-xxs {
|
|
1648
|
+
padding-left: var(--spacing-xxs);
|
|
1649
|
+
}
|
|
1633
1650
|
.text-center {
|
|
1634
1651
|
text-align: center;
|
|
1635
1652
|
}
|
|
@@ -1708,6 +1725,10 @@
|
|
|
1708
1725
|
letter-spacing: var(--tw-tracking, var(--text-overline--letter-spacing));
|
|
1709
1726
|
font-weight: var(--tw-font-weight, var(--text-overline--font-weight));
|
|
1710
1727
|
}
|
|
1728
|
+
.tracking-overline {
|
|
1729
|
+
--tw-tracking: var(--tracking-overline);
|
|
1730
|
+
letter-spacing: var(--tracking-overline);
|
|
1731
|
+
}
|
|
1711
1732
|
.whitespace-nowrap {
|
|
1712
1733
|
white-space: nowrap;
|
|
1713
1734
|
}
|
|
@@ -2877,6 +2898,10 @@
|
|
|
2877
2898
|
inherits: false;
|
|
2878
2899
|
initial-value: solid;
|
|
2879
2900
|
}
|
|
2901
|
+
@property --tw-tracking {
|
|
2902
|
+
syntax: "*";
|
|
2903
|
+
inherits: false;
|
|
2904
|
+
}
|
|
2880
2905
|
@property --tw-ordinal {
|
|
2881
2906
|
syntax: "*";
|
|
2882
2907
|
inherits: false;
|
|
@@ -3052,6 +3077,7 @@
|
|
|
3052
3077
|
--tw-space-y-reverse: 0;
|
|
3053
3078
|
--tw-divide-y-reverse: 0;
|
|
3054
3079
|
--tw-border-style: solid;
|
|
3080
|
+
--tw-tracking: initial;
|
|
3055
3081
|
--tw-ordinal: initial;
|
|
3056
3082
|
--tw-slashed-zero: initial;
|
|
3057
3083
|
--tw-numeric-figure: initial;
|
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.3.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",
|
|
@@ -64,6 +64,11 @@
|
|
|
64
64
|
"kind": "Molecule",
|
|
65
65
|
"description": null
|
|
66
66
|
},
|
|
67
|
+
{
|
|
68
|
+
"name": "AttachmentChip",
|
|
69
|
+
"kind": "Atom",
|
|
70
|
+
"description": null
|
|
71
|
+
},
|
|
67
72
|
{
|
|
68
73
|
"name": "Avatar",
|
|
69
74
|
"kind": "Atom",
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Icon } from "../Icon";
|
|
3
|
+
import type { IconName } from "../Icon";
|
|
4
|
+
import { IconButton } from "../IconButton";
|
|
5
|
+
import { Spinner } from "../Spinner";
|
|
6
|
+
|
|
7
|
+
export type AttachmentChipSize = "sm" | "md";
|
|
8
|
+
|
|
9
|
+
export interface AttachmentChipProps extends React.ComponentPropsWithoutRef<"span"> {
|
|
10
|
+
/** File name shown (and truncated) in the chip. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Thumbnail image for the attachment. Falls back to `icon` when omitted. */
|
|
13
|
+
imageSrc?: string;
|
|
14
|
+
/** Alt text for the thumbnail. Defaults to `label`. */
|
|
15
|
+
imageAlt?: string;
|
|
16
|
+
/** Glyph shown in the thumbnail when there is no image. */
|
|
17
|
+
icon?: IconName;
|
|
18
|
+
/** 0–99 while the file is uploading. Omit once the upload finishes. */
|
|
19
|
+
uploadProgress?: number;
|
|
20
|
+
/** Renders a trailing ghost remove button and fires when it is clicked. */
|
|
21
|
+
onRemove?: () => void;
|
|
22
|
+
size?: AttachmentChipSize;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function cn(...parts: Array<string | false | null | undefined>) {
|
|
26
|
+
return parts.filter(Boolean).join(" ");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Heights line up with Button's `md` (h-8) and `sm` (h-7) so chips sit level in a composer row. */
|
|
30
|
+
const heights: Record<AttachmentChipSize, string> = {
|
|
31
|
+
md: "h-8 pl-xs pr-xxs text-body-sm",
|
|
32
|
+
sm: "h-7 pl-xxs pr-xxs text-caption",
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const thumbs: Record<AttachmentChipSize, string> = {
|
|
36
|
+
md: "size-6",
|
|
37
|
+
sm: "size-5",
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const glyphSize: Record<AttachmentChipSize, number> = { md: 14, sm: 12 };
|
|
41
|
+
|
|
42
|
+
const radius: Record<AttachmentChipSize, string> = { md: "rounded-md", sm: "rounded-md" };
|
|
43
|
+
|
|
44
|
+
export const AttachmentChip = React.forwardRef<HTMLSpanElement, AttachmentChipProps>(
|
|
45
|
+
(
|
|
46
|
+
{
|
|
47
|
+
label,
|
|
48
|
+
imageSrc,
|
|
49
|
+
imageAlt,
|
|
50
|
+
icon = "file",
|
|
51
|
+
uploadProgress,
|
|
52
|
+
onRemove,
|
|
53
|
+
size = "md",
|
|
54
|
+
className,
|
|
55
|
+
...rest
|
|
56
|
+
},
|
|
57
|
+
ref,
|
|
58
|
+
) => {
|
|
59
|
+
const uploading = typeof uploadProgress === "number";
|
|
60
|
+
const percent = uploading
|
|
61
|
+
? Math.max(0, Math.min(99, Math.round(uploadProgress as number)))
|
|
62
|
+
: undefined;
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<span
|
|
66
|
+
ref={ref}
|
|
67
|
+
aria-busy={uploading || undefined}
|
|
68
|
+
className={cn(
|
|
69
|
+
"inline-flex max-w-full items-center gap-xs border border-hairline bg-canvas text-ink shadow-sm",
|
|
70
|
+
radius[size],
|
|
71
|
+
heights[size],
|
|
72
|
+
className,
|
|
73
|
+
)}
|
|
74
|
+
{...rest}
|
|
75
|
+
>
|
|
76
|
+
<span
|
|
77
|
+
className={cn(
|
|
78
|
+
"relative flex shrink-0 items-center justify-center overflow-hidden rounded-xs bg-surface-soft text-muted",
|
|
79
|
+
thumbs[size],
|
|
80
|
+
)}
|
|
81
|
+
>
|
|
82
|
+
{imageSrc ? (
|
|
83
|
+
<img
|
|
84
|
+
src={imageSrc}
|
|
85
|
+
alt={imageAlt ?? label}
|
|
86
|
+
loading="lazy"
|
|
87
|
+
className="size-full object-cover"
|
|
88
|
+
/>
|
|
89
|
+
) : (
|
|
90
|
+
<Icon name={icon} size={glyphSize[size]} />
|
|
91
|
+
)}
|
|
92
|
+
|
|
93
|
+
{/* Upload scrim stays mounted so finishing an upload fades out instead of popping.
|
|
94
|
+
`inverse-ink` keeps the ring light in both themes — the scrim is always dark. */}
|
|
95
|
+
<span
|
|
96
|
+
aria-hidden="true"
|
|
97
|
+
data-state={uploading ? "open" : "closed"}
|
|
98
|
+
className="pointer-events-none absolute inset-0 flex items-center justify-center bg-scrim/40 text-inverse-ink opacity-0 transition-opacity duration-200 ease-out data-[state=open]:opacity-100"
|
|
99
|
+
>
|
|
100
|
+
{uploading ? <Spinner variant="ring" size="sm" tone="current" /> : null}
|
|
101
|
+
</span>
|
|
102
|
+
</span>
|
|
103
|
+
|
|
104
|
+
<span className="min-w-0 max-w-40 truncate">{label}</span>
|
|
105
|
+
|
|
106
|
+
{uploading ? (
|
|
107
|
+
<span className="sr-only" aria-live="polite">
|
|
108
|
+
{`Uploading ${percent}%`}
|
|
109
|
+
</span>
|
|
110
|
+
) : null}
|
|
111
|
+
|
|
112
|
+
{onRemove ? (
|
|
113
|
+
<IconButton
|
|
114
|
+
icon="x"
|
|
115
|
+
variant="ghost"
|
|
116
|
+
size="sm"
|
|
117
|
+
aria-label={`Remove ${label}`}
|
|
118
|
+
onClick={onRemove}
|
|
119
|
+
/>
|
|
120
|
+
) : null}
|
|
121
|
+
</span>
|
|
122
|
+
);
|
|
123
|
+
},
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
AttachmentChip.displayName = "AttachmentChip";
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { AttachmentChip } from "./AttachmentChip";
|
|
3
|
+
import type { AttachmentChipSize } from "./AttachmentChip";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
|
|
6
|
+
interface DemoAttachment {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
imageSrc?: string;
|
|
10
|
+
icon?: "file";
|
|
11
|
+
size?: AttachmentChipSize;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const initial: DemoAttachment[] = [
|
|
15
|
+
{ id: "a1", label: "brand-guidelines-v2.pdf", imageSrc: "https://picsum.photos/seed/a8chip/64/64" },
|
|
16
|
+
{ id: "a2", label: "Q3-revenue-forecast.xlsx" },
|
|
17
|
+
{ id: "a3", label: "hero-mockup-final.png", imageSrc: "https://picsum.photos/seed/a8thumb/64/64", size: "sm" },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
function Section({
|
|
21
|
+
title,
|
|
22
|
+
hint,
|
|
23
|
+
children,
|
|
24
|
+
}: {
|
|
25
|
+
title: string;
|
|
26
|
+
hint?: string;
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
}) {
|
|
29
|
+
return (
|
|
30
|
+
<section className="w-full space-y-xs">
|
|
31
|
+
<h2 className="text-caption font-weight-label uppercase tracking-overline text-muted">{title}</h2>
|
|
32
|
+
{hint ? <p className="w-full max-w-prose text-body-sm text-muted">{hint}</p> : null}
|
|
33
|
+
<div className="w-full">{children}</div>
|
|
34
|
+
</section>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default function Preview() {
|
|
39
|
+
const [attachments, setAttachments] = React.useState<DemoAttachment[]>(initial);
|
|
40
|
+
const [progress, setProgress] = React.useState<number | undefined>(14);
|
|
41
|
+
|
|
42
|
+
React.useEffect(() => {
|
|
43
|
+
if (progress === undefined) return;
|
|
44
|
+
const id = window.setInterval(() => {
|
|
45
|
+
setProgress((current) => {
|
|
46
|
+
if (current === undefined) return current;
|
|
47
|
+
const next = current + 11;
|
|
48
|
+
return next >= 99 ? undefined : next;
|
|
49
|
+
});
|
|
50
|
+
}, 900);
|
|
51
|
+
return () => window.clearInterval(id);
|
|
52
|
+
}, [progress === undefined]);
|
|
53
|
+
|
|
54
|
+
const remove = (id: string) =>
|
|
55
|
+
setAttachments((current) => current.filter((item) => item.id !== id));
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div className="w-full max-w-3xl mx-auto space-y-xl p-lg">
|
|
59
|
+
<Section title="In a prompt composer" hint="Click the × to remove an attachment.">
|
|
60
|
+
<div className="w-full rounded-lg border border-hairline bg-surface p-md">
|
|
61
|
+
<div className="flex w-full flex-wrap items-center gap-xs">
|
|
62
|
+
{attachments.map((item) => (
|
|
63
|
+
<AttachmentChip
|
|
64
|
+
key={item.id}
|
|
65
|
+
label={item.label}
|
|
66
|
+
imageSrc={item.imageSrc}
|
|
67
|
+
icon={item.icon}
|
|
68
|
+
size={item.size}
|
|
69
|
+
onRemove={() => remove(item.id)}
|
|
70
|
+
/>
|
|
71
|
+
))}
|
|
72
|
+
{attachments.length === 0 ? (
|
|
73
|
+
<span className="text-body-sm text-muted">
|
|
74
|
+
No attachments — send a new prompt above.
|
|
75
|
+
</span>
|
|
76
|
+
) : null}
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<div className="pt-sm">
|
|
80
|
+
<Button
|
|
81
|
+
variant="ghost"
|
|
82
|
+
size="sm"
|
|
83
|
+
onClick={() => setAttachments(initial)}
|
|
84
|
+
disabled={attachments.length === initial.length}
|
|
85
|
+
>
|
|
86
|
+
Reset attachments
|
|
87
|
+
</Button>
|
|
88
|
+
</div>
|
|
89
|
+
</Section>
|
|
90
|
+
|
|
91
|
+
<Section
|
|
92
|
+
title="Uploading"
|
|
93
|
+
hint="The thumbnail dims, a progress ring spins, and the chip is aria-busy until the upload finishes."
|
|
94
|
+
>
|
|
95
|
+
<div className="flex w-full flex-wrap items-center gap-sm">
|
|
96
|
+
<AttachmentChip
|
|
97
|
+
label="meeting-transcript.docx"
|
|
98
|
+
uploadProgress={progress}
|
|
99
|
+
onRemove={() => setProgress(undefined)}
|
|
100
|
+
/>
|
|
101
|
+
<AttachmentChip
|
|
102
|
+
label="whiteboard.png"
|
|
103
|
+
imageSrc="https://picsum.photos/seed/a8upload/64/64"
|
|
104
|
+
size="sm"
|
|
105
|
+
uploadProgress={progress}
|
|
106
|
+
/>
|
|
107
|
+
<Button variant="secondary" size="sm" onClick={() => setProgress(8)}>
|
|
108
|
+
Restart upload
|
|
109
|
+
</Button>
|
|
110
|
+
</div>
|
|
111
|
+
</Section>
|
|
112
|
+
|
|
113
|
+
<Section
|
|
114
|
+
title="Sizes"
|
|
115
|
+
hint="sm sits at 28px and md at 32px, so chips line up with the Button sizes in a composer bar."
|
|
116
|
+
>
|
|
117
|
+
<div className="flex w-full flex-wrap items-center gap-sm">
|
|
118
|
+
<AttachmentChip label="readme.md" size="sm" />
|
|
119
|
+
<AttachmentChip label="readme.md" size="md" />
|
|
120
|
+
<AttachmentChip
|
|
121
|
+
label="brand-guidelines-v2.pdf"
|
|
122
|
+
imageSrc="https://picsum.photos/seed/a8size/64/64"
|
|
123
|
+
size="sm"
|
|
124
|
+
/>
|
|
125
|
+
<AttachmentChip
|
|
126
|
+
label="brand-guidelines-v2.pdf"
|
|
127
|
+
imageSrc="https://picsum.photos/seed/a8size2/64/64"
|
|
128
|
+
size="md"
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
</Section>
|
|
132
|
+
|
|
133
|
+
<Section
|
|
134
|
+
title="Glyph thumb, no remove"
|
|
135
|
+
hint="Omit onRemove when the attachment is fixed, e.g. a read-only transcript view."
|
|
136
|
+
>
|
|
137
|
+
<div className="flex w-full flex-wrap items-center gap-sm">
|
|
138
|
+
<AttachmentChip label="prompt-context.json" />
|
|
139
|
+
<AttachmentChip label="long-file-name-that-truncates-in-the-chip.tar.gz" size="sm" />
|
|
140
|
+
</div>
|
|
141
|
+
</Section>
|
|
142
|
+
</div>
|
|
143
|
+
);
|
|
144
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./atoms/AccordionItemDesktop";
|
|
|
6
6
|
export * from "./atoms/AccordionItemMobile";
|
|
7
7
|
export * from "./atoms/AgentQuestionCard";
|
|
8
8
|
export * from "./atoms/Alert";
|
|
9
|
+
export * from "./atoms/AttachmentChip";
|
|
9
10
|
export * from "./atoms/Avatar";
|
|
10
11
|
export * from "./atoms/AvatarGroup";
|
|
11
12
|
export * from "./atoms/Badge";
|