@epicbagel/saas-kit 1.12.0 → 1.14.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 +41 -0
- package/THIRD_PARTY_NOTICES.md +20 -0
- package/dist/chunk-34AS3OCC.cjs +256 -0
- package/dist/chunk-KI7SWNIN.js +53 -0
- package/dist/{chunk-5VMKDVB6.cjs → chunk-PD5UQEKY.cjs} +21 -2
- package/dist/chunk-SJB4DPGQ.cjs +51 -0
- package/dist/chunk-SRIGG5I5.js +51 -0
- package/dist/{chunk-2V7AVB2U.js → chunk-UBTLWSKK.js} +19 -0
- package/dist/chunk-VKYRB37O.cjs +53 -0
- package/dist/chunk-VT2WDFSU.js +256 -0
- package/dist/primitives/chat.cjs +15 -13
- package/dist/primitives/chat.js +6 -4
- package/dist/primitives/message-scroller.cjs +6 -2
- package/dist/primitives/message-scroller.d.cts +5 -1
- package/dist/primitives/message-scroller.d.ts +5 -1
- package/dist/primitives/message-scroller.js +5 -1
- package/dist/primitives/notes.cjs +259 -0
- package/dist/primitives/notes.d.cts +123 -0
- package/dist/primitives/notes.d.ts +123 -0
- package/dist/primitives/notes.js +259 -0
- package/dist/primitives/panel-section.cjs +4 -48
- package/dist/primitives/panel-section.js +3 -47
- package/dist/primitives/scroll-navigator.cjs +10 -0
- package/dist/primitives/scroll-navigator.d.cts +40 -0
- package/dist/primitives/scroll-navigator.d.ts +40 -0
- package/dist/primitives/scroll-navigator.js +10 -0
- package/dist/primitives/section-header.cjs +4 -45
- package/dist/primitives/section-header.js +4 -45
- package/package.json +21 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
var _chunkSJB4DPGQcjs = require('../chunk-SJB4DPGQ.cjs');
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
var _chunkVKYRB37Ocjs = require('../chunk-VKYRB37O.cjs');
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkR3DQS6U4cjs = require('../chunk-R3DQS6U4.cjs');
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunk2HV2KKOEcjs = require('../chunk-2HV2KKOE.cjs');
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkJ467F76Icjs = require('../chunk-J467F76I.cjs');
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _chunk373W6VADcjs = require('../chunk-373W6VAD.cjs');
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
var _chunkT2ZFSPE4cjs = require('../chunk-T2ZFSPE4.cjs');
|
|
24
|
+
require('../chunk-VGTINL5Q.cjs');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var _chunkI6GUOEBOcjs = require('../chunk-I6GUOEBO.cjs');
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var _chunkCLYAASFNcjs = require('../chunk-CLYAASFN.cjs');
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
var _chunkVBPPFC7Xcjs = require('../chunk-VBPPFC7X.cjs');
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
var _chunkJDEXZGIYcjs = require('../chunk-JDEXZGIY.cjs');
|
|
37
|
+
require('../chunk-KWLSBTB2.cjs');
|
|
38
|
+
|
|
39
|
+
// src/primitives/notes.tsx
|
|
40
|
+
var _lucidereact = require('lucide-react');
|
|
41
|
+
var _react = require('react');
|
|
42
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
43
|
+
function present(value) {
|
|
44
|
+
return value != null && value !== false && value !== "";
|
|
45
|
+
}
|
|
46
|
+
function NoteList({
|
|
47
|
+
count,
|
|
48
|
+
loading = false,
|
|
49
|
+
title = "Notes",
|
|
50
|
+
empty = { title: "No notes yet" },
|
|
51
|
+
composer,
|
|
52
|
+
children,
|
|
53
|
+
border = "bottom",
|
|
54
|
+
...props
|
|
55
|
+
}) {
|
|
56
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkVKYRB37Ocjs.PanelSection, { "data-slot": "note-list", border, ...props, children: [
|
|
57
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkSJB4DPGQcjs.SectionHeader, { label: title, count: loading ? void 0 : count }),
|
|
58
|
+
loading ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ467F76Icjs.Stack, { direction: "vertical", gap: "sm", marginTop: "md", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkVBPPFC7Xcjs.Skeleton, { preset: "row", radius: "xl" }) }) : count > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ467F76Icjs.Stack, { direction: "vertical", gap: "sm", marginTop: "md", children }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
59
|
+
_chunkCLYAASFNcjs.EmptyState,
|
|
60
|
+
{
|
|
61
|
+
variant: "empty",
|
|
62
|
+
size: "inline",
|
|
63
|
+
icon: _lucidereact.StickyNote,
|
|
64
|
+
title: empty.title,
|
|
65
|
+
description: _nullishCoalesce(empty.description, () => ( ""))
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
composer
|
|
69
|
+
] });
|
|
70
|
+
}
|
|
71
|
+
var NOTE_CARD_LABELS = {
|
|
72
|
+
voice: "\xB7 voice",
|
|
73
|
+
delete: "Delete note"
|
|
74
|
+
};
|
|
75
|
+
var NOTE_ICON = { voice: _lucidereact.Mic, agent: _lucidereact.Sparkles, note: _lucidereact.MessageSquare };
|
|
76
|
+
function NoteCard({
|
|
77
|
+
author,
|
|
78
|
+
kind = "note",
|
|
79
|
+
pinned,
|
|
80
|
+
scope,
|
|
81
|
+
date,
|
|
82
|
+
text,
|
|
83
|
+
onDelete,
|
|
84
|
+
revealDelete = "hover",
|
|
85
|
+
labels,
|
|
86
|
+
...props
|
|
87
|
+
}) {
|
|
88
|
+
const voiceLabel = _optionalChain([labels, 'optionalAccess', _ => _.voice]) !== void 0 ? labels.voice : NOTE_CARD_LABELS.voice;
|
|
89
|
+
const deleteLabel = _nullishCoalesce(_optionalChain([labels, 'optionalAccess', _2 => _2.delete]), () => ( NOTE_CARD_LABELS.delete));
|
|
90
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkR3DQS6U4cjs.Card, { interaction: "group", surface: pinned ? "card" : "muted", padding: "row", ...props, children: [
|
|
91
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJ467F76Icjs.Stack, { direction: "horizontal", gap: "xs", align: "center", justify: "between", marginBottom: "md", minWidth: "zero", wrap: true, children: [
|
|
92
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJ467F76Icjs.Stack, { direction: "horizontal", gap: "sm", align: "center", textSize: "xs", tone: "muted", minWidth: "zero", className: "max-w-full", wrap: true, children: [
|
|
93
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunk373W6VADcjs.Text, { variant: "inherit", as: "span", display: "inline-flex", weight: "medium", tone: "soft", minWidth: "zero", className: "max-w-full", children: [
|
|
94
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2ZFSPE4cjs.Icon, { icon: NOTE_ICON[kind], size: "xs" }),
|
|
95
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk373W6VADcjs.Text, { variant: "inherit", as: "span", minWidth: "zero", className: "[overflow-wrap:anywhere]", children: author })
|
|
96
|
+
] }),
|
|
97
|
+
pinned && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkI6GUOEBOcjs.Badge, { as: "span", variant: "info", size: "micro", weight: "semibold", title: pinned.title, className: "max-w-full whitespace-normal [overflow-wrap:anywhere]", children: pinned.label }),
|
|
98
|
+
kind === "voice" && present(voiceLabel) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk373W6VADcjs.Text, { variant: "inherit", as: "span", tone: "subtle", children: voiceLabel }),
|
|
99
|
+
scope && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
100
|
+
_chunkI6GUOEBOcjs.Badge,
|
|
101
|
+
{
|
|
102
|
+
as: "span",
|
|
103
|
+
variant: scope.highlighted ? "info" : "default",
|
|
104
|
+
size: "micro",
|
|
105
|
+
weight: "semibold",
|
|
106
|
+
title: scope.title,
|
|
107
|
+
className: "max-w-full whitespace-normal [overflow-wrap:anywhere]",
|
|
108
|
+
children: scope.label
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
] }),
|
|
112
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJ467F76Icjs.Stack, { direction: "horizontal", gap: "xs", align: "center", minWidth: "zero", className: "max-w-full", children: [
|
|
113
|
+
present(date) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk373W6VADcjs.Text, { variant: "inherit", as: "span", size: "xs", tone: "muted", minWidth: "zero", className: "[overflow-wrap:anywhere]", children: date }) : null,
|
|
114
|
+
onDelete && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
115
|
+
_chunkJDEXZGIYcjs.Button,
|
|
116
|
+
{
|
|
117
|
+
type: "button",
|
|
118
|
+
size: "icon-sm",
|
|
119
|
+
reveal: revealDelete === "always" ? "always" : "parent-hover-responsive",
|
|
120
|
+
variant: "ghost-destructive",
|
|
121
|
+
onClick: () => onDelete(),
|
|
122
|
+
title: deleteLabel,
|
|
123
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2ZFSPE4cjs.Icon, { icon: _lucidereact.Trash2, size: "sm" })
|
|
124
|
+
}
|
|
125
|
+
)
|
|
126
|
+
] })
|
|
127
|
+
] }),
|
|
128
|
+
present(text) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk373W6VADcjs.Text, { size: "sm", whitespace: "pre-wrap", className: "break-words [overflow-wrap:anywhere]", children: text })
|
|
129
|
+
] });
|
|
130
|
+
}
|
|
131
|
+
function Notes({ notes, ...props }) {
|
|
132
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NoteList, { "data-slot": "notes", count: notes.length, ...props, children: notes.map(({ id, ...note }) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, NoteCard, { ...note }, id)) });
|
|
133
|
+
}
|
|
134
|
+
var COMPOSER_LABELS = {
|
|
135
|
+
voice: "Tap to speak",
|
|
136
|
+
type: "or type instead",
|
|
137
|
+
input: "Note",
|
|
138
|
+
placeholder: "Type your note\u2026",
|
|
139
|
+
cancel: "Cancel",
|
|
140
|
+
submit: "Add note",
|
|
141
|
+
error: "Could not save your note. Try again."
|
|
142
|
+
};
|
|
143
|
+
function NoteComposer({
|
|
144
|
+
onVoice,
|
|
145
|
+
onSubmit,
|
|
146
|
+
suggestions = [],
|
|
147
|
+
labels,
|
|
148
|
+
value,
|
|
149
|
+
onValueChange,
|
|
150
|
+
editing,
|
|
151
|
+
onEditingChange,
|
|
152
|
+
onCancel,
|
|
153
|
+
disabled = false,
|
|
154
|
+
error,
|
|
155
|
+
maxLength,
|
|
156
|
+
...props
|
|
157
|
+
}) {
|
|
158
|
+
const copy = { ...COMPOSER_LABELS, ...labels };
|
|
159
|
+
const [draft, setDraft] = _react.useState.call(void 0, "");
|
|
160
|
+
const [localEditing, setLocalEditing] = _react.useState.call(void 0, false);
|
|
161
|
+
const [saving, setSaving] = _react.useState.call(void 0, false);
|
|
162
|
+
const [failed, setFailed] = _react.useState.call(void 0, false);
|
|
163
|
+
const pending = _react.useRef.call(void 0, false);
|
|
164
|
+
const mounted = _react.useRef.call(void 0, true);
|
|
165
|
+
const errorId = _react.useId.call(void 0, );
|
|
166
|
+
const text = _nullishCoalesce(value, () => ( draft));
|
|
167
|
+
const latestText = _react.useRef.call(void 0, text);
|
|
168
|
+
latestText.current = text;
|
|
169
|
+
const busy = disabled || saving;
|
|
170
|
+
const message = _nullishCoalesce(error, () => ( (failed ? copy.error : null)));
|
|
171
|
+
const typing = (_nullishCoalesce(editing, () => ( localEditing))) || Boolean(text) || Boolean(message) || !onVoice;
|
|
172
|
+
_react.useEffect.call(void 0, () => {
|
|
173
|
+
mounted.current = true;
|
|
174
|
+
return () => {
|
|
175
|
+
mounted.current = false;
|
|
176
|
+
};
|
|
177
|
+
}, []);
|
|
178
|
+
function changeText(next) {
|
|
179
|
+
if (value === void 0) setDraft(next);
|
|
180
|
+
_optionalChain([onValueChange, 'optionalCall', _3 => _3(next)]);
|
|
181
|
+
latestText.current = next;
|
|
182
|
+
}
|
|
183
|
+
function changeEditing(next) {
|
|
184
|
+
if (editing === void 0) setLocalEditing(next);
|
|
185
|
+
_optionalChain([onEditingChange, 'optionalCall', _4 => _4(next)]);
|
|
186
|
+
}
|
|
187
|
+
function cancel() {
|
|
188
|
+
if (disabled || pending.current) return;
|
|
189
|
+
changeText("");
|
|
190
|
+
changeEditing(false);
|
|
191
|
+
setFailed(false);
|
|
192
|
+
_optionalChain([onCancel, 'optionalCall', _5 => _5()]);
|
|
193
|
+
}
|
|
194
|
+
async function submit(input) {
|
|
195
|
+
const trimmed = input.trim();
|
|
196
|
+
if (disabled || pending.current || !trimmed || maxLength != null && trimmed.length > maxLength) return;
|
|
197
|
+
pending.current = true;
|
|
198
|
+
setSaving(true);
|
|
199
|
+
setFailed(false);
|
|
200
|
+
const previous = latestText.current;
|
|
201
|
+
try {
|
|
202
|
+
await onSubmit(trimmed);
|
|
203
|
+
if (!mounted.current) return;
|
|
204
|
+
if (value === void 0 && latestText.current === previous) {
|
|
205
|
+
changeText("");
|
|
206
|
+
changeEditing(false);
|
|
207
|
+
}
|
|
208
|
+
} catch (e) {
|
|
209
|
+
if (!mounted.current) return;
|
|
210
|
+
if (latestText.current === previous) changeText(input);
|
|
211
|
+
changeEditing(true);
|
|
212
|
+
setFailed(true);
|
|
213
|
+
} finally {
|
|
214
|
+
pending.current = false;
|
|
215
|
+
if (mounted.current) setSaving(false);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJ467F76Icjs.Stack, { "data-slot": "note-composer", direction: "vertical", gap: "sm", marginTop: "md", "aria-busy": saving, ...props, children: [
|
|
219
|
+
message ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk373W6VADcjs.Text, { id: errorId, role: "alert", size: "sm", tone: "destructive", children: message }) : null,
|
|
220
|
+
typing ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
221
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
222
|
+
_chunk2HV2KKOEcjs.Textarea,
|
|
223
|
+
{
|
|
224
|
+
"aria-label": copy.input,
|
|
225
|
+
"aria-describedby": message ? errorId : void 0,
|
|
226
|
+
resize: "vertical",
|
|
227
|
+
placeholder: copy.placeholder,
|
|
228
|
+
value: text,
|
|
229
|
+
onChange: (event) => changeText(event.target.value),
|
|
230
|
+
maxLength,
|
|
231
|
+
disabled: busy,
|
|
232
|
+
autoFocus: Boolean(onVoice)
|
|
233
|
+
}
|
|
234
|
+
),
|
|
235
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJ467F76Icjs.Stack, { direction: "horizontal", gap: "sm", align: "center", wrap: true, children: [
|
|
236
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJDEXZGIYcjs.Button, { type: "button", size: "sm", variant: "ghost", onClick: cancel, disabled: busy, children: copy.cancel }),
|
|
237
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJDEXZGIYcjs.Button, { type: "button", size: "sm", onClick: () => void submit(text), disabled: busy || !text.trim() || maxLength != null && text.trim().length > maxLength, children: [
|
|
238
|
+
saving ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2ZFSPE4cjs.Icon, { icon: _lucidereact.Loader2, size: "sm", spin: true }) : null,
|
|
239
|
+
copy.submit
|
|
240
|
+
] })
|
|
241
|
+
] })
|
|
242
|
+
] }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
243
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _chunkJ467F76Icjs.Stack, { direction: "vertical", gap: "sm", align: "center", paddingY: "md", children: [
|
|
244
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJDEXZGIYcjs.Button, { type: "button", variant: "outline", size: "voice", "aria-label": copy.voice, disabled: busy, onClick: () => {
|
|
245
|
+
if (!pending.current && !disabled) _optionalChain([onVoice, 'optionalCall', _6 => _6()]);
|
|
246
|
+
}, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkT2ZFSPE4cjs.Icon, { icon: _lucidereact.Mic, size: 28, tone: "muted" }) }),
|
|
247
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunk373W6VADcjs.Text, { variant: "inherit", as: "span", size: "sm", weight: "medium", children: copy.voice }),
|
|
248
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJDEXZGIYcjs.Button, { type: "button", variant: "quiet", size: "bare", disabled: busy, onClick: () => changeEditing(true), children: copy.type })
|
|
249
|
+
] }),
|
|
250
|
+
suggestions.length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJ467F76Icjs.Stack, { direction: "horizontal", gap: "xs", justify: "center", wrap: true, children: suggestions.map((suggestion) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkJDEXZGIYcjs.Button, { type: "button", variant: "outline-muted", size: "suggestion", disabled: busy, onClick: () => void submit(suggestion), children: suggestion }, suggestion)) }) : null
|
|
251
|
+
] })
|
|
252
|
+
] });
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
exports.NoteCard = NoteCard; exports.NoteComposer = NoteComposer; exports.NoteList = NoteList; exports.Notes = Notes;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface NotesEmptyCopy {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
}
|
|
8
|
+
interface NoteListProps extends Omit<HTMLAttributes<HTMLElement>, "title" | "children"> {
|
|
9
|
+
/** How many notes there are. Zero shows the empty state instead of `children`. */
|
|
10
|
+
count: number;
|
|
11
|
+
/** A skeleton row in place of the list, and no count yet. */
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
/** The section heading. */
|
|
14
|
+
title?: ReactNode;
|
|
15
|
+
/** The blank slate's wording. Defaults to "No notes yet". */
|
|
16
|
+
empty?: NotesEmptyCopy;
|
|
17
|
+
/** Below the notes, usually a NoteComposer. */
|
|
18
|
+
composer?: ReactNode;
|
|
19
|
+
/** The notes, usually NoteCards, newest or pinned first. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** The kit PanelSection's divider. */
|
|
22
|
+
border?: "none" | "top" | "bottom";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A notes section, as a counted section: a skeleton row while they
|
|
26
|
+
* load, then the host's note cards, or the kit's empty state when there are
|
|
27
|
+
* none, with the composer underneath so a new note lands below the last.
|
|
28
|
+
*
|
|
29
|
+
* The root is the kit PanelSection, marked `data-slot="note-list"`.
|
|
30
|
+
*/
|
|
31
|
+
declare function NoteList({ count, loading, title, empty, composer, children, border, ...props }: NoteListProps): react_jsx_runtime.JSX.Element;
|
|
32
|
+
/** How a note was left, which picks its glyph: dictated, written by an assistant, or typed. */
|
|
33
|
+
type NoteKind = "voice" | "agent" | "note";
|
|
34
|
+
/** Marks a note that stays at the top of the list and is edited elsewhere. */
|
|
35
|
+
interface NotePinned {
|
|
36
|
+
/** The badge text, such as "Client note · pinned". */
|
|
37
|
+
label: ReactNode;
|
|
38
|
+
/** The badge tooltip, such as where to edit it. */
|
|
39
|
+
title?: string;
|
|
40
|
+
}
|
|
41
|
+
/** The context this note belongs to. */
|
|
42
|
+
interface NoteScope {
|
|
43
|
+
/** The badge text, such as a project name or "General". */
|
|
44
|
+
label: ReactNode;
|
|
45
|
+
/** The badge tooltip. */
|
|
46
|
+
title?: string;
|
|
47
|
+
/** An info-toned badge, for a note tied to a context, instead of the neutral one. */
|
|
48
|
+
highlighted?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface NoteCardLabels {
|
|
51
|
+
/** After the author on a dictated note. Pass `null` to leave it out. */
|
|
52
|
+
voice: ReactNode;
|
|
53
|
+
/** The delete button's tooltip and accessible name. */
|
|
54
|
+
delete: string;
|
|
55
|
+
}
|
|
56
|
+
interface NoteCardProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
57
|
+
/** Who left it, already resolved to a display name. */
|
|
58
|
+
author: ReactNode;
|
|
59
|
+
kind?: NoteKind;
|
|
60
|
+
/** Pins the note: it sits on the card surface, not the muted one, with this badge. */
|
|
61
|
+
pinned?: NotePinned;
|
|
62
|
+
scope?: NoteScope;
|
|
63
|
+
/** When it was left, already formatted. */
|
|
64
|
+
date?: ReactNode;
|
|
65
|
+
/** The note, kept as written: line breaks are preserved. */
|
|
66
|
+
text?: ReactNode;
|
|
67
|
+
/** Adds a delete button. Confirm in the host before deleting anything. */
|
|
68
|
+
onDelete?: () => void;
|
|
69
|
+
/** Whether the delete button is always shown or appears on hover. Use `always` on touch screens. */
|
|
70
|
+
revealDelete?: "always" | "hover";
|
|
71
|
+
labels?: Partial<NoteCardLabels>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* One attributed note: who left it and how, an optional pinned badge, its
|
|
75
|
+
* optional context, when, and the text, with a delete button that appears
|
|
76
|
+
* on hover or always. The host resolves authors and context and confirms
|
|
77
|
+
* deletes.
|
|
78
|
+
*
|
|
79
|
+
* The root is the kit Card and keeps the kit's own `data-slot="card"`, which
|
|
80
|
+
* theme stylesheets select on.
|
|
81
|
+
*/
|
|
82
|
+
declare function NoteCard({ author, kind, pinned, scope, date, text, onDelete, revealDelete, labels, ...props }: NoteCardProps): react_jsx_runtime.JSX.Element;
|
|
83
|
+
/** A display record: hosts resolve identity, context and dates before rendering. */
|
|
84
|
+
interface NoteItem extends Pick<NoteCardProps, "author" | "kind" | "pinned" | "scope" | "date" | "text" | "onDelete" | "revealDelete" | "labels"> {
|
|
85
|
+
id: string | number;
|
|
86
|
+
}
|
|
87
|
+
interface NotesProps extends Omit<NoteListProps, "count" | "children"> {
|
|
88
|
+
/** Displayed in the supplied order. Stable IDs keep each note's identity. */
|
|
89
|
+
notes: readonly NoteItem[];
|
|
90
|
+
}
|
|
91
|
+
/** Reusable notes area. The array owns the count and the rendered cards. */
|
|
92
|
+
declare function Notes({ notes, ...props }: NotesProps): react_jsx_runtime.JSX.Element;
|
|
93
|
+
interface NoteComposerLabels {
|
|
94
|
+
voice: string;
|
|
95
|
+
type: string;
|
|
96
|
+
input: string;
|
|
97
|
+
placeholder: string;
|
|
98
|
+
cancel: string;
|
|
99
|
+
submit: string;
|
|
100
|
+
error: string;
|
|
101
|
+
}
|
|
102
|
+
interface NoteComposerProps extends Omit<HTMLAttributes<HTMLElement>, "children" | "onSubmit" | "onChange"> {
|
|
103
|
+
/** Starts the host's recorder. Without it the composer opens for typing. */
|
|
104
|
+
onVoice?: () => void;
|
|
105
|
+
/** Receives trimmed text. Resolve only once saved; reject to preserve the draft. */
|
|
106
|
+
onSubmit: (text: string) => Promise<void>;
|
|
107
|
+
suggestions?: readonly string[];
|
|
108
|
+
labels?: Partial<NoteComposerLabels>;
|
|
109
|
+
/** Controlled text. In this mode the host clears or replaces it after saving. */
|
|
110
|
+
value?: string;
|
|
111
|
+
onValueChange?: (text: string) => void;
|
|
112
|
+
/** The host can keep a recovered draft open even when its text becomes empty. */
|
|
113
|
+
editing?: boolean;
|
|
114
|
+
onEditingChange?: (editing: boolean) => void;
|
|
115
|
+
onCancel?: () => void;
|
|
116
|
+
disabled?: boolean;
|
|
117
|
+
error?: ReactNode;
|
|
118
|
+
maxLength?: number;
|
|
119
|
+
}
|
|
120
|
+
/** Voice or text composer with one pending save and recoverable drafts. */
|
|
121
|
+
declare function NoteComposer({ onVoice, onSubmit, suggestions, labels, value, onValueChange, editing, onEditingChange, onCancel, disabled, error, maxLength, ...props }: NoteComposerProps): react_jsx_runtime.JSX.Element;
|
|
122
|
+
|
|
123
|
+
export { NoteCard, type NoteCardLabels, type NoteCardProps, NoteComposer, type NoteComposerLabels, type NoteComposerProps, type NoteItem, type NoteKind, NoteList, type NoteListProps, type NotePinned, type NoteScope, Notes, type NotesEmptyCopy, type NotesProps };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface NotesEmptyCopy {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
}
|
|
8
|
+
interface NoteListProps extends Omit<HTMLAttributes<HTMLElement>, "title" | "children"> {
|
|
9
|
+
/** How many notes there are. Zero shows the empty state instead of `children`. */
|
|
10
|
+
count: number;
|
|
11
|
+
/** A skeleton row in place of the list, and no count yet. */
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
/** The section heading. */
|
|
14
|
+
title?: ReactNode;
|
|
15
|
+
/** The blank slate's wording. Defaults to "No notes yet". */
|
|
16
|
+
empty?: NotesEmptyCopy;
|
|
17
|
+
/** Below the notes, usually a NoteComposer. */
|
|
18
|
+
composer?: ReactNode;
|
|
19
|
+
/** The notes, usually NoteCards, newest or pinned first. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
/** The kit PanelSection's divider. */
|
|
22
|
+
border?: "none" | "top" | "bottom";
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* A notes section, as a counted section: a skeleton row while they
|
|
26
|
+
* load, then the host's note cards, or the kit's empty state when there are
|
|
27
|
+
* none, with the composer underneath so a new note lands below the last.
|
|
28
|
+
*
|
|
29
|
+
* The root is the kit PanelSection, marked `data-slot="note-list"`.
|
|
30
|
+
*/
|
|
31
|
+
declare function NoteList({ count, loading, title, empty, composer, children, border, ...props }: NoteListProps): react_jsx_runtime.JSX.Element;
|
|
32
|
+
/** How a note was left, which picks its glyph: dictated, written by an assistant, or typed. */
|
|
33
|
+
type NoteKind = "voice" | "agent" | "note";
|
|
34
|
+
/** Marks a note that stays at the top of the list and is edited elsewhere. */
|
|
35
|
+
interface NotePinned {
|
|
36
|
+
/** The badge text, such as "Client note · pinned". */
|
|
37
|
+
label: ReactNode;
|
|
38
|
+
/** The badge tooltip, such as where to edit it. */
|
|
39
|
+
title?: string;
|
|
40
|
+
}
|
|
41
|
+
/** The context this note belongs to. */
|
|
42
|
+
interface NoteScope {
|
|
43
|
+
/** The badge text, such as a project name or "General". */
|
|
44
|
+
label: ReactNode;
|
|
45
|
+
/** The badge tooltip. */
|
|
46
|
+
title?: string;
|
|
47
|
+
/** An info-toned badge, for a note tied to a context, instead of the neutral one. */
|
|
48
|
+
highlighted?: boolean;
|
|
49
|
+
}
|
|
50
|
+
interface NoteCardLabels {
|
|
51
|
+
/** After the author on a dictated note. Pass `null` to leave it out. */
|
|
52
|
+
voice: ReactNode;
|
|
53
|
+
/** The delete button's tooltip and accessible name. */
|
|
54
|
+
delete: string;
|
|
55
|
+
}
|
|
56
|
+
interface NoteCardProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
57
|
+
/** Who left it, already resolved to a display name. */
|
|
58
|
+
author: ReactNode;
|
|
59
|
+
kind?: NoteKind;
|
|
60
|
+
/** Pins the note: it sits on the card surface, not the muted one, with this badge. */
|
|
61
|
+
pinned?: NotePinned;
|
|
62
|
+
scope?: NoteScope;
|
|
63
|
+
/** When it was left, already formatted. */
|
|
64
|
+
date?: ReactNode;
|
|
65
|
+
/** The note, kept as written: line breaks are preserved. */
|
|
66
|
+
text?: ReactNode;
|
|
67
|
+
/** Adds a delete button. Confirm in the host before deleting anything. */
|
|
68
|
+
onDelete?: () => void;
|
|
69
|
+
/** Whether the delete button is always shown or appears on hover. Use `always` on touch screens. */
|
|
70
|
+
revealDelete?: "always" | "hover";
|
|
71
|
+
labels?: Partial<NoteCardLabels>;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* One attributed note: who left it and how, an optional pinned badge, its
|
|
75
|
+
* optional context, when, and the text, with a delete button that appears
|
|
76
|
+
* on hover or always. The host resolves authors and context and confirms
|
|
77
|
+
* deletes.
|
|
78
|
+
*
|
|
79
|
+
* The root is the kit Card and keeps the kit's own `data-slot="card"`, which
|
|
80
|
+
* theme stylesheets select on.
|
|
81
|
+
*/
|
|
82
|
+
declare function NoteCard({ author, kind, pinned, scope, date, text, onDelete, revealDelete, labels, ...props }: NoteCardProps): react_jsx_runtime.JSX.Element;
|
|
83
|
+
/** A display record: hosts resolve identity, context and dates before rendering. */
|
|
84
|
+
interface NoteItem extends Pick<NoteCardProps, "author" | "kind" | "pinned" | "scope" | "date" | "text" | "onDelete" | "revealDelete" | "labels"> {
|
|
85
|
+
id: string | number;
|
|
86
|
+
}
|
|
87
|
+
interface NotesProps extends Omit<NoteListProps, "count" | "children"> {
|
|
88
|
+
/** Displayed in the supplied order. Stable IDs keep each note's identity. */
|
|
89
|
+
notes: readonly NoteItem[];
|
|
90
|
+
}
|
|
91
|
+
/** Reusable notes area. The array owns the count and the rendered cards. */
|
|
92
|
+
declare function Notes({ notes, ...props }: NotesProps): react_jsx_runtime.JSX.Element;
|
|
93
|
+
interface NoteComposerLabels {
|
|
94
|
+
voice: string;
|
|
95
|
+
type: string;
|
|
96
|
+
input: string;
|
|
97
|
+
placeholder: string;
|
|
98
|
+
cancel: string;
|
|
99
|
+
submit: string;
|
|
100
|
+
error: string;
|
|
101
|
+
}
|
|
102
|
+
interface NoteComposerProps extends Omit<HTMLAttributes<HTMLElement>, "children" | "onSubmit" | "onChange"> {
|
|
103
|
+
/** Starts the host's recorder. Without it the composer opens for typing. */
|
|
104
|
+
onVoice?: () => void;
|
|
105
|
+
/** Receives trimmed text. Resolve only once saved; reject to preserve the draft. */
|
|
106
|
+
onSubmit: (text: string) => Promise<void>;
|
|
107
|
+
suggestions?: readonly string[];
|
|
108
|
+
labels?: Partial<NoteComposerLabels>;
|
|
109
|
+
/** Controlled text. In this mode the host clears or replaces it after saving. */
|
|
110
|
+
value?: string;
|
|
111
|
+
onValueChange?: (text: string) => void;
|
|
112
|
+
/** The host can keep a recovered draft open even when its text becomes empty. */
|
|
113
|
+
editing?: boolean;
|
|
114
|
+
onEditingChange?: (editing: boolean) => void;
|
|
115
|
+
onCancel?: () => void;
|
|
116
|
+
disabled?: boolean;
|
|
117
|
+
error?: ReactNode;
|
|
118
|
+
maxLength?: number;
|
|
119
|
+
}
|
|
120
|
+
/** Voice or text composer with one pending save and recoverable drafts. */
|
|
121
|
+
declare function NoteComposer({ onVoice, onSubmit, suggestions, labels, value, onValueChange, editing, onEditingChange, onCancel, disabled, error, maxLength, ...props }: NoteComposerProps): react_jsx_runtime.JSX.Element;
|
|
122
|
+
|
|
123
|
+
export { NoteCard, type NoteCardLabels, type NoteCardProps, NoteComposer, type NoteComposerLabels, type NoteComposerProps, type NoteItem, type NoteKind, NoteList, type NoteListProps, type NotePinned, type NoteScope, Notes, type NotesEmptyCopy, type NotesProps };
|