@designa8/vibedesign-v6 1.6.7

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.
Files changed (51) hide show
  1. package/README.md +66 -0
  2. package/dist/fonts/inter/Inter-Italic[opsz,wght].ttf +0 -0
  3. package/dist/fonts/inter/Inter[opsz,wght].ttf +0 -0
  4. package/dist/index.cjs +3231 -0
  5. package/dist/index.js +3201 -0
  6. package/dist/styles.css +1810 -0
  7. package/package.json +109 -0
  8. package/src/atoms/AppLayout/AppLayout.tsx +537 -0
  9. package/src/atoms/AppLayout/index.ts +2 -0
  10. package/src/atoms/AppLayout/preview.tsx +75 -0
  11. package/src/atoms/AppSidebar/AppSidebar.tsx +399 -0
  12. package/src/atoms/AppSidebar/index.ts +2 -0
  13. package/src/atoms/AppSidebar/preview.tsx +214 -0
  14. package/src/atoms/AuthScreen/AuthScreen.tsx +226 -0
  15. package/src/atoms/AuthScreen/index.ts +2 -0
  16. package/src/atoms/AuthScreen/preview.tsx +10 -0
  17. package/src/atoms/Button/Button.tsx +71 -0
  18. package/src/atoms/Button/index.ts +2 -0
  19. package/src/atoms/Button/preview.tsx +71 -0
  20. package/src/atoms/ChatScreen/ChatScreen.tsx +629 -0
  21. package/src/atoms/ChatScreen/index.ts +2 -0
  22. package/src/atoms/ChatScreen/preview.tsx +239 -0
  23. package/src/atoms/Chip/Chip.tsx +121 -0
  24. package/src/atoms/Chip/index.ts +2 -0
  25. package/src/atoms/Chip/preview.tsx +99 -0
  26. package/src/atoms/FilterTabBar/FilterTabBar.tsx +95 -0
  27. package/src/atoms/FilterTabBar/index.ts +2 -0
  28. package/src/atoms/FilterTabBar/preview.tsx +92 -0
  29. package/src/atoms/Input/Input.tsx +139 -0
  30. package/src/atoms/Input/index.ts +2 -0
  31. package/src/atoms/Input/preview.tsx +97 -0
  32. package/src/atoms/Modal/Modal.tsx +144 -0
  33. package/src/atoms/Modal/index.ts +2 -0
  34. package/src/atoms/Modal/preview.tsx +111 -0
  35. package/src/atoms/NavItem/NavItem.tsx +316 -0
  36. package/src/atoms/NavItem/index.ts +2 -0
  37. package/src/atoms/NavItem/preview.tsx +125 -0
  38. package/src/atoms/PromptInputBar/PromptInputBar.tsx +626 -0
  39. package/src/atoms/PromptInputBar/index.ts +2 -0
  40. package/src/atoms/PromptInputBar/preview.tsx +85 -0
  41. package/src/atoms/TopNavbar/TopNavbar.tsx +400 -0
  42. package/src/atoms/TopNavbar/index.ts +2 -0
  43. package/src/atoms/TopNavbar/preview.tsx +117 -0
  44. package/src/atoms/UpgradeCard/UpgradeCard.tsx +65 -0
  45. package/src/atoms/UpgradeCard/index.ts +2 -0
  46. package/src/atoms/UpgradeCard/preview.tsx +25 -0
  47. package/src/atoms/WorkspaceMenu/WorkspaceMenu.tsx +216 -0
  48. package/src/atoms/WorkspaceMenu/index.ts +2 -0
  49. package/src/atoms/WorkspaceMenu/preview.tsx +44 -0
  50. package/src/index.ts +16 -0
  51. package/src/tokens.css +165 -0
@@ -0,0 +1,139 @@
1
+ import React from "react";
2
+
3
+ export type InputSize = "sm" | "md" | "lg";
4
+
5
+ export interface InputProps
6
+ extends Omit<React.ComponentPropsWithoutRef<"input">, "size"> {
7
+ /** Visible label rendered above the input */
8
+ label?: string;
9
+ /** Helper text shown below the input */
10
+ helperText?: string;
11
+ /** Error message — switches the input to error state */
12
+ error?: string;
13
+ /** Size variant */
14
+ size?: InputSize;
15
+ /** Leading icon (any inline SVG or element) */
16
+ leadingIcon?: React.ReactNode;
17
+ /** Trailing icon / adornment */
18
+ trailingIcon?: React.ReactNode;
19
+ /** Fill full width of its container */
20
+ fullWidth?: boolean;
21
+ }
22
+
23
+ const sizeClasses: Record<InputSize, { input: string; icon: string; label: string }> = {
24
+ sm: {
25
+ input: "h-8 px-sm text-body-sm",
26
+ icon: "w-4 h-4",
27
+ label: "text-body-sm",
28
+ },
29
+ md: {
30
+ input: "h-10 px-md text-body-md",
31
+ icon: "w-4 h-4",
32
+ label: "text-body-sm",
33
+ },
34
+ lg: {
35
+ input: "h-12 px-base text-body-lg",
36
+ icon: "w-5 h-5",
37
+ label: "text-body-md",
38
+ },
39
+ };
40
+
41
+ export const Input = React.forwardRef<HTMLInputElement, InputProps>(
42
+ (
43
+ {
44
+ label,
45
+ helperText,
46
+ error,
47
+ size = "md",
48
+ leadingIcon,
49
+ trailingIcon,
50
+ fullWidth = false,
51
+ disabled,
52
+ id,
53
+ className = "",
54
+ ...rest
55
+ },
56
+ ref
57
+ ) => {
58
+ const generatedId = React.useId();
59
+ const inputId = id ?? generatedId;
60
+ const helperId = `${inputId}-helper`;
61
+ const hasError = Boolean(error);
62
+ const { input: inputSize, icon: iconSize, label: labelSize } = sizeClasses[size];
63
+
64
+ const borderColor = hasError
65
+ ? "border-semantic-error focus:ring-semantic-error/30 focus:border-semantic-error"
66
+ : "border-hairline focus:ring-primary-focus/20 focus:border-primary-focus";
67
+
68
+ return (
69
+ <div className={`flex flex-col gap-xs ${fullWidth ? "w-full" : "w-fit"}`}>
70
+ {label && (
71
+ <label
72
+ htmlFor={inputId}
73
+ className={`${labelSize} font-medium text-ink`}
74
+ >
75
+ {label}
76
+ </label>
77
+ )}
78
+
79
+ <div className="relative flex items-center">
80
+ {leadingIcon && (
81
+ <span
82
+ aria-hidden="true"
83
+ className={`absolute left-md flex items-center text-muted ${iconSize}`}
84
+ >
85
+ {leadingIcon}
86
+ </span>
87
+ )}
88
+
89
+ <input
90
+ ref={ref}
91
+ id={inputId}
92
+ disabled={disabled}
93
+ aria-invalid={hasError ? "true" : undefined}
94
+ aria-describedby={
95
+ error ? helperId : helperText ? helperId : undefined
96
+ }
97
+ className={[
98
+ "w-full rounded-md border bg-surface text-ink placeholder:text-muted-soft",
99
+ "outline-none ring-0",
100
+ "transition-colors duration-150",
101
+ "focus:ring-2",
102
+ inputSize,
103
+ borderColor,
104
+ leadingIcon ? "pl-9" : "",
105
+ trailingIcon ? "pr-9" : "",
106
+ disabled
107
+ ? "cursor-not-allowed bg-surface-soft text-muted opacity-60"
108
+ : "",
109
+ className,
110
+ ]
111
+ .filter(Boolean)
112
+ .join(" ")}
113
+ {...rest}
114
+ />
115
+
116
+ {trailingIcon && (
117
+ <span
118
+ aria-hidden="true"
119
+ className={`absolute right-md flex items-center text-muted ${iconSize}`}
120
+ >
121
+ {trailingIcon}
122
+ </span>
123
+ )}
124
+ </div>
125
+
126
+ {(error || helperText) && (
127
+ <p
128
+ id={helperId}
129
+ className={`text-body-sm ${hasError ? "text-semantic-error" : "text-muted"}`}
130
+ >
131
+ {error ?? helperText}
132
+ </p>
133
+ )}
134
+ </div>
135
+ );
136
+ }
137
+ );
138
+
139
+ Input.displayName = "Input";
@@ -0,0 +1,2 @@
1
+ export { Input } from "./Input";
2
+ export type { InputProps, InputSize } from "./Input";
@@ -0,0 +1,97 @@
1
+ import React from "react";
2
+ import { Input } from "./Input";
3
+
4
+ const MailIcon = () => (
5
+ <svg viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth={1.5} className="w-full h-full">
6
+ <rect x="2.5" y="4.5" width="15" height="11" rx="1.5" />
7
+ <path d="M2.5 7l7.09 4.5a.9.9 0 0 0 .82 0L17.5 7" />
8
+ </svg>
9
+ );
10
+
11
+ const SearchIcon = () => (
12
+ <svg viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth={1.5} className="w-full h-full">
13
+ <circle cx="9" cy="9" r="5.5" />
14
+ <path d="M14 14l3.5 3.5" strokeLinecap="round" />
15
+ </svg>
16
+ );
17
+
18
+ const EyeIcon = () => (
19
+ <svg viewBox="0 0 20 20" fill="none" stroke="currentColor" strokeWidth={1.5} className="w-full h-full">
20
+ <path d="M2 10s3-6 8-6 8 6 8 6-3 6-8 6-8-6-8-6z" />
21
+ <circle cx="10" cy="10" r="2.5" />
22
+ </svg>
23
+ );
24
+
25
+ export default function InputPreview() {
26
+ return (
27
+ <div className="w-full max-w-2xl mx-auto p-lg space-y-xl">
28
+
29
+ {/* Sizes */}
30
+ <section className="space-y-md">
31
+ <p className="text-body-sm text-muted uppercase tracking-wide">Sizes</p>
32
+ <div className="space-y-sm">
33
+ <Input size="sm" label="Small" placeholder="Small input" fullWidth />
34
+ <Input size="md" label="Medium" placeholder="Medium input" fullWidth />
35
+ <Input size="lg" label="Large" placeholder="Large input" fullWidth />
36
+ </div>
37
+ </section>
38
+
39
+ {/* States */}
40
+ <section className="space-y-md">
41
+ <p className="text-body-sm text-muted uppercase tracking-wide">States</p>
42
+ <div className="space-y-sm">
43
+ <Input
44
+ label="Default"
45
+ placeholder="Enter your email"
46
+ helperText="We'll never share your email."
47
+ fullWidth
48
+ />
49
+ <Input
50
+ label="With value"
51
+ defaultValue="john@example.com"
52
+ fullWidth
53
+ />
54
+ <Input
55
+ label="Error state"
56
+ defaultValue="not-an-email"
57
+ error="Please enter a valid email address."
58
+ fullWidth
59
+ />
60
+ <Input
61
+ label="Disabled"
62
+ placeholder="Cannot edit this field"
63
+ disabled
64
+ fullWidth
65
+ />
66
+ </div>
67
+ </section>
68
+
69
+ {/* Icons */}
70
+ <section className="space-y-md">
71
+ <p className="text-body-sm text-muted uppercase tracking-wide">With icons</p>
72
+ <div className="space-y-sm">
73
+ <Input
74
+ label="Email address"
75
+ placeholder="you@example.com"
76
+ leadingIcon={<MailIcon />}
77
+ fullWidth
78
+ />
79
+ <Input
80
+ label="Search"
81
+ placeholder="Search anything…"
82
+ leadingIcon={<SearchIcon />}
83
+ fullWidth
84
+ />
85
+ <Input
86
+ label="Password"
87
+ type="password"
88
+ placeholder="Enter your password"
89
+ trailingIcon={<EyeIcon />}
90
+ fullWidth
91
+ />
92
+ </div>
93
+ </section>
94
+
95
+ </div>
96
+ );
97
+ }
@@ -0,0 +1,144 @@
1
+ import React, { useEffect, useRef, useState } from "react";
2
+ import { Button } from "../Button";
3
+
4
+ export interface ModalProps {
5
+ /** Controls whether the modal is visible */
6
+ isOpen: boolean;
7
+ /** Called when the user clicks the backdrop or the close button */
8
+ onClose: () => void;
9
+ /** Modal heading */
10
+ title?: string;
11
+ /** Modal body content */
12
+ children?: React.ReactNode;
13
+ /** Optional footer actions */
14
+ footer?: React.ReactNode;
15
+ /** Max-width variant */
16
+ size?: "sm" | "md" | "lg";
17
+ }
18
+
19
+ const sizeMap: Record<NonNullable<ModalProps["size"]>, string> = {
20
+ sm: "max-w-sm",
21
+ md: "max-w-lg",
22
+ lg: "max-w-2xl",
23
+ };
24
+
25
+ export const Modal = React.forwardRef<HTMLDivElement, ModalProps>(
26
+ ({ isOpen, onClose, title, children, footer, size = "md" }, ref) => {
27
+ // `mounted` controls DOM presence; `visible` drives the CSS transition
28
+ const [mounted, setMounted] = useState(false);
29
+ const [visible, setVisible] = useState(false);
30
+ const overlayRef = useRef<HTMLDivElement>(null);
31
+
32
+ // Open: mount first, then trigger transition on the next frame
33
+ useEffect(() => {
34
+ if (isOpen) {
35
+ setMounted(true);
36
+ // Double rAF so the element is painted before the opacity class is
37
+ // added — otherwise the browser batches them and skips the fade.
38
+ const raf = requestAnimationFrame(() => {
39
+ requestAnimationFrame(() => setVisible(true));
40
+ });
41
+ return () => cancelAnimationFrame(raf);
42
+ } else {
43
+ // Close: remove visible class, then unmount after the transition ends
44
+ setVisible(false);
45
+ const timer = setTimeout(() => setMounted(false), 250);
46
+ return () => clearTimeout(timer);
47
+ }
48
+ }, [isOpen]);
49
+
50
+ // Close on Escape key
51
+ useEffect(() => {
52
+ if (!mounted) return;
53
+ const handleKey = (e: KeyboardEvent) => {
54
+ if (e.key === "Escape") onClose();
55
+ };
56
+ document.addEventListener("keydown", handleKey);
57
+ return () => document.removeEventListener("keydown", handleKey);
58
+ }, [mounted, onClose]);
59
+
60
+ if (!mounted) return null;
61
+
62
+ const handleBackdropClick = (e: React.MouseEvent<HTMLDivElement>) => {
63
+ if (e.target === overlayRef.current) onClose();
64
+ };
65
+
66
+ return (
67
+ <div
68
+ ref={overlayRef}
69
+ role="dialog"
70
+ aria-modal="true"
71
+ aria-labelledby={title ? "modal-title" : undefined}
72
+ onClick={handleBackdropClick}
73
+ className={[
74
+ "fixed inset-0 flex items-center justify-center p-base",
75
+ "bg-[var(--color-scrim)]/50",
76
+ "transition-opacity duration-250 ease-in-out",
77
+ visible ? "opacity-100" : "opacity-0",
78
+ ].join(" ")}
79
+ style={{ zIndex: "var(--z-modal, 1000)" }}
80
+ >
81
+ {/* Panel */}
82
+ <div
83
+ ref={ref}
84
+ className={[
85
+ "relative w-full bg-canvas rounded-lg",
86
+ "shadow-[0_8px_40px_0_rgba(0,0,0,0.18)]",
87
+ "flex flex-col overflow-hidden",
88
+ sizeMap[size],
89
+ "transition-all duration-250 ease-in-out",
90
+ visible
91
+ ? "opacity-100 translate-y-0 scale-100"
92
+ : "opacity-0 translate-y-2 scale-95",
93
+ ].join(" ")}
94
+ >
95
+ {/* Header */}
96
+ {title && (
97
+ <div className="flex items-center justify-between px-lg py-base border-b border-hairline">
98
+ <h2 id="modal-title" className="text-heading-sm text-ink">
99
+ {title}
100
+ </h2>
101
+ <Button
102
+ variant="ghost"
103
+ size="sm"
104
+ aria-label="Close modal"
105
+ onClick={onClose}
106
+ className="!px-xs !py-xs"
107
+ >
108
+ <svg
109
+ xmlns="http://www.w3.org/2000/svg"
110
+ width="16"
111
+ height="16"
112
+ viewBox="0 0 24 24"
113
+ fill="none"
114
+ stroke="currentColor"
115
+ strokeWidth="2"
116
+ strokeLinecap="round"
117
+ strokeLinejoin="round"
118
+ aria-hidden="true"
119
+ >
120
+ <line x1="18" y1="6" x2="6" y2="18" />
121
+ <line x1="6" y1="6" x2="18" y2="18" />
122
+ </svg>
123
+ </Button>
124
+ </div>
125
+ )}
126
+
127
+ {/* Body */}
128
+ <div className="flex-1 px-lg py-base text-body-md text-body overflow-y-auto">
129
+ {children}
130
+ </div>
131
+
132
+ {/* Footer */}
133
+ {footer && (
134
+ <div className="flex items-center justify-end gap-sm px-lg py-base border-t border-hairline">
135
+ {footer}
136
+ </div>
137
+ )}
138
+ </div>
139
+ </div>
140
+ );
141
+ }
142
+ );
143
+
144
+ Modal.displayName = "Modal";
@@ -0,0 +1,2 @@
1
+ export { Modal } from "./Modal";
2
+ export type { ModalProps } from "./Modal";
@@ -0,0 +1,111 @@
1
+ import React, { useState } from "react";
2
+ import { Modal } from "./Modal";
3
+ import { Button } from "../Button";
4
+
5
+ export default function ModalPreview() {
6
+ const [basicOpen, setBasicOpen] = useState(false);
7
+ const [confirmOpen, setConfirmOpen] = useState(false);
8
+ const [largeOpen, setLargeOpen] = useState(false);
9
+
10
+ return (
11
+ <div className="w-full max-w-3xl mx-auto p-lg space-y-xl">
12
+ {/* Section title */}
13
+ <div>
14
+ <h2 className="text-heading-md text-ink">Modal</h2>
15
+ <p className="text-body-md text-muted mt-xs">
16
+ Click any button to open a modal. The backdrop and panel fade +
17
+ slide in on open, and fade out on close.
18
+ </p>
19
+ </div>
20
+
21
+ {/* Trigger row */}
22
+ <div className="flex flex-wrap gap-md">
23
+ <Button variant="primary" onClick={() => setBasicOpen(true)}>
24
+ Open basic modal
25
+ </Button>
26
+ <Button variant="secondary" onClick={() => setConfirmOpen(true)}>
27
+ Open confirm dialog
28
+ </Button>
29
+ <Button variant="ghost" onClick={() => setLargeOpen(true)}>
30
+ Open large modal
31
+ </Button>
32
+ </div>
33
+
34
+ {/* ── Basic modal ── */}
35
+ <Modal
36
+ isOpen={basicOpen}
37
+ onClose={() => setBasicOpen(false)}
38
+ title="Welcome back"
39
+ footer={
40
+ <Button variant="primary" onClick={() => setBasicOpen(false)}>
41
+ Got it
42
+ </Button>
43
+ }
44
+ >
45
+ <p className="text-body-md text-body">
46
+ This is a basic informational modal. It fades in when opened and
47
+ fades out when you click the backdrop, the close button, or press
48
+ <kbd className="mx-xs px-xs py-xxs bg-surface-soft border border-hairline rounded-xs text-body-sm font-weight-heading-sm">
49
+ Esc
50
+ </kbd>.
51
+ </p>
52
+ </Modal>
53
+
54
+ {/* ── Confirm dialog ── */}
55
+ <Modal
56
+ isOpen={confirmOpen}
57
+ onClose={() => setConfirmOpen(false)}
58
+ title="Delete workspace"
59
+ size="sm"
60
+ footer={
61
+ <>
62
+ <Button variant="secondary" onClick={() => setConfirmOpen(false)}>
63
+ Cancel
64
+ </Button>
65
+ <Button variant="destructive" onClick={() => setConfirmOpen(false)}>
66
+ Delete
67
+ </Button>
68
+ </>
69
+ }
70
+ >
71
+ <p className="text-body-md text-body">
72
+ Are you sure you want to delete this workspace? This action cannot
73
+ be undone and all data will be permanently removed.
74
+ </p>
75
+ </Modal>
76
+
77
+ {/* ── Large modal ── */}
78
+ <Modal
79
+ isOpen={largeOpen}
80
+ onClose={() => setLargeOpen(false)}
81
+ title="Project settings"
82
+ size="lg"
83
+ footer={
84
+ <>
85
+ <Button variant="secondary" onClick={() => setLargeOpen(false)}>
86
+ Discard
87
+ </Button>
88
+ <Button variant="primary" onClick={() => setLargeOpen(false)}>
89
+ Save changes
90
+ </Button>
91
+ </>
92
+ }
93
+ >
94
+ <div className="space-y-md">
95
+ <p className="text-body-md text-body">
96
+ A large modal is useful for forms, settings panels, or any
97
+ content that benefits from more horizontal room.
98
+ </p>
99
+ <div className="grid grid-cols-2 gap-md">
100
+ {["Name", "Slug", "Owner", "Region"].map((label) => (
101
+ <div key={label} className="flex flex-col gap-xs">
102
+ <span className="text-body-sm text-muted">{label}</span>
103
+ <div className="h-9 rounded-md bg-surface-soft border border-hairline" />
104
+ </div>
105
+ ))}
106
+ </div>
107
+ </div>
108
+ </Modal>
109
+ </div>
110
+ );
111
+ }