@shapesos/clay 0.1.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/LICENSE +21 -0
- package/README.md +170 -0
- package/dist/chat.cjs +1117 -0
- package/dist/chat.cjs.map +1 -0
- package/dist/chat.d.cts +46 -0
- package/dist/chat.d.ts +46 -0
- package/dist/chat.js +11 -0
- package/dist/chat.js.map +1 -0
- package/dist/chunk-2GFOESHR.js +613 -0
- package/dist/chunk-2GFOESHR.js.map +1 -0
- package/dist/chunk-5WRI5ZAA.js +31 -0
- package/dist/chunk-5WRI5ZAA.js.map +1 -0
- package/dist/chunk-6HNZQ2BF.js +91 -0
- package/dist/chunk-6HNZQ2BF.js.map +1 -0
- package/dist/chunk-7AJSQJQ5.js +1 -0
- package/dist/chunk-7AJSQJQ5.js.map +1 -0
- package/dist/chunk-A6DKIFWS.js +292 -0
- package/dist/chunk-A6DKIFWS.js.map +1 -0
- package/dist/chunk-C77QMQNT.js +1 -0
- package/dist/chunk-C77QMQNT.js.map +1 -0
- package/dist/chunk-P7NISN4V.js +115 -0
- package/dist/chunk-P7NISN4V.js.map +1 -0
- package/dist/chunk-XY2OM47L.js +16511 -0
- package/dist/chunk-XY2OM47L.js.map +1 -0
- package/dist/icon.cjs +237 -0
- package/dist/icon.cjs.map +1 -0
- package/dist/icon.d.cts +27 -0
- package/dist/icon.d.ts +27 -0
- package/dist/icon.js +12 -0
- package/dist/icon.js.map +1 -0
- package/dist/index.cjs +17634 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/lottie.cjs +16545 -0
- package/dist/lottie.cjs.map +1 -0
- package/dist/lottie.d.cts +38 -0
- package/dist/lottie.d.ts +38 -0
- package/dist/lottie.js +8 -0
- package/dist/lottie.js.map +1 -0
- package/dist/tokens.cjs +410 -0
- package/dist/tokens.cjs.map +1 -0
- package/dist/tokens.d.cts +121 -0
- package/dist/tokens.d.ts +121 -0
- package/dist/tokens.js +19 -0
- package/dist/tokens.js.map +1 -0
- package/package.json +110 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shapes.co
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# @shapes/clay
|
|
2
|
+
|
|
3
|
+
Shapes.co design system — tokens, theming, and composable React components.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @shapes/clay
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Entry Points
|
|
12
|
+
|
|
13
|
+
| Import path | What you get | Peer dependencies |
|
|
14
|
+
| --------------------- | ------------------------------------------ | -------------------------- |
|
|
15
|
+
| `@shapes/clay/tokens` | Colors, typography, font families | **None** (pure JS) |
|
|
16
|
+
| `@shapes/clay/chat` | Chat compound components + types | React, styled-components |
|
|
17
|
+
| `@shapes/clay/icon` | Icon, IconButton components + types | React, styled-components |
|
|
18
|
+
| `@shapes/clay` | Everything (convenience re-export) | React, styled-components |
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Design Tokens
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { colors, typographyStyles, typographyTypes, typographyMixin } from "@shapes/clay/tokens";
|
|
26
|
+
|
|
27
|
+
colors["brown-100"]; // "#171716"
|
|
28
|
+
|
|
29
|
+
typographyStyles[typographyTypes.GEIST_BODY_S_REGULAR];
|
|
30
|
+
// { fontFamily: "Geist", fontSize: 16, fontWeight: 400, lineHeight: 24, letterSpacing: -0.08 }
|
|
31
|
+
|
|
32
|
+
typographyMixin(typographyTypes.GEIST_BODY_XS_MEDIUM);
|
|
33
|
+
// CSS string for use in styled-components
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Chat Components
|
|
37
|
+
|
|
38
|
+
Composable compound components assembled via a namespace:
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
import { Chat } from "@shapes/clay/chat";
|
|
42
|
+
import type { ChatMessage } from "@shapes/clay/chat";
|
|
43
|
+
|
|
44
|
+
function MyChat() {
|
|
45
|
+
const [messages, setMessages] = useState<ChatMessage[]>([]);
|
|
46
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<Chat.Root
|
|
50
|
+
messages={messages}
|
|
51
|
+
onSendMessage={handleSend}
|
|
52
|
+
isLoading={isLoading}
|
|
53
|
+
onStop={handleStop}
|
|
54
|
+
onCopyMessage={handleCopy}
|
|
55
|
+
onThumbUpClick={handleThumbUp}
|
|
56
|
+
onThumbDownClick={handleThumbDown}
|
|
57
|
+
>
|
|
58
|
+
<Chat.MessageList />
|
|
59
|
+
<Chat.Composer placeholder="Ask anything..." />
|
|
60
|
+
</Chat.Root>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`Chat.Root` provides context; children consume it. This lets consumers add custom elements between the message list and composer, or wrap parts in their own layout.
|
|
66
|
+
|
|
67
|
+
#### Props
|
|
68
|
+
|
|
69
|
+
**Chat.Root**
|
|
70
|
+
|
|
71
|
+
| Prop | Type | Required | Description |
|
|
72
|
+
| ------------------ | ---------------------------------------------------------- | -------- | ----------------------------------------------- |
|
|
73
|
+
| `messages` | `ChatMessage[]` | Yes | Array of messages to display |
|
|
74
|
+
| `onSendMessage` | `(content: string) => void` | Yes | Called when the user sends a message |
|
|
75
|
+
| `isLoading` | `boolean` | No | Show stop button while loading |
|
|
76
|
+
| `onStop` | `() => void` | No | Called when the user clicks stop |
|
|
77
|
+
| `onCopyMessage` | `(messageId: string) => void` | No | Called when a message is copied |
|
|
78
|
+
| `onThumbUpClick` | `(messageId: string, isHelpful: boolean \| null) => void` | No | Called when thumbs up is clicked |
|
|
79
|
+
| `onThumbDownClick` | `(messageId: string, isHelpful: boolean \| null) => void` | No | Called when thumbs down is clicked |
|
|
80
|
+
|
|
81
|
+
**Chat.Composer**
|
|
82
|
+
|
|
83
|
+
| Prop | Type | Required | Default | Description |
|
|
84
|
+
| ------------- | -------- | -------- | -------------------- | ------------------ |
|
|
85
|
+
| `placeholder` | `string` | No | `"Type a message..."` | Input placeholder |
|
|
86
|
+
|
|
87
|
+
**Chat.MessageList** — no props, reads messages from context.
|
|
88
|
+
|
|
89
|
+
#### Data Model
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
type MessageRole = "user" | "assistant";
|
|
93
|
+
|
|
94
|
+
interface ChatMessage {
|
|
95
|
+
id: string;
|
|
96
|
+
role: MessageRole;
|
|
97
|
+
content: string; // Markdown
|
|
98
|
+
isHelpful?: boolean | null;
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Icon Components
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { Icon, IconButton } from "@shapes/clay/icon";
|
|
106
|
+
import { IconSearch, IconCopy } from "@tabler/icons-react";
|
|
107
|
+
|
|
108
|
+
<Icon icon={IconSearch} size={20} color="#333" aria-label="Search" />
|
|
109
|
+
|
|
110
|
+
<IconButton icon={IconCopy} size="small" onClick={handleCopy} aria-label="Copy" />
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
#### Props
|
|
114
|
+
|
|
115
|
+
**Icon**
|
|
116
|
+
|
|
117
|
+
| Prop | Type | Required | Default | Description |
|
|
118
|
+
| ------------ | ---------------------------------------- | -------- | ------- | ----------------------- |
|
|
119
|
+
| `icon` | `ComponentType<SVGProps<SVGSVGElement>>` | Yes | | Icon component to render |
|
|
120
|
+
| `size` | `number` | No | `16` | Icon size in pixels |
|
|
121
|
+
| `color` | `string` | No | | Icon color |
|
|
122
|
+
| `className` | `string` | No | | CSS class |
|
|
123
|
+
| `aria-label` | `string` | No | | Accessible label |
|
|
124
|
+
|
|
125
|
+
**IconButton**
|
|
126
|
+
|
|
127
|
+
| Prop | Type | Required | Default | Description |
|
|
128
|
+
| ------------ | ---------------------------------------- | -------- | --------- | -------------------------- |
|
|
129
|
+
| `icon` | `ComponentType<SVGProps<SVGSVGElement>>` | Yes | | Icon component to render |
|
|
130
|
+
| `size` | `"small" \| "medium"` | No | `"small"` | Button size |
|
|
131
|
+
| `isSelected` | `boolean` | No | `false` | Selected/active state |
|
|
132
|
+
| `disabled` | `boolean` | No | `false` | Disabled state |
|
|
133
|
+
| `onClick` | `() => void` | No | | Click handler |
|
|
134
|
+
| `className` | `string` | No | | CSS class |
|
|
135
|
+
| `aria-label` | `string` | No | | Accessible label |
|
|
136
|
+
|
|
137
|
+
### Types
|
|
138
|
+
|
|
139
|
+
```typescript
|
|
140
|
+
import type { ColorToken, TypographyStyle, TypographyType } from "@shapes/clay/tokens";
|
|
141
|
+
import type { ChatMessage, MessageRole, ChatContextValue } from "@shapes/clay/chat";
|
|
142
|
+
import type { IconProps, IconButtonProps, IconButtonSize } from "@shapes/clay/icon";
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
git clone git@github.com:dreamteamapp/shapes-clay.git
|
|
149
|
+
cd shapes-clay
|
|
150
|
+
bun install
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
| Command | Description |
|
|
154
|
+
| ------------------------ | ------------------------------------------ |
|
|
155
|
+
| `bun run storybook` | Component playground (http://localhost:6006)|
|
|
156
|
+
| `bun run build` | Build package (tsup) |
|
|
157
|
+
| `bun run dev` | Build in watch mode |
|
|
158
|
+
| `bun run test` | Run unit tests (Vitest) |
|
|
159
|
+
| `bun run test:coverage` | Unit tests with coverage report |
|
|
160
|
+
| `bun run test:e2e` | Run E2E tests (Playwright + Storybook) |
|
|
161
|
+
| `bun run lint` | Lint with ESLint |
|
|
162
|
+
| `bun run format` | Format with Prettier |
|
|
163
|
+
| `bun run typecheck` | TypeScript strict type checking |
|
|
164
|
+
| `bun run check` | All quality gates (lint + typecheck + test) |
|
|
165
|
+
|
|
166
|
+
See [AGENTS.md](AGENTS.md) for full project structure, architecture, and conventions.
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
[MIT](LICENSE)
|