@tulipfarm/sprout 0.4.0 → 0.5.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 +55 -53
- package/dist/components/agent-avatar.d.ts +27 -0
- package/dist/components/agent-avatar.js +67 -0
- package/dist/components/alert-dialog.d.ts +2 -2
- package/dist/components/alert-dialog.js +4 -4
- package/dist/components/attachment.d.ts +1 -1
- package/dist/components/attachment.js +2 -2
- package/dist/components/avatar.d.ts +2 -10
- package/dist/components/avatar.js +3 -40
- package/dist/components/board.js +4 -4
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +13 -29
- package/dist/components/card.d.ts +1 -1
- package/dist/components/card.js +2 -2
- package/dist/components/chat-input.js +3 -3
- package/dist/components/chat-sources.js +1 -1
- package/dist/components/combobox.d.ts +10 -4
- package/dist/components/combobox.js +6 -5
- package/dist/components/form.js +1 -1
- package/dist/components/gradient-banner.d.ts +2 -2
- package/dist/components/gradient-banner.js +1 -1
- package/dist/components/input-group.d.ts +7 -7
- package/dist/components/input-group.js +7 -7
- package/dist/components/input-otp.d.ts +6 -2
- package/dist/components/input-otp.js +5 -3
- package/dist/components/input.d.ts +2 -2
- package/dist/components/input.js +2 -2
- package/dist/components/page-header.js +1 -1
- package/dist/components/pagination.js +2 -2
- package/dist/components/questionnaire.js +1 -1
- package/dist/components/record-list.d.ts +2 -2
- package/dist/components/record-list.js +2 -2
- package/dist/components/result-card.js +1 -1
- package/dist/components/rich-text-editor.d.ts +3 -3
- package/dist/components/rich-text-editor.js +3 -3
- package/dist/components/scroll-area.d.ts +2 -2
- package/dist/components/scroll-area.js +2 -2
- package/dist/components/search-field.js +1 -1
- package/dist/components/select.d.ts +2 -6
- package/dist/components/select.js +2 -2
- package/dist/components/spinner.d.ts +2 -2
- package/dist/components/spinner.js +2 -2
- package/dist/components/state-panel-samples.js +13 -13
- package/dist/components/state-sample.d.ts +1 -1
- package/dist/components/state-sample.js +2 -2
- package/dist/components/switch.d.ts +2 -2
- package/dist/components/switch.js +2 -2
- package/dist/components/table.js +1 -1
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group.js +3 -3
- package/dist/components/toggle.d.ts +2 -2
- package/dist/components/toggle.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/internal/agent-avatar-artwork.d.ts +4 -0
- package/dist/internal/agent-avatar-artwork.js +219 -0
- package/dist/internal/hash.d.ts +1 -0
- package/dist/internal/hash.js +9 -0
- package/dist/styles/alert-dialog.css +6 -6
- package/dist/styles/attachment.css +13 -13
- package/dist/styles/avatar.css +2 -14
- package/dist/styles/button-group.css +1 -1
- package/dist/styles/button.css +29 -154
- package/dist/styles/chat-sources.css +1 -0
- package/dist/styles/combobox.css +13 -2
- package/dist/styles/command.css +3 -1
- package/dist/styles/context-menu.css +2 -0
- package/dist/styles/dropdown-menu.css +2 -0
- package/dist/styles/gradient-banner.css +0 -5
- package/dist/styles/index.css +5 -4
- package/dist/styles/input-group.css +36 -28
- package/dist/styles/input-otp.css +13 -3
- package/dist/styles/input.css +14 -6
- package/dist/styles/menubar.css +4 -2
- package/dist/styles/navigation-menu.css +1 -1
- package/dist/styles/page-header.css +4 -0
- package/dist/styles/pagination.css +11 -2
- package/dist/styles/record-list.css +1 -1
- package/dist/styles/result-card.css +1 -1
- package/dist/styles/rich-text-editor.css +3 -3
- package/dist/styles/select.css +8 -12
- package/dist/styles/sidebar.css +15 -13
- package/dist/styles/state-sample.css +2 -2
- package/dist/styles/table.css +11 -4
- package/dist/styles/tabs.css +1 -3
- package/dist/styles/toggle-group.css +6 -6
- package/dist/styles/toggle.css +6 -6
- package/dist/styles/view-switcher.css +20 -2
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -98,7 +98,7 @@ for notes on each one.
|
|
|
98
98
|
|
|
99
99
|
<!-- bundle-size:start -->
|
|
100
100
|
|
|
101
|
-
Full library: **
|
|
101
|
+
Full library: **866.4 kB** gzip. Each component path is smaller. Sizes are minified, with React and other peer dependencies left out.
|
|
102
102
|
|
|
103
103
|
<details>
|
|
104
104
|
<summary>Size of each component</summary>
|
|
@@ -106,104 +106,105 @@ Full library: **842.5 kB** gzip. Each component path is smaller. Sizes are minif
|
|
|
106
106
|
| Component | Raw | Gzip | Brotli |
|
|
107
107
|
| ------------------- | -------: | -------: | -------: |
|
|
108
108
|
| `accordion` | 64.1 kB | 21.9 kB | 19.3 kB |
|
|
109
|
-
| `agent-fanout` | 260.
|
|
109
|
+
| `agent-fanout` | 260.7 kB | 86.6 kB | 74.5 kB |
|
|
110
|
+
| `agent-avatar` | 137.7 kB | 39.9 kB | 34.0 kB |
|
|
110
111
|
| `alert` | 35.2 kB | 11.5 kB | 10.1 kB |
|
|
111
|
-
| `alert-dialog` |
|
|
112
|
+
| `alert-dialog` | 168.8 kB | 56.9 kB | 49.7 kB |
|
|
112
113
|
| `aspect-ratio` | 30.2 kB | 9.7 kB | 8.5 kB |
|
|
113
|
-
| `attachment` |
|
|
114
|
-
| `avatar` |
|
|
114
|
+
| `attachment` | 351.9 kB | 118.6 kB | 97.8 kB |
|
|
115
|
+
| `avatar` | 44.0 kB | 14.6 kB | 12.9 kB |
|
|
115
116
|
| `badge` | 34.9 kB | 11.4 kB | 10.0 kB |
|
|
116
|
-
| `board` | 452.
|
|
117
|
-
| `brand-icon` | 195.1 kB | 70.2 kB | 61.
|
|
117
|
+
| `board` | 452.2 kB | 148.3 kB | 125.3 kB |
|
|
118
|
+
| `brand-icon` | 195.1 kB | 70.2 kB | 61.3 kB |
|
|
118
119
|
| `breadcrumb` | 40.5 kB | 13.4 kB | 11.7 kB |
|
|
119
|
-
| `button` | 50.
|
|
120
|
+
| `button` | 50.3 kB | 16.6 kB | 14.6 kB |
|
|
120
121
|
| `button-group` | 37.9 kB | 12.1 kB | 10.7 kB |
|
|
121
|
-
| `calendar` | 312.
|
|
122
|
-
| `canvas` |
|
|
122
|
+
| `calendar` | 312.0 kB | 103.4 kB | 88.2 kB |
|
|
123
|
+
| `canvas` | 234.9 kB | 80.7 kB | 69.0 kB |
|
|
123
124
|
| `card` | 35.4 kB | 11.6 kB | 10.1 kB |
|
|
124
|
-
| `carousel` | 60.
|
|
125
|
+
| `carousel` | 60.2 kB | 19.8 kB | 17.5 kB |
|
|
125
126
|
| `chart` | 540.1 kB | 155.5 kB | 129.9 kB |
|
|
126
|
-
| `timeline` | 598.
|
|
127
|
-
| `chat-confirmation` | 76.
|
|
127
|
+
| `timeline` | 598.3 kB | 175.8 kB | 147.0 kB |
|
|
128
|
+
| `chat-confirmation` | 76.5 kB | 26.2 kB | 22.4 kB |
|
|
128
129
|
| `chat-plan` | 42.3 kB | 13.4 kB | 11.7 kB |
|
|
129
|
-
| `chat-sources` | 206.
|
|
130
|
-
| `chat-input` |
|
|
130
|
+
| `chat-sources` | 206.0 kB | 70.5 kB | 60.3 kB |
|
|
131
|
+
| `chat-input` | 901.7 kB | 297.5 kB | 246.5 kB |
|
|
131
132
|
| `checkbox` | 60.0 kB | 21.0 kB | 18.5 kB |
|
|
132
133
|
| `choice-list` | 43.0 kB | 14.5 kB | 12.6 kB |
|
|
133
|
-
| `code-block` | 74.
|
|
134
|
+
| `code-block` | 74.3 kB | 26.0 kB | 22.3 kB |
|
|
134
135
|
| `collapsible` | 55.5 kB | 18.7 kB | 16.5 kB |
|
|
135
|
-
| `combobox` | 268.
|
|
136
|
-
| `command` | 181.
|
|
136
|
+
| `combobox` | 268.4 kB | 90.8 kB | 77.7 kB |
|
|
137
|
+
| `command` | 181.7 kB | 61.5 kB | 53.3 kB |
|
|
137
138
|
| `context-menu` | 242.8 kB | 81.0 kB | 70.0 kB |
|
|
138
|
-
| `dialog` | 170.
|
|
139
|
+
| `dialog` | 170.5 kB | 57.4 kB | 50.1 kB |
|
|
139
140
|
| `direction` | 1.4 kB | 0.7 kB | 0.7 kB |
|
|
140
141
|
| `dropdown-menu` | 239.6 kB | 80.0 kB | 69.1 kB |
|
|
141
142
|
| `field` | 97.9 kB | 34.1 kB | 29.6 kB |
|
|
142
|
-
| `file-explorer` | 175.
|
|
143
|
-
| `file-viewer` | 320.
|
|
144
|
-
| `form` | 109.
|
|
143
|
+
| `file-explorer` | 175.6 kB | 61.4 kB | 51.5 kB |
|
|
144
|
+
| `file-viewer` | 320.6 kB | 108.2 kB | 90.5 kB |
|
|
145
|
+
| `form` | 109.5 kB | 37.2 kB | 32.1 kB |
|
|
145
146
|
| `glass-banner` | 33.0 kB | 10.6 kB | 9.4 kB |
|
|
146
147
|
| `gradient-banner` | 32.2 kB | 10.3 kB | 9.1 kB |
|
|
147
148
|
| `hover-card` | 163.2 kB | 56.3 kB | 49.1 kB |
|
|
148
149
|
| `input` | 108.2 kB | 37.4 kB | 32.4 kB |
|
|
149
|
-
| `input-group` |
|
|
150
|
-
| `input-otp` | 65.
|
|
150
|
+
| `input-group` | 118.9 kB | 40.3 kB | 34.6 kB |
|
|
151
|
+
| `input-otp` | 65.4 kB | 22.9 kB | 20.4 kB |
|
|
151
152
|
| `kbd` | 30.4 kB | 9.7 kB | 8.5 kB |
|
|
152
153
|
| `label` | 30.2 kB | 9.6 kB | 8.4 kB |
|
|
153
|
-
| `mention-list` | 52.
|
|
154
|
+
| `mention-list` | 52.4 kB | 17.2 kB | 15.1 kB |
|
|
154
155
|
| `menubar` | 244.9 kB | 82.2 kB | 70.7 kB |
|
|
155
156
|
| `message` | 36.2 kB | 11.7 kB | 10.3 kB |
|
|
156
|
-
| `message-actions` | 71.
|
|
157
|
-
| `message-response` | 232.
|
|
158
|
-
| `message-scroller` |
|
|
157
|
+
| `message-actions` | 71.2 kB | 24.8 kB | 20.8 kB |
|
|
158
|
+
| `message-response` | 232.6 kB | 74.2 kB | 64.1 kB |
|
|
159
|
+
| `message-scroller` | 68.8 kB | 22.0 kB | 19.5 kB |
|
|
159
160
|
| `navigation-menu` | 182.3 kB | 63.0 kB | 54.8 kB |
|
|
160
161
|
| `notice-banner` | 30.4 kB | 9.7 kB | 8.5 kB |
|
|
161
162
|
| `page-content` | 30.2 kB | 9.6 kB | 8.4 kB |
|
|
162
|
-
| `page-header` | 54.
|
|
163
|
-
| `pagination` | 55.
|
|
163
|
+
| `page-header` | 54.4 kB | 17.5 kB | 15.4 kB |
|
|
164
|
+
| `pagination` | 55.1 kB | 17.8 kB | 15.6 kB |
|
|
164
165
|
| `plan-outline` | 79.9 kB | 26.8 kB | 22.9 kB |
|
|
165
166
|
| `popover` | 178.0 kB | 60.7 kB | 52.7 kB |
|
|
166
167
|
| `presence-cursor` | 30.8 kB | 9.9 kB | 8.6 kB |
|
|
167
168
|
| `progress` | 39.8 kB | 13.2 kB | 11.6 kB |
|
|
168
|
-
| `prompt-list` | 199.0 kB | 71.9 kB | 62.
|
|
169
|
-
| `questionnaire` | 69.
|
|
169
|
+
| `prompt-list` | 199.0 kB | 71.9 kB | 62.7 kB |
|
|
170
|
+
| `questionnaire` | 69.3 kB | 23.3 kB | 20.3 kB |
|
|
170
171
|
| `radio-group` | 80.8 kB | 27.9 kB | 24.8 kB |
|
|
171
172
|
| `reasoning-effort` | 35.5 kB | 12.0 kB | 10.5 kB |
|
|
172
|
-
| `record-list` | 65.
|
|
173
|
+
| `record-list` | 65.6 kB | 22.2 kB | 18.9 kB |
|
|
173
174
|
| `resizable` | 39.4 kB | 13.4 kB | 11.8 kB |
|
|
174
|
-
| `result-card` | 240.
|
|
175
|
+
| `result-card` | 240.0 kB | 85.2 kB | 72.2 kB |
|
|
175
176
|
| `result-notice` | 34.3 kB | 11.3 kB | 9.9 kB |
|
|
176
|
-
| `review-card` | 61.6 kB | 21.2 kB | 18.
|
|
177
|
+
| `review-card` | 61.6 kB | 21.2 kB | 18.4 kB |
|
|
177
178
|
| `rich-text-editor` | 442.5 kB | 140.2 kB | 119.8 kB |
|
|
178
|
-
| `schema-diagram` | 247.
|
|
179
|
-
| `sql-viewer` | 265.
|
|
179
|
+
| `schema-diagram` | 247.7 kB | 82.8 kB | 71.1 kB |
|
|
180
|
+
| `sql-viewer` | 265.4 kB | 89.1 kB | 76.2 kB |
|
|
180
181
|
| `scroll-area` | 57.3 kB | 19.7 kB | 17.4 kB |
|
|
181
|
-
| `search-dialog` | 190.
|
|
182
|
-
| `search-field` | 122.
|
|
183
|
-
| `select` | 230.4 kB | 79.3 kB | 67.
|
|
182
|
+
| `search-dialog` | 190.0 kB | 64.5 kB | 55.3 kB |
|
|
183
|
+
| `search-field` | 122.0 kB | 41.3 kB | 35.5 kB |
|
|
184
|
+
| `select` | 230.4 kB | 79.3 kB | 67.9 kB |
|
|
184
185
|
| `selection-slot` | 31.5 kB | 10.2 kB | 8.9 kB |
|
|
185
186
|
| `separator` | 36.9 kB | 11.9 kB | 10.5 kB |
|
|
186
187
|
| `settings-list` | 31.1 kB | 9.9 kB | 8.7 kB |
|
|
187
|
-
| `sheet` | 213.
|
|
188
|
+
| `sheet` | 213.2 kB | 72.9 kB | 63.1 kB |
|
|
188
189
|
| `sidebar` | 251.1 kB | 85.7 kB | 72.8 kB |
|
|
189
190
|
| `skeleton` | 35.1 kB | 11.5 kB | 10.1 kB |
|
|
190
|
-
| `slider` | 83.6 kB | 29.5 kB |
|
|
191
|
-
| `spinner` | 36.5 kB | 11.6 kB | 10.
|
|
192
|
-
| `state-panel` |
|
|
191
|
+
| `slider` | 83.6 kB | 29.5 kB | 26.0 kB |
|
|
192
|
+
| `spinner` | 36.5 kB | 11.6 kB | 10.2 kB |
|
|
193
|
+
| `state-panel` | 552.5 kB | 180.4 kB | 149.2 kB |
|
|
193
194
|
| `state-sample` | 33.5 kB | 10.5 kB | 9.2 kB |
|
|
194
|
-
| `switch` | 50.
|
|
195
|
-
| `table` | 541.
|
|
195
|
+
| `switch` | 50.2 kB | 17.3 kB | 15.4 kB |
|
|
196
|
+
| `table` | 541.1 kB | 173.1 kB | 145.7 kB |
|
|
196
197
|
| `table-nuqs` | 2.1 kB | 1.1 kB | 1.0 kB |
|
|
197
|
-
| `tabs` | 80.3 kB | 27.6 kB | 24.
|
|
198
|
+
| `tabs` | 80.3 kB | 27.6 kB | 24.4 kB |
|
|
198
199
|
| `textarea` | 98.2 kB | 34.2 kB | 29.6 kB |
|
|
199
|
-
| `toast` | 189.
|
|
200
|
+
| `toast` | 189.3 kB | 65.1 kB | 56.6 kB |
|
|
200
201
|
| `toggle` | 46.1 kB | 15.7 kB | 13.8 kB |
|
|
201
|
-
| `toggle-group` | 67.1 kB | 23.0 kB | 20.
|
|
202
|
-
| `tool-activity` | 86.
|
|
203
|
-
| `toolbar-status` | 189.
|
|
202
|
+
| `toggle-group` | 67.1 kB | 23.0 kB | 20.4 kB |
|
|
203
|
+
| `tool-activity` | 86.5 kB | 29.1 kB | 25.1 kB |
|
|
204
|
+
| `toolbar-status` | 189.1 kB | 64.2 kB | 55.4 kB |
|
|
204
205
|
| `tooltip` | 164.7 kB | 56.7 kB | 49.4 kB |
|
|
205
206
|
| `typed-text` | 31.2 kB | 10.1 kB | 8.8 kB |
|
|
206
|
-
| `view-switcher` | 270.
|
|
207
|
+
| `view-switcher` | 270.0 kB | 90.6 kB | 77.0 kB |
|
|
207
208
|
|
|
208
209
|
</details>
|
|
209
210
|
<!-- bundle-size:end -->
|
|
@@ -217,7 +218,7 @@ CI compares sizes on each pull request. Run `pnpm size` to see them locally.
|
|
|
217
218
|
| **Overlays** | Dialog · Alert Dialog · Sheet · Popover · Hover Card · Tooltip · Dropdown Menu · Context Menu · Menubar · Command · Search Dialog · Toast |
|
|
218
219
|
| **Layout & navigation** | Sidebar · Navigation Menu · Breadcrumb · Pagination · Tabs · View Switcher · Accordion · Collapsible · Page Header · Page Content · Settings List · Card · Carousel · Resizable · Scroll Area · Separator · Aspect Ratio · Direction · Canvas |
|
|
219
220
|
| **Feedback** | Alert · Notice Banner · Badge · Progress · Spinner · Skeleton · State Panel · State Sample |
|
|
220
|
-
| **Data display** | Table · Chart · Code Block · File Viewer · Schema Diagram · Avatar · Brand Icon · Attachment · Typed Text · Gradient Banner · Glass Banner
|
|
221
|
+
| **Data display** | Table · Chart · Code Block · File Viewer · Schema Diagram · Avatar · Agent Avatar · Brand Icon · Attachment · Typed Text · Gradient Banner · Glass Banner |
|
|
221
222
|
| **Agents & chat** | Message · Message Actions · Message Response · Message Scroller · Chat Confirmation · Chat Plan · Chat Sources · Plan Outline · Prompt List · Result Card · Review Card · Tool Activity |
|
|
222
223
|
|
|
223
224
|
## Theming
|
|
@@ -253,6 +254,7 @@ pnpm dev # docs and live examples at http://localhost:4321
|
|
|
253
254
|
```
|
|
254
255
|
|
|
255
256
|
After you change package code, run `pnpm --filter @tulipfarm/sprout build`.
|
|
257
|
+
After you change agent avatar artwork in `packages/sprout/artwork/agent-avatars`, run `pnpm avatars`.
|
|
256
258
|
|
|
257
259
|
```sh
|
|
258
260
|
pnpm build
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { colors, objects } from '../internal/agent-avatar-artwork.js';
|
|
2
|
+
import { type AvatarProps } from './avatar.js';
|
|
3
|
+
export type AgentAvatarObject = (typeof objects)[number];
|
|
4
|
+
export type AgentAvatarColor = (typeof colors)[number];
|
|
5
|
+
export declare const agentAvatarObjects: readonly AgentAvatarObject[];
|
|
6
|
+
export declare const agentAvatarColors: readonly AgentAvatarColor[];
|
|
7
|
+
/** A `data:` URL for one object in one color. Needs no network. */
|
|
8
|
+
export declare function agentAvatarArtwork(object: AgentAvatarObject, color: AgentAvatarColor): string;
|
|
9
|
+
/** The stable object and color for an agent, and its artwork. */
|
|
10
|
+
export declare function agentAvatar(agentId: string): {
|
|
11
|
+
object: "sprout" | "tulip" | "tulip-bouquet" | "cactus" | "sunflower" | "daisy" | "bonsai" | "monstera" | "fern" | "lavender" | "rose" | "poppy" | "daffodil" | "lily" | "bellflower" | "eucalyptus" | "ivy" | "succulent" | "acorn" | "pinecone" | "watering-can" | "hand-trowel" | "garden-fork" | "pruning-shears" | "gardening-gloves" | "rain-boots" | "wheelbarrow" | "seed-packet" | "flower-pot" | "plant-mister" | "spade" | "rake" | "hoe" | "garden-hose" | "seed-tray" | "garden-apron" | "plant-label" | "twine-spool" | "compost-bin" | "pruning-saw" | "mushroom" | "strawberry" | "carrot" | "pumpkin" | "apple" | "pear" | "lemon" | "corn-cob" | "honey-jar" | "harvest-basket" | "windmill" | "barn" | "tractor" | "wheat" | "pea-pod" | "beetroot" | "radish" | "eggplant" | "cherries" | "hay-bale" | "umbrella" | "mug" | "teapot" | "moka-pot" | "lantern" | "candle" | "picnic-basket" | "straw-hat" | "vase" | "jam-jar" | "birdhouse" | "rocking-chair" | "kettle" | "bread-loaf" | "croissant" | "milk-bottle" | "cookie" | "oven-mitt" | "thermos" | "yarn-ball" | "notebook" | "pencil" | "paintbrush" | "paint-palette" | "fountain-pen" | "camera" | "headphones" | "desk-lamp" | "book-stack" | "alarm-clock" | "scissors" | "ruler" | "stapler" | "paperclip" | "binder-clip" | "tape-dispenser" | "magnifying-glass" | "envelope" | "typewriter" | "globe";
|
|
12
|
+
color: "pink" | "coral" | "orange" | "yellow" | "green" | "teal" | "blue" | "purple";
|
|
13
|
+
src: string;
|
|
14
|
+
};
|
|
15
|
+
export declare function agentAvatarSrc(agentId: string): string;
|
|
16
|
+
export interface AgentAvatarProps extends Omit<AvatarProps, 'children'> {
|
|
17
|
+
agentId: string;
|
|
18
|
+
/** The agent's name. Its first letter shows if a custom `src` fails. */
|
|
19
|
+
name: string;
|
|
20
|
+
/** Overrides the object derived from `agentId`. */
|
|
21
|
+
object?: AgentAvatarObject | undefined;
|
|
22
|
+
/** Overrides the color derived from `agentId`. */
|
|
23
|
+
color?: AgentAvatarColor | undefined;
|
|
24
|
+
/** Your own artwork instead of the built-in collection. */
|
|
25
|
+
src?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
export declare function AgentAvatar({ agentId, name, object, color, src, ...props }: AgentAvatarProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { artwork, colors, objects, palettes } from '../internal/agent-avatar-artwork.js';
|
|
4
|
+
import { hash } from '../internal/hash.js';
|
|
5
|
+
import { Avatar, AvatarFallback, AvatarImage } from './avatar.js';
|
|
6
|
+
export const agentAvatarObjects = objects;
|
|
7
|
+
export const agentAvatarColors = colors;
|
|
8
|
+
function grain(seed) {
|
|
9
|
+
let state = seed;
|
|
10
|
+
const coordinate = () => {
|
|
11
|
+
state = (Math.imul(state, 1664525) + 1013904223) >>> 0;
|
|
12
|
+
return ((state / 2 ** 32) * 31).toFixed(2);
|
|
13
|
+
};
|
|
14
|
+
return Array.from({ length: 96 }, () => `M${coordinate()} ${coordinate()}h.55v.55h-.55z`).join('');
|
|
15
|
+
}
|
|
16
|
+
let finish;
|
|
17
|
+
// The circle with a faint diagonal wash and fixed-seed grain, shared by every object.
|
|
18
|
+
function background() {
|
|
19
|
+
const circle = '<circle cx="128" cy="128" r="120"';
|
|
20
|
+
finish ??=
|
|
21
|
+
'<defs><linearGradient id="tf-background-wash" x2="1" y2="1">' +
|
|
22
|
+
'<stop stop-color="#0000a5" stop-opacity=".08"/><stop offset="1" stop-color="#0000a2" stop-opacity=".08"/>' +
|
|
23
|
+
'</linearGradient><pattern id="tf-background-grain" width="32" height="32" patternUnits="userSpaceOnUse">' +
|
|
24
|
+
`<path d="${grain(19)}" fill="#0000a2" opacity=".1"/><path d="${grain(73)}" fill="#0000a5" opacity=".09"/>` +
|
|
25
|
+
`</pattern></defs>${circle} fill="#0000a1"/>${circle} fill="url(#tf-background-wash)"/>` +
|
|
26
|
+
`${circle} fill="url(#tf-background-grain)"/>`;
|
|
27
|
+
return finish;
|
|
28
|
+
}
|
|
29
|
+
const cache = new Map();
|
|
30
|
+
/** A `data:` URL for one object in one color. Needs no network. */
|
|
31
|
+
export function agentAvatarArtwork(object, color) {
|
|
32
|
+
const key = `${object}/${color}`;
|
|
33
|
+
let src = cache.get(key);
|
|
34
|
+
if (src === undefined) {
|
|
35
|
+
const index = objects.indexOf(object);
|
|
36
|
+
const palette = palettes[colors.indexOf(color)];
|
|
37
|
+
if (index < 0 || palette === undefined)
|
|
38
|
+
throw new Error(`Unknown agent avatar: ${key}`);
|
|
39
|
+
const svg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256">' +
|
|
40
|
+
artwork[index].replace('$', background()).replace(/#0000a([1-7])/g, (_, role) => palette[Number(role) - 1]) +
|
|
41
|
+
'</svg>';
|
|
42
|
+
src = `data:image/svg+xml,${encodeURIComponent(svg)}`;
|
|
43
|
+
cache.set(key, src);
|
|
44
|
+
}
|
|
45
|
+
return src;
|
|
46
|
+
}
|
|
47
|
+
/** The stable object and color for an agent, and its artwork. */
|
|
48
|
+
export function agentAvatar(agentId) {
|
|
49
|
+
const h = hash(agentId);
|
|
50
|
+
const object = objects[h % objects.length];
|
|
51
|
+
const color = colors[(h >>> 16) % colors.length];
|
|
52
|
+
return { object, color, src: agentAvatarArtwork(object, color) };
|
|
53
|
+
}
|
|
54
|
+
export function agentAvatarSrc(agentId) {
|
|
55
|
+
return agentAvatar(agentId).src;
|
|
56
|
+
}
|
|
57
|
+
function initial(name) {
|
|
58
|
+
return name.trim().charAt(0).toUpperCase() || '?';
|
|
59
|
+
}
|
|
60
|
+
export function AgentAvatar({ agentId, name, object, color, src, ...props }) {
|
|
61
|
+
let art;
|
|
62
|
+
if (src === undefined) {
|
|
63
|
+
const derived = agentAvatar(agentId);
|
|
64
|
+
art = agentAvatarArtwork(object ?? derived.object, color ?? derived.color);
|
|
65
|
+
}
|
|
66
|
+
return (_jsx(Avatar, { "data-agent-avatar": "", ...props, children: art === undefined ? (_jsxs(_Fragment, { children: [_jsx(AvatarImage, { src: src, alt: "" }), _jsx(AvatarFallback, { children: initial(name) })] })) : (_jsx("img", { "data-slot": "avatar-image", className: "sprout-avatar-image", src: art, alt: "", draggable: false })) }));
|
|
67
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AlertDialog as AlertDialogPrimitive } from '@base-ui/react/alert-dialog';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
3
|
import { type ButtonProps, type ButtonSize, type ButtonVariant } from './button.js';
|
|
4
|
-
export declare const alertDialogSizeNames: readonly ["
|
|
4
|
+
export declare const alertDialogSizeNames: readonly ["md", "sm"];
|
|
5
5
|
export type AlertDialogSize = (typeof alertDialogSizeNames)[number];
|
|
6
6
|
export type AlertDialogProps = AlertDialogPrimitive.Root.Props;
|
|
7
7
|
export declare function AlertDialog(props: AlertDialogProps): import("react").JSX.Element;
|
|
@@ -29,7 +29,7 @@ export interface AlertDialogPartState extends Record<string, unknown> {
|
|
|
29
29
|
export type AlertDialogPartProps = useRender.ComponentProps<'div', AlertDialogPartState>;
|
|
30
30
|
/**
|
|
31
31
|
* Groups media, title, and description. Centered on narrow screens and in
|
|
32
|
-
* `sm` dialogs; from 640px
|
|
32
|
+
* `sm` dialogs; from 640px an `md` dialog aligns it to the start with the
|
|
33
33
|
* media beside the text.
|
|
34
34
|
*/
|
|
35
35
|
export declare const AlertDialogHeader: ({ className, render, ref, ...props }: AlertDialogPartProps) => import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
@@ -5,7 +5,7 @@ import { mergeProps } from '@base-ui/react/merge-props';
|
|
|
5
5
|
import { useRender } from '@base-ui/react/use-render';
|
|
6
6
|
import { cn, stateClassName } from '../internal/classes.js';
|
|
7
7
|
import { Button } from './button.js';
|
|
8
|
-
export const alertDialogSizeNames = ['
|
|
8
|
+
export const alertDialogSizeNames = ['md', 'sm'];
|
|
9
9
|
export function AlertDialog(props) {
|
|
10
10
|
return _jsx(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", ...props });
|
|
11
11
|
}
|
|
@@ -22,7 +22,7 @@ export function AlertDialogOverlay({ className, ...props }) {
|
|
|
22
22
|
* The alert dialog surface. It renders its own portal and overlay, so place
|
|
23
23
|
* it directly inside `AlertDialog`.
|
|
24
24
|
*/
|
|
25
|
-
export function AlertDialogContent({ className, size = '
|
|
25
|
+
export function AlertDialogContent({ className, size = 'md', container, ...props }) {
|
|
26
26
|
return (_jsxs(AlertDialogPortal, { container: container, children: [_jsx(AlertDialogOverlay, {}), _jsx(AlertDialogPrimitive.Popup, { "data-slot": "alert-dialog-content", "data-size": size, ...props, className: stateClassName('sprout-alert-dialog-content', className) })] }));
|
|
27
27
|
}
|
|
28
28
|
function part(slot, base) {
|
|
@@ -38,7 +38,7 @@ function part(slot, base) {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* Groups media, title, and description. Centered on narrow screens and in
|
|
41
|
-
* `sm` dialogs; from 640px
|
|
41
|
+
* `sm` dialogs; from 640px an `md` dialog aligns it to the start with the
|
|
42
42
|
* media beside the text.
|
|
43
43
|
*/
|
|
44
44
|
export const AlertDialogHeader = part('alert-dialog-header', 'sprout-alert-dialog-header');
|
|
@@ -64,6 +64,6 @@ export function AlertDialogAction(props) {
|
|
|
64
64
|
return _jsx(Button, { "data-slot": "alert-dialog-action", ...props });
|
|
65
65
|
}
|
|
66
66
|
/** Closes the dialog. An outline button unless `variant` says otherwise. */
|
|
67
|
-
export function AlertDialogCancel({ variant = 'outline', size = '
|
|
67
|
+
export function AlertDialogCancel({ variant = 'outline', size = 'md', ...props }) {
|
|
68
68
|
return (_jsx(AlertDialogPrimitive.Close, { "data-slot": "alert-dialog-cancel", render: _jsx(Button, { variant: variant, size: size }), ...props }));
|
|
69
69
|
}
|
|
@@ -3,7 +3,7 @@ import { useRender } from '@base-ui/react/use-render';
|
|
|
3
3
|
import { type FileKind } from '../internal/file-kind.js';
|
|
4
4
|
import { type ButtonProps } from './button.js';
|
|
5
5
|
export declare const attachmentStateNames: readonly ["idle", "uploading", "processing", "error", "done"];
|
|
6
|
-
export declare const attachmentSizeNames: readonly ["
|
|
6
|
+
export declare const attachmentSizeNames: readonly ["lg", "md", "sm"];
|
|
7
7
|
export declare const attachmentOrientationNames: readonly ["horizontal", "vertical"];
|
|
8
8
|
export declare const attachmentMediaVariantNames: readonly ["icon", "image"];
|
|
9
9
|
export declare const attachmentGroupVariantNames: readonly ["carousel", "grid", "inline", "list"];
|
|
@@ -15,7 +15,7 @@ import { FilePreview, FileViewer, isPreviewableFile } from './file-viewer.js';
|
|
|
15
15
|
import { HoverCard, HoverCardContent, HoverCardTrigger } from './hover-card.js';
|
|
16
16
|
import { Spinner } from './spinner.js';
|
|
17
17
|
export const attachmentStateNames = ['idle', 'uploading', 'processing', 'error', 'done'];
|
|
18
|
-
export const attachmentSizeNames = ['
|
|
18
|
+
export const attachmentSizeNames = ['lg', 'md', 'sm'];
|
|
19
19
|
export const attachmentOrientationNames = ['horizontal', 'vertical'];
|
|
20
20
|
export const attachmentMediaVariantNames = ['icon', 'image'];
|
|
21
21
|
export const attachmentGroupVariantNames = ['carousel', 'grid', 'inline', 'list'];
|
|
@@ -23,7 +23,7 @@ export const fileAttachmentVariantNames = ['list', 'grid', 'inline', 'chip'];
|
|
|
23
23
|
export const fileAttachmentStateNames = ['ready', 'uploading', 'processing', 'error'];
|
|
24
24
|
export const fileTypeIconSizeNames = ['sm', 'lg'];
|
|
25
25
|
/** A file card built from media, content, and actions. */
|
|
26
|
-
export function Attachment({ className, state = 'done', size = '
|
|
26
|
+
export function Attachment({ className, state = 'done', size = 'lg', orientation = 'horizontal', ...props }) {
|
|
27
27
|
return (_jsx("div", { "data-slot": "attachment", "data-state": state, "data-size": size, "data-orientation": orientation, className: cn('sprout-attachment', `sprout-attachment-size-${size}`, `sprout-attachment-${orientation}`, className), ...props }));
|
|
28
28
|
}
|
|
29
29
|
export function AttachmentMedia({ className, variant = 'icon', ...props }) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentProps } from 'react';
|
|
2
2
|
import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
|
|
3
|
-
export type AvatarSize = '
|
|
4
|
-
export type EntityAvatarSize = AvatarSize
|
|
3
|
+
export type AvatarSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export type EntityAvatarSize = AvatarSize;
|
|
5
5
|
export type EntityAvatarShape = 'circle' | 'square';
|
|
6
6
|
export interface AvatarProps extends AvatarPrimitive.Root.Props {
|
|
7
7
|
size?: AvatarSize;
|
|
@@ -14,14 +14,6 @@ export declare function AvatarFallback({ className, ...props }: AvatarFallbackPr
|
|
|
14
14
|
export declare function AvatarBadge({ className, ...props }: ComponentProps<'span'>): import("react").JSX.Element;
|
|
15
15
|
export declare function AvatarGroup({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
16
16
|
export declare function AvatarGroupCount({ className, ...props }: ComponentProps<'div'>): import("react").JSX.Element;
|
|
17
|
-
export declare function agentAvatarSrc(agentId: string, baseUrl?: string): string;
|
|
18
|
-
export interface AgentAvatarProps extends Omit<AvatarProps, 'children'> {
|
|
19
|
-
agentId: string;
|
|
20
|
-
name: string;
|
|
21
|
-
/** Overrides the artwork derived from `agentId`. */
|
|
22
|
-
src?: string | undefined;
|
|
23
|
-
}
|
|
24
|
-
export declare function AgentAvatar({ agentId, name, src, ...props }: AgentAvatarProps): import("react").JSX.Element;
|
|
25
17
|
export interface EntityAvatarProps extends Omit<AvatarPrimitive.Root.Props, 'children'> {
|
|
26
18
|
seed: string;
|
|
27
19
|
name: string;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Avatar as AvatarPrimitive } from '@base-ui/react/avatar';
|
|
4
4
|
import { cn, stateClassName } from '../internal/classes.js';
|
|
5
|
-
|
|
5
|
+
import { hash } from '../internal/hash.js';
|
|
6
|
+
export function Avatar({ className, size = 'md', ...props }) {
|
|
6
7
|
return (_jsx(AvatarPrimitive.Root, { "data-slot": "avatar", "data-size": size, ...props, className: stateClassName('sprout-avatar', className) }));
|
|
7
8
|
}
|
|
8
9
|
export function AvatarImage({ className, ...props }) {
|
|
@@ -20,47 +21,9 @@ export function AvatarGroup({ className, ...props }) {
|
|
|
20
21
|
export function AvatarGroupCount({ className, ...props }) {
|
|
21
22
|
return _jsx("div", { "data-slot": "avatar-group-count", ...props, className: cn('sprout-avatar-group-count', className) });
|
|
22
23
|
}
|
|
23
|
-
// FNV-1a: small, stable, and spreads similar ids apart.
|
|
24
|
-
function hash(value) {
|
|
25
|
-
let h = 0x811c9dc5;
|
|
26
|
-
for (let i = 0; i < value.length; i++) {
|
|
27
|
-
h ^= value.charCodeAt(i);
|
|
28
|
-
h = Math.imul(h, 0x01000193);
|
|
29
|
-
}
|
|
30
|
-
return h >>> 0;
|
|
31
|
-
}
|
|
32
|
-
// Frozen order: any edit, even appending, changes existing agent avatars.
|
|
33
|
-
// prettier-ignore
|
|
34
|
-
const agentObjects = [
|
|
35
|
-
"tulip", "tulip-bouquet", "cactus", "sunflower", "daisy", "sprout", "bonsai", "monstera", "fern",
|
|
36
|
-
"lavender", "rose", "poppy", "daffodil", "lily", "bellflower", "eucalyptus", "ivy", "succulent",
|
|
37
|
-
"acorn", "pinecone", "watering-can", "hand-trowel", "garden-fork", "pruning-shears",
|
|
38
|
-
"gardening-gloves", "rain-boots", "wheelbarrow", "seed-packet", "flower-pot", "plant-mister",
|
|
39
|
-
"spade", "rake", "hoe", "garden-hose", "seed-tray", "garden-apron", "plant-label", "twine-spool",
|
|
40
|
-
"compost-bin", "pruning-saw", "mushroom", "strawberry", "carrot", "pumpkin", "apple", "pear",
|
|
41
|
-
"lemon", "corn-cob", "honey-jar", "harvest-basket", "windmill", "barn", "tractor", "wheat",
|
|
42
|
-
"pea-pod", "beetroot", "radish", "eggplant", "cherries", "hay-bale", "umbrella", "mug", "teapot",
|
|
43
|
-
"moka-pot", "lantern", "candle", "picnic-basket", "straw-hat", "vase", "jam-jar", "birdhouse",
|
|
44
|
-
"rocking-chair", "kettle", "bread-loaf", "croissant", "milk-bottle", "cookie", "oven-mitt",
|
|
45
|
-
"thermos", "yarn-ball", "notebook", "pencil", "paintbrush", "paint-palette", "fountain-pen",
|
|
46
|
-
"camera", "headphones", "desk-lamp", "book-stack", "alarm-clock", "scissors", "ruler", "stapler",
|
|
47
|
-
"paperclip", "binder-clip", "tape-dispenser", "magnifying-glass", "envelope", "typewriter",
|
|
48
|
-
"globe",
|
|
49
|
-
];
|
|
50
|
-
// prettier-ignore
|
|
51
|
-
const agentColors = ["pink", "coral", "orange", "yellow", "green", "teal", "blue", "purple"];
|
|
52
|
-
export function agentAvatarSrc(agentId, baseUrl = 'https://avatars.tulipfarm.ai/avatar') {
|
|
53
|
-
const h = hash(agentId);
|
|
54
|
-
const object = agentObjects[h % agentObjects.length];
|
|
55
|
-
const color = agentColors[(h >>> 16) % agentColors.length];
|
|
56
|
-
return `${baseUrl}/${object}/${color}.svg`;
|
|
57
|
-
}
|
|
58
24
|
function initial(name) {
|
|
59
25
|
return name.trim().charAt(0).toUpperCase() || '?';
|
|
60
26
|
}
|
|
61
|
-
export function AgentAvatar({ agentId, name, src, ...props }) {
|
|
62
|
-
return (_jsxs(Avatar, { "data-agent-avatar": "", ...props, children: [_jsx(AvatarImage, { src: src ?? agentAvatarSrc(agentId), alt: "" }), _jsx(AvatarFallback, { children: initial(name) })] }));
|
|
63
|
-
}
|
|
64
27
|
// Same seed, same gradient: the fallback never changes between visits.
|
|
65
28
|
function gradientFor(seed) {
|
|
66
29
|
const h = hash(seed);
|
|
@@ -68,6 +31,6 @@ function gradientFor(seed) {
|
|
|
68
31
|
const to = (from + 40 + ((h >>> 9) % 60)) % 360;
|
|
69
32
|
return `linear-gradient(135deg, oklch(0.62 0.15 ${from}), oklch(0.5 0.15 ${to}))`;
|
|
70
33
|
}
|
|
71
|
-
export function EntityAvatar({ seed, name, image, size = '
|
|
34
|
+
export function EntityAvatar({ seed, name, image, size = 'md', shape = 'circle', className, ...props }) {
|
|
72
35
|
return (_jsxs(AvatarPrimitive.Root, { "data-slot": "entity-avatar", "data-size": size, "data-shape": shape, ...props, className: stateClassName('sprout-entity-avatar', className), children: [image && (_jsx(AvatarPrimitive.Image, { src: image, alt: "", referrerPolicy: "no-referrer", className: "sprout-avatar-image" })), _jsx(AvatarPrimitive.Fallback, { className: "sprout-entity-avatar-fallback", style: { backgroundImage: gradientFor(seed) }, children: initial(name) })] }));
|
|
73
36
|
}
|
package/dist/components/board.js
CHANGED
|
@@ -427,7 +427,7 @@ export function Board({ columns, items, lanes, onItemsChange, onColumnsChange, o
|
|
|
427
427
|
return (_jsxs("div", { "data-slot": "board", className: cn('sprout-board', className), onKeyDown: onBoardKeyDown, children: [toolbar && (_jsxs("div", { className: "sprout-board-toolbar", "data-slot": "board-toolbar", children: [searchable && (_jsx(SearchField, { label: "Search cards", value: query, onChange: setQuery, className: "sprout-board-search" })), laneBy && (_jsxs("span", { className: "sprout-board-lane-by", children: [_jsx("span", { children: laneBy.label ?? 'Lanes by' }), _jsxs(Select, { value: laneBy.value, onValueChange: value => {
|
|
428
428
|
if (typeof value === 'string')
|
|
429
429
|
laneBy.onChange(value);
|
|
430
|
-
}, children: [_jsx(SelectTrigger, { size: "sm", "aria-label": laneBy.label ?? 'Lanes by', children: _jsx(SelectValue, { children: laneBy.options.find(o => o.value === laneBy.value)?.label }) }), _jsx(SelectContent, { children: laneBy.options.map(option => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))) })] })] })), _jsx("span", { className: "sprout-board-status", role: "status", children: selected.size > 0 ? (_jsxs(_Fragment, { children: [selected.size, " selected", _jsx(Button, { variant: "ghost", size: "
|
|
430
|
+
}, children: [_jsx(SelectTrigger, { size: "sm", "aria-label": laneBy.label ?? 'Lanes by', children: _jsx(SelectValue, { children: laneBy.options.find(o => o.value === laneBy.value)?.label }) }), _jsx(SelectContent, { children: laneBy.options.map(option => (_jsx(SelectItem, { value: option.value, children: option.label }, option.value))) })] })] })), _jsx("span", { className: "sprout-board-status", role: "status", children: selected.size > 0 ? (_jsxs(_Fragment, { children: [selected.size, " selected", _jsx(Button, { variant: "ghost", size: "sm", onClick: () => setSelected(new Set()), children: "Clear" })] })) : needle ? (visibleCount ? (`${visibleCount.toLocaleString('en-US')} of ${items.length.toLocaleString('en-US')} cards`) : (`No cards match “${query.trim()}”`)) : (`${items.length.toLocaleString('en-US')} cards`) })] })), _jsxs(DndContext, { id: dndId, sensors: sensors, accessibility: { ...dndAccessibility, announcements }, collisionDetection: collide, onDragStart: onDragStart, onDragOver: onDragOver, onDragEnd: onDragEnd, onDragCancel: finish, children: [_jsx("div", { className: "sprout-board-frame", children: _jsx("div", { ref: viewportRef, role: "region", "aria-label": label, className: "sprout-board-viewport", "data-lanes": withLanes || undefined, children: _jsxs("div", { className: "sprout-board-canvas", children: [_jsxs("div", { className: "sprout-board-header", style: gridStyle, children: [_jsx(SortableContext, { items: columns.map(c => COLUMN + c.id), strategy: horizontalListSortingStrategy, children: columns.map(column => (_jsx(BoardColumnHeader, { column: column, loaded: loadedIn(column), collapsed: collapsedColumns.has(column.id), onCollapse: () => setCollapsedColumns(s => toggle(s, column.id)), onRename: onColumnsChange ? renameColumn : undefined, onDelete: onColumnsChange ? deleteColumn : undefined }, column.id))) }), onColumnAdd && _jsx(AddColumn, { onAdd: onColumnAdd }), laneNotices &&
|
|
431
431
|
columns.map(column => (_jsx("div", { className: "sprout-board-column-notice", children: !collapsedColumns.has(column.id) && _jsx(ColumnNotice, { column: column, onRetry: onColumnRetry }) }, `notice:${column.id}`)))] }), withLanes ? (_jsx("div", { ref: bodyRef, className: "sprout-board-lanes", style: { height: laneVirtualizer.getTotalSize() }, children: laneRows.map(row => {
|
|
432
432
|
const lane = laneList[row.index];
|
|
433
433
|
if (!lane)
|
|
@@ -497,7 +497,7 @@ const BoardCell = memo(function BoardCell({ laneId, column, name, items, collaps
|
|
|
497
497
|
title,
|
|
498
498
|
columnId: cell.columnId,
|
|
499
499
|
laneId: fill ? undefined : cell.laneId,
|
|
500
|
-
}), onClose: () => setAdding(false) })) : (_jsxs(Button, { variant: "ghost", size: "
|
|
500
|
+
}), onClose: () => setAdding(false) })) : (_jsxs(Button, { variant: "ghost", size: "sm", className: "sprout-board-add", onClick: () => setAdding(true), "aria-label": `Add card to ${name}`, children: [_jsx(Plus, { "aria-hidden": "true", "data-icon": "inline-start" }), "Add card"] })))] }));
|
|
501
501
|
});
|
|
502
502
|
const BoardCard = memo(function BoardCard({ item, movable, selected, onSelect, onRename, onOpen, look, }) {
|
|
503
503
|
const [editing, setEditing] = useState(false);
|
|
@@ -590,13 +590,13 @@ function ColumnTitle({ column }) {
|
|
|
590
590
|
/** The error or unavailable message of a column. Nothing for other states. */
|
|
591
591
|
function ColumnNotice({ column, onRetry, }) {
|
|
592
592
|
if (column.status === 'error')
|
|
593
|
-
return (_jsxs("div", { className: "sprout-board-notice", "data-kind": "error", children: [_jsx("p", { role: "alert", children: column.error ?? 'Couldn’t load this column.' }), onRetry && (_jsx(Button, { variant: "outline", size: "
|
|
593
|
+
return (_jsxs("div", { className: "sprout-board-notice", "data-kind": "error", children: [_jsx("p", { role: "alert", children: column.error ?? 'Couldn’t load this column.' }), onRetry && (_jsx(Button, { variant: "outline", size: "sm", "aria-label": `Try again to load ${column.title}`, onClick: () => onRetry(column), children: "Try again" }))] }));
|
|
594
594
|
if (column.status === 'unavailable')
|
|
595
595
|
return (_jsx("p", { className: "sprout-board-notice", "data-kind": "unavailable", children: column.error ?? 'Cards are unavailable.' }));
|
|
596
596
|
return null;
|
|
597
597
|
}
|
|
598
598
|
function ShowAll({ column, count, onShowAll, text, }) {
|
|
599
|
-
return (_jsx(Button, { variant: "ghost", size: "
|
|
599
|
+
return (_jsx(Button, { variant: "ghost", size: "sm", className: "sprout-board-show-all", "aria-label": text ? undefined : `Show all ${formatCount(count)} in ${column.title}`, onClick: () => onShowAll(column), children: text ? (_jsxs(_Fragment, { children: [text(count, column), _jsxs("span", { className: "sprout-board-sr-only", children: [", ", column.title] })] })) : (`Show all ${formatCount(count)}`) }));
|
|
600
600
|
}
|
|
601
601
|
function AddColumn({ onAdd }) {
|
|
602
602
|
const [adding, setAdding] = useState(false);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Button as BaseButton } from '@base-ui/react/button';
|
|
2
2
|
import { type ReactElement } from 'react';
|
|
3
|
-
export declare const buttonVariantNames: readonly ["default", "outline", "secondary", "ghost", "destructive", "link", "scope"];
|
|
4
|
-
export declare const buttonSizeNames: readonly ["
|
|
3
|
+
export declare const buttonVariantNames: readonly ["default", "outline", "secondary", "ghost", "destructive", "ghost-destructive", "link", "scope"];
|
|
4
|
+
export declare const buttonSizeNames: readonly ["md", "sm", "lg", "icon", "icon-xs", "icon-sm", "icon-lg"];
|
|
5
5
|
export type ButtonVariant = (typeof buttonVariantNames)[number];
|
|
6
6
|
export type ButtonSize = (typeof buttonSizeNames)[number];
|
|
7
7
|
export interface ButtonVariantOptions {
|
|
@@ -4,41 +4,25 @@ import { useId } from 'react';
|
|
|
4
4
|
import { cn, stateClassName } from '../internal/classes.js';
|
|
5
5
|
import { Pressable } from '../internal/pressable.js';
|
|
6
6
|
import { Spinner } from './spinner.js';
|
|
7
|
-
export const buttonVariantNames = [
|
|
8
|
-
export const buttonSizeNames = [
|
|
7
|
+
export const buttonVariantNames = [
|
|
9
8
|
'default',
|
|
10
|
-
'
|
|
11
|
-
'
|
|
12
|
-
'
|
|
13
|
-
'
|
|
14
|
-
'
|
|
15
|
-
'
|
|
16
|
-
'
|
|
17
|
-
'back',
|
|
18
|
-
'onboarding',
|
|
19
|
-
'bud',
|
|
20
|
-
'bud-labeled',
|
|
21
|
-
'chat-row',
|
|
22
|
-
'task-link',
|
|
23
|
-
'card-title',
|
|
24
|
-
'result-card',
|
|
25
|
-
'calendar-title',
|
|
26
|
-
'calendar',
|
|
27
|
-
'calendar-icon',
|
|
28
|
-
'nav',
|
|
29
|
-
'column-header',
|
|
30
|
-
'column-header-end',
|
|
31
|
-
'table-link',
|
|
32
|
-
'badge',
|
|
9
|
+
'outline',
|
|
10
|
+
'secondary',
|
|
11
|
+
'ghost',
|
|
12
|
+
'destructive',
|
|
13
|
+
'ghost-destructive',
|
|
14
|
+
'link',
|
|
15
|
+
'scope',
|
|
33
16
|
];
|
|
17
|
+
export const buttonSizeNames = ['md', 'sm', 'lg', 'icon', 'icon-xs', 'icon-sm', 'icon-lg'];
|
|
34
18
|
export function buttonVariants({ variant, size, className } = {}) {
|
|
35
|
-
return cn('sprout-button', `sprout-button-variant-${variant ?? 'default'}`, `sprout-button-size-${size ?? '
|
|
19
|
+
return cn('sprout-button', `sprout-button-variant-${variant ?? 'default'}`, `sprout-button-size-${size ?? 'md'}`, className);
|
|
36
20
|
}
|
|
37
21
|
export function Button({ state, pendingLabel, ...props }) {
|
|
38
22
|
return state ? _jsx(StatefulButton, { state: state, pendingLabel: pendingLabel, ...props }) : _jsx(ButtonElement, { ...props });
|
|
39
23
|
}
|
|
40
24
|
function ButtonElement({ variant, size, className, ...props }) {
|
|
41
|
-
return (_jsx(Pressable, { "data-slot": "button", "data-variant": variant ?? 'default', "data-size": size ?? '
|
|
25
|
+
return (_jsx(Pressable, { "data-slot": "button", "data-variant": variant ?? 'default', "data-size": size ?? 'md', ...props, className: stateClassName(buttonVariants({ variant, size }), className) }));
|
|
42
26
|
}
|
|
43
27
|
function StatefulButton({ state, pendingLabel, className, children, ...props }) {
|
|
44
28
|
const action = useActionControl(state);
|
|
@@ -78,6 +62,6 @@ export function useActionControl(state) {
|
|
|
78
62
|
}
|
|
79
63
|
function FixButton({ fix }) {
|
|
80
64
|
if (fix.kind === 'link')
|
|
81
|
-
return (_jsx(Button, { variant: "link", size: "
|
|
82
|
-
return (_jsx(Button, { variant: "link", size: "
|
|
65
|
+
return (_jsx(Button, { variant: "link", size: "sm", nativeButton: false, render: fix.link, children: fix.label }));
|
|
66
|
+
return (_jsx(Button, { variant: "link", size: "sm", onClick: fix.kind === 'jump' ? () => jumpTo(fix.target) : fix.onClick, children: fix.label }));
|
|
83
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
-
export declare const cardSizeNames: readonly ["
|
|
2
|
+
export declare const cardSizeNames: readonly ["md", "sm"];
|
|
3
3
|
export declare const cardSurfaceNames: readonly ["default", "raised"];
|
|
4
4
|
export type CardSize = (typeof cardSizeNames)[number];
|
|
5
5
|
export type CardSurface = (typeof cardSurfaceNames)[number];
|
package/dist/components/card.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mergeProps } from '@base-ui/react/merge-props';
|
|
2
2
|
import { useRender } from '@base-ui/react/use-render';
|
|
3
3
|
import { cn } from '../internal/classes.js';
|
|
4
|
-
export const cardSizeNames = ['
|
|
4
|
+
export const cardSizeNames = ['md', 'sm'];
|
|
5
5
|
export const cardSurfaceNames = ['default', 'raised'];
|
|
6
6
|
export function cardVariants({ size, surface, className } = {}) {
|
|
7
7
|
return cn('sprout-card', size === 'sm' && 'sprout-card-sm', surface === 'raised' && 'sprout-card-raised', className);
|
|
@@ -10,7 +10,7 @@ export function cardVariants({ size, surface, className } = {}) {
|
|
|
10
10
|
* A bordered panel that groups related content. Compose it with
|
|
11
11
|
* `CardHeader`, `CardContent`, and `CardFooter`.
|
|
12
12
|
*/
|
|
13
|
-
export function Card({ className, size = '
|
|
13
|
+
export function Card({ className, size = 'md', surface = 'default', render, ref, ...props }) {
|
|
14
14
|
return useRender({
|
|
15
15
|
defaultTagName: 'div',
|
|
16
16
|
ref,
|