@designa8/vibedesign-linear-internal-v1-b737 0.4.0 → 0.6.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 +1604 -1168
- package/dist/index.js +1632 -1196
- package/dist/styles.css +34 -0
- package/package.json +11 -1
- package/src/atoms/CodePreview/CodePreview.tsx +161 -0
- package/src/atoms/CodePreview/index.ts +2 -0
- package/src/atoms/CodePreview/preview.tsx +74 -0
- package/src/atoms/ColorPicker/ColorPicker.tsx +394 -0
- package/src/atoms/ColorPicker/index.ts +7 -0
- package/src/atoms/ColorPicker/preview.tsx +182 -0
- package/src/index.ts +2 -0
package/dist/styles.css
CHANGED
|
@@ -313,6 +313,9 @@
|
|
|
313
313
|
.inset-0 {
|
|
314
314
|
inset: 0;
|
|
315
315
|
}
|
|
316
|
+
.inset-x-0 {
|
|
317
|
+
inset-inline: 0;
|
|
318
|
+
}
|
|
316
319
|
.inset-x-xs {
|
|
317
320
|
inset-inline: var(--spacing-xs);
|
|
318
321
|
}
|
|
@@ -707,6 +710,9 @@
|
|
|
707
710
|
.h-xs {
|
|
708
711
|
height: var(--spacing-xs);
|
|
709
712
|
}
|
|
713
|
+
.max-h-64 {
|
|
714
|
+
max-height: calc(var(--spacing) * 64);
|
|
715
|
+
}
|
|
710
716
|
.max-h-72 {
|
|
711
717
|
max-height: calc(var(--spacing) * 72);
|
|
712
718
|
}
|
|
@@ -824,6 +830,9 @@
|
|
|
824
830
|
.w-24 {
|
|
825
831
|
width: calc(var(--spacing) * 24);
|
|
826
832
|
}
|
|
833
|
+
.w-28 {
|
|
834
|
+
width: calc(var(--spacing) * 28);
|
|
835
|
+
}
|
|
827
836
|
.w-40 {
|
|
828
837
|
width: calc(var(--spacing) * 40);
|
|
829
838
|
}
|
|
@@ -1020,6 +1029,9 @@
|
|
|
1020
1029
|
.animate-spin {
|
|
1021
1030
|
animation: var(--animate-spin);
|
|
1022
1031
|
}
|
|
1032
|
+
.cursor-crosshair {
|
|
1033
|
+
cursor: crosshair;
|
|
1034
|
+
}
|
|
1023
1035
|
.cursor-default {
|
|
1024
1036
|
cursor: default;
|
|
1025
1037
|
}
|
|
@@ -1029,6 +1041,9 @@
|
|
|
1029
1041
|
.cursor-pointer {
|
|
1030
1042
|
cursor: pointer;
|
|
1031
1043
|
}
|
|
1044
|
+
.touch-none {
|
|
1045
|
+
touch-action: none;
|
|
1046
|
+
}
|
|
1032
1047
|
.resize {
|
|
1033
1048
|
resize: both;
|
|
1034
1049
|
}
|
|
@@ -1320,6 +1335,9 @@
|
|
|
1320
1335
|
--tw-border-style: dashed;
|
|
1321
1336
|
border-style: dashed;
|
|
1322
1337
|
}
|
|
1338
|
+
.border-canvas {
|
|
1339
|
+
border-color: var(--color-canvas);
|
|
1340
|
+
}
|
|
1323
1341
|
.border-current {
|
|
1324
1342
|
border-color: currentcolor;
|
|
1325
1343
|
}
|
|
@@ -1398,6 +1416,12 @@
|
|
|
1398
1416
|
.bg-canvas {
|
|
1399
1417
|
background-color: var(--color-canvas);
|
|
1400
1418
|
}
|
|
1419
|
+
.bg-canvas\/90 {
|
|
1420
|
+
background-color: color-mix(in srgb, #FFFFFF 90%, transparent);
|
|
1421
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
1422
|
+
background-color: color-mix(in oklab, var(--color-canvas) 90%, transparent);
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1401
1425
|
.bg-current {
|
|
1402
1426
|
background-color: currentcolor;
|
|
1403
1427
|
}
|
|
@@ -1753,12 +1777,18 @@
|
|
|
1753
1777
|
--tw-tracking: var(--tracking-overline);
|
|
1754
1778
|
letter-spacing: var(--tracking-overline);
|
|
1755
1779
|
}
|
|
1780
|
+
.break-words {
|
|
1781
|
+
overflow-wrap: break-word;
|
|
1782
|
+
}
|
|
1756
1783
|
.whitespace-nowrap {
|
|
1757
1784
|
white-space: nowrap;
|
|
1758
1785
|
}
|
|
1759
1786
|
.whitespace-pre {
|
|
1760
1787
|
white-space: pre;
|
|
1761
1788
|
}
|
|
1789
|
+
.whitespace-pre-wrap {
|
|
1790
|
+
white-space: pre-wrap;
|
|
1791
|
+
}
|
|
1762
1792
|
.text-body {
|
|
1763
1793
|
color: var(--color-body);
|
|
1764
1794
|
}
|
|
@@ -1899,6 +1929,10 @@
|
|
|
1899
1929
|
.ring-offset-canvas {
|
|
1900
1930
|
--tw-ring-offset-color: var(--color-canvas);
|
|
1901
1931
|
}
|
|
1932
|
+
.blur {
|
|
1933
|
+
--tw-blur: blur(8px);
|
|
1934
|
+
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
1935
|
+
}
|
|
1902
1936
|
.filter {
|
|
1903
1937
|
filter: var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,);
|
|
1904
1938
|
}
|
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.6.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",
|
|
@@ -139,6 +139,16 @@
|
|
|
139
139
|
"kind": "Organism",
|
|
140
140
|
"description": null
|
|
141
141
|
},
|
|
142
|
+
{
|
|
143
|
+
"name": "CodePreview",
|
|
144
|
+
"kind": "Molecule",
|
|
145
|
+
"description": null
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"name": "ColorPicker",
|
|
149
|
+
"kind": "Molecule",
|
|
150
|
+
"description": null
|
|
151
|
+
},
|
|
142
152
|
{
|
|
143
153
|
"name": "Combobox",
|
|
144
154
|
"kind": "Molecule",
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { Button } from "../Button";
|
|
3
|
+
import { Icon } from "../Icon";
|
|
4
|
+
import { Spinner } from "../Spinner";
|
|
5
|
+
|
|
6
|
+
export interface CodePreviewLine {
|
|
7
|
+
/** The raw text of the line, rendered verbatim (no syntax highlighting). */
|
|
8
|
+
text: string;
|
|
9
|
+
/**
|
|
10
|
+
* `heading` is an emphasised line — brand color at medium weight, used for
|
|
11
|
+
* section titles inside a rendered document. `default` is body text.
|
|
12
|
+
*/
|
|
13
|
+
tone?: "heading" | "default";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface CodePreviewProps
|
|
17
|
+
extends Omit<React.HTMLAttributes<HTMLDivElement>, "onCopy"> {
|
|
18
|
+
/** Lines to render. Pass `text` instead for a plain block. */
|
|
19
|
+
lines?: CodePreviewLine[];
|
|
20
|
+
/** Convenience alternative to `lines`: split on newlines. */
|
|
21
|
+
text?: string;
|
|
22
|
+
/** Right-aligned, muted line numbers in a fixed gutter. */
|
|
23
|
+
lineNumbers?: boolean;
|
|
24
|
+
/** Shows the Copy button in the top-right corner. */
|
|
25
|
+
copyable?: boolean;
|
|
26
|
+
/** Called after the text was copied successfully. */
|
|
27
|
+
onCopy?: () => void;
|
|
28
|
+
/** Lays a canvas overlay with a spinner and `loadingLabel` over the panel. */
|
|
29
|
+
loading?: boolean;
|
|
30
|
+
/** Message shown by the loading overlay. Also its accessible name. */
|
|
31
|
+
loadingLabel?: string;
|
|
32
|
+
/** Caps the height of the panel and scrolls vertically. Default true. */
|
|
33
|
+
capped?: boolean;
|
|
34
|
+
/** Wrap long lines instead of scrolling horizontally. */
|
|
35
|
+
wrap?: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const cn = (...parts: Array<string | false | null | undefined>) =>
|
|
39
|
+
parts.filter(Boolean).join(" ");
|
|
40
|
+
|
|
41
|
+
export const CodePreview = React.forwardRef<HTMLDivElement, CodePreviewProps>(
|
|
42
|
+
(
|
|
43
|
+
{
|
|
44
|
+
lines,
|
|
45
|
+
text,
|
|
46
|
+
lineNumbers = false,
|
|
47
|
+
copyable = false,
|
|
48
|
+
onCopy,
|
|
49
|
+
loading = false,
|
|
50
|
+
loadingLabel = "Loading preview…",
|
|
51
|
+
capped = true,
|
|
52
|
+
wrap = false,
|
|
53
|
+
className,
|
|
54
|
+
"aria-label": ariaLabel = "Code preview",
|
|
55
|
+
...rest
|
|
56
|
+
},
|
|
57
|
+
ref,
|
|
58
|
+
) => {
|
|
59
|
+
const rows = React.useMemo<CodePreviewLine[]>(
|
|
60
|
+
() => lines ?? (text ?? "").split("\n").map((line) => ({ text: line })),
|
|
61
|
+
[lines, text],
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const [copied, setCopied] = React.useState(false);
|
|
65
|
+
const resetTimer = React.useRef<number | undefined>(undefined);
|
|
66
|
+
|
|
67
|
+
React.useEffect(
|
|
68
|
+
() => () => {
|
|
69
|
+
if (resetTimer.current) window.clearTimeout(resetTimer.current);
|
|
70
|
+
},
|
|
71
|
+
[],
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const handleCopy = () => {
|
|
75
|
+
const value = rows.map((row) => row.text).join("\n");
|
|
76
|
+
if (typeof navigator === "undefined" || !navigator.clipboard) return;
|
|
77
|
+
navigator.clipboard
|
|
78
|
+
.writeText(value)
|
|
79
|
+
.then(() => {
|
|
80
|
+
setCopied(true);
|
|
81
|
+
if (resetTimer.current) window.clearTimeout(resetTimer.current);
|
|
82
|
+
resetTimer.current = window.setTimeout(() => setCopied(false), 1600);
|
|
83
|
+
onCopy?.();
|
|
84
|
+
})
|
|
85
|
+
.catch(() => {
|
|
86
|
+
/* clipboard unavailable — leave the label unchanged */
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return (
|
|
91
|
+
<div
|
|
92
|
+
ref={ref}
|
|
93
|
+
aria-label={ariaLabel}
|
|
94
|
+
aria-busy={loading || undefined}
|
|
95
|
+
className={cn(
|
|
96
|
+
"relative w-full overflow-hidden rounded-md border border-hairline bg-surface-soft",
|
|
97
|
+
className,
|
|
98
|
+
)}
|
|
99
|
+
{...rest}
|
|
100
|
+
>
|
|
101
|
+
{copyable ? (
|
|
102
|
+
<div className="flex items-center justify-end px-sm pt-sm">
|
|
103
|
+
<Button
|
|
104
|
+
variant="ghost"
|
|
105
|
+
size="sm"
|
|
106
|
+
onClick={handleCopy}
|
|
107
|
+
aria-label={copied ? "Copied to clipboard" : "Copy to clipboard"}
|
|
108
|
+
leadingIcon={<Icon name={copied ? "check" : "copy"} size={14} />}
|
|
109
|
+
>
|
|
110
|
+
<span aria-hidden="true">{copied ? "Copied" : "Copy"}</span>
|
|
111
|
+
</Button>
|
|
112
|
+
</div>
|
|
113
|
+
) : null}
|
|
114
|
+
|
|
115
|
+
<div
|
|
116
|
+
tabIndex={capped ? 0 : undefined}
|
|
117
|
+
role={capped ? "region" : undefined}
|
|
118
|
+
aria-label={capped ? ariaLabel : undefined}
|
|
119
|
+
className={cn(
|
|
120
|
+
"px-md py-sm font-mono text-caption focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-focus-blue",
|
|
121
|
+
capped && "max-h-64 overflow-y-auto overscroll-contain",
|
|
122
|
+
!wrap && "overflow-x-auto",
|
|
123
|
+
)}
|
|
124
|
+
>
|
|
125
|
+
{rows.map((line, index) => (
|
|
126
|
+
<div key={index} className="flex gap-md">
|
|
127
|
+
{lineNumbers ? (
|
|
128
|
+
<span
|
|
129
|
+
aria-hidden="true"
|
|
130
|
+
className="w-lg shrink-0 select-none text-right text-muted-soft"
|
|
131
|
+
>
|
|
132
|
+
{index + 1}
|
|
133
|
+
</span>
|
|
134
|
+
) : null}
|
|
135
|
+
<span
|
|
136
|
+
className={cn(
|
|
137
|
+
wrap ? "min-w-0 whitespace-pre-wrap break-words" : "whitespace-pre",
|
|
138
|
+
line.tone === "heading"
|
|
139
|
+
? "font-weight-label text-primary"
|
|
140
|
+
: "text-body",
|
|
141
|
+
)}
|
|
142
|
+
>
|
|
143
|
+
{line.text || "\u00A0"}
|
|
144
|
+
</span>
|
|
145
|
+
</div>
|
|
146
|
+
))}
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
{/* Stays mounted so the overlay can fade in and out. */}
|
|
150
|
+
<div
|
|
151
|
+
aria-hidden={loading ? undefined : "true"}
|
|
152
|
+
data-state={loading ? "open" : "closed"}
|
|
153
|
+
className="pointer-events-none absolute inset-0 flex items-center justify-center bg-canvas/90 transition-opacity duration-200 ease-out data-[state=open]:opacity-100 data-[state=closed]:opacity-0"
|
|
154
|
+
>
|
|
155
|
+
<Spinner size="sm" label={loading ? loadingLabel : undefined} />
|
|
156
|
+
</div>
|
|
157
|
+
</div>
|
|
158
|
+
);
|
|
159
|
+
},
|
|
160
|
+
);
|
|
161
|
+
CodePreview.displayName = "CodePreview";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { CodePreview } from "./CodePreview";
|
|
3
|
+
import type { CodePreviewLine } from "./CodePreview";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
|
|
6
|
+
const installLines: CodePreviewLine[] = [
|
|
7
|
+
{ text: "npm install @acme/design-system", tone: "heading" },
|
|
8
|
+
{ text: 'import { Button } from "@acme/design-system";' },
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
const documentLines: CodePreviewLine[] = [
|
|
12
|
+
{ text: "## Surface", tone: "heading" },
|
|
13
|
+
{ text: "Cards sit on `canvas` and lift with `surface` plus a hairline border." },
|
|
14
|
+
{ text: "" },
|
|
15
|
+
{ text: "## Typography", tone: "heading" },
|
|
16
|
+
{ text: "Body copy uses the `body-md` role; captions use `caption`." },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const pathLines: CodePreviewLine[] = [
|
|
20
|
+
{ text: "design-system/" },
|
|
21
|
+
{ text: " tokens.json" },
|
|
22
|
+
{ text: " components/" },
|
|
23
|
+
{ text: " Button.tsx" },
|
|
24
|
+
{ text: " CodePreview.tsx" },
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
export default function CodePreviewPreview() {
|
|
28
|
+
const [loading, setLoading] = React.useState(false);
|
|
29
|
+
const [copyCount, setCopyCount] = React.useState(0);
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className="w-full max-w-3xl mx-auto p-lg space-y-lg bg-canvas text-ink">
|
|
33
|
+
<section className="space-y-sm">
|
|
34
|
+
<p className="text-label text-muted">Install command with copy</p>
|
|
35
|
+
<CodePreview lines={installLines} copyable onCopy={() => setCopyCount((n) => n + 1)} />
|
|
36
|
+
<p className="text-caption text-muted-soft">Copy events: {copyCount}</p>
|
|
37
|
+
</section>
|
|
38
|
+
|
|
39
|
+
<section className="space-y-sm">
|
|
40
|
+
<p className="text-label text-muted">Numbered, wrapped document</p>
|
|
41
|
+
<CodePreview text={documentLines.map((l) => l.text).join("\n")} lineNumbers wrap />
|
|
42
|
+
</section>
|
|
43
|
+
|
|
44
|
+
<section className="space-y-sm">
|
|
45
|
+
<p className="text-label text-muted">Capped and scrolling (no wrap)</p>
|
|
46
|
+
<CodePreview
|
|
47
|
+
lines={[
|
|
48
|
+
...pathLines,
|
|
49
|
+
...pathLines,
|
|
50
|
+
...pathLines,
|
|
51
|
+
{ text: "This line is intentionally long so the horizontal scroll engages: design-system/components/CodePreview/CodePreview.tsx" },
|
|
52
|
+
]}
|
|
53
|
+
lineNumbers
|
|
54
|
+
capped
|
|
55
|
+
/>
|
|
56
|
+
</section>
|
|
57
|
+
|
|
58
|
+
<section className="space-y-sm">
|
|
59
|
+
<div className="flex items-center justify-between gap-sm">
|
|
60
|
+
<p className="text-label text-muted">Loading overlay</p>
|
|
61
|
+
<Button variant="secondary" size="sm" onClick={() => setLoading((v) => !v)}>
|
|
62
|
+
{loading ? "Hide overlay" : "Show overlay"}
|
|
63
|
+
</Button>
|
|
64
|
+
</div>
|
|
65
|
+
<CodePreview
|
|
66
|
+
text={"# DESIGN.md\nname: Acme design system\nbrand: #5E6AD2\nradius: 8px"}
|
|
67
|
+
lineNumbers
|
|
68
|
+
loading={loading}
|
|
69
|
+
loadingLabel="Loading preview…"
|
|
70
|
+
/>
|
|
71
|
+
</section>
|
|
72
|
+
</div>
|
|
73
|
+
);
|
|
74
|
+
}
|