@tightknitai/block-kitchen 0.8.2 → 0.8.3
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/dist/index.cjs +77 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +77 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6207,10 +6207,14 @@ function TableEditor({ block, onChange }) {
|
|
|
6207
6207
|
] });
|
|
6208
6208
|
}
|
|
6209
6209
|
var STATUSES2 = ["pending", "in_progress", "complete", "error"];
|
|
6210
|
+
var EMPTY_RICH_TEXT = {
|
|
6211
|
+
type: "rich_text",
|
|
6212
|
+
elements: [{ type: "rich_text_section", elements: [{ type: "text", text: "" }] }]
|
|
6213
|
+
};
|
|
6210
6214
|
function TaskCardEditor({ block, onChange }) {
|
|
6211
6215
|
const status = block.status ?? "pending";
|
|
6212
6216
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
6213
|
-
/* @__PURE__ */ jsx(EditorField, { label: "Title", help: "
|
|
6217
|
+
/* @__PURE__ */ jsx(EditorField, { label: "Title", help: "Title of the task in plain text.", htmlFor: "task-card-title", children: /* @__PURE__ */ jsx(
|
|
6214
6218
|
Input,
|
|
6215
6219
|
{
|
|
6216
6220
|
id: "task-card-title",
|
|
@@ -6219,24 +6223,16 @@ function TaskCardEditor({ block, onChange }) {
|
|
|
6219
6223
|
onChange: (e) => onChange({ ...block, title: e.target.value })
|
|
6220
6224
|
}
|
|
6221
6225
|
) }),
|
|
6222
|
-
/* @__PURE__ */ jsx(
|
|
6223
|
-
|
|
6226
|
+
/* @__PURE__ */ jsx(EditorField, { label: "Task ID", help: "ID for the task.", htmlFor: "task-card-id", children: /* @__PURE__ */ jsx(
|
|
6227
|
+
Input,
|
|
6224
6228
|
{
|
|
6225
|
-
|
|
6226
|
-
|
|
6227
|
-
|
|
6228
|
-
|
|
6229
|
-
Input,
|
|
6230
|
-
{
|
|
6231
|
-
id: "task-card-id",
|
|
6232
|
-
value: block.task_id,
|
|
6233
|
-
placeholder: "e.g. task_1",
|
|
6234
|
-
onChange: (e) => onChange({ ...block, task_id: e.target.value })
|
|
6235
|
-
}
|
|
6236
|
-
)
|
|
6229
|
+
id: "task-card-id",
|
|
6230
|
+
value: block.task_id,
|
|
6231
|
+
placeholder: "e.g. task_1",
|
|
6232
|
+
onChange: (e) => onChange({ ...block, task_id: e.target.value })
|
|
6237
6233
|
}
|
|
6238
|
-
),
|
|
6239
|
-
/* @__PURE__ */ jsx(EditorField, { label: "Status", help:
|
|
6234
|
+
) }),
|
|
6235
|
+
/* @__PURE__ */ jsx(EditorField, { label: "Status", help: 'The state of a task. Can be "pending", "in_progress", "complete", or "error".', children: /* @__PURE__ */ jsx(
|
|
6240
6236
|
RadioGroup,
|
|
6241
6237
|
{
|
|
6242
6238
|
value: status,
|
|
@@ -6248,6 +6244,24 @@ function TaskCardEditor({ block, onChange }) {
|
|
|
6248
6244
|
] }, s))
|
|
6249
6245
|
}
|
|
6250
6246
|
) }),
|
|
6247
|
+
/* @__PURE__ */ jsx(
|
|
6248
|
+
RichTextField,
|
|
6249
|
+
{
|
|
6250
|
+
label: "Details",
|
|
6251
|
+
help: "Details of the task in the form of a single rich_text entity.",
|
|
6252
|
+
value: block.details,
|
|
6253
|
+
onChange: (next) => onChange({ ...block, details: next })
|
|
6254
|
+
}
|
|
6255
|
+
),
|
|
6256
|
+
/* @__PURE__ */ jsx(
|
|
6257
|
+
RichTextField,
|
|
6258
|
+
{
|
|
6259
|
+
label: "Output",
|
|
6260
|
+
help: "Output of the task in the form of a single rich_text entity.",
|
|
6261
|
+
value: block.output,
|
|
6262
|
+
onChange: (next) => onChange({ ...block, output: next })
|
|
6263
|
+
}
|
|
6264
|
+
),
|
|
6251
6265
|
/* @__PURE__ */ jsx(
|
|
6252
6266
|
SourcesField,
|
|
6253
6267
|
{
|
|
@@ -6257,6 +6271,51 @@ function TaskCardEditor({ block, onChange }) {
|
|
|
6257
6271
|
)
|
|
6258
6272
|
] });
|
|
6259
6273
|
}
|
|
6274
|
+
function RichTextField({
|
|
6275
|
+
label,
|
|
6276
|
+
help,
|
|
6277
|
+
value,
|
|
6278
|
+
onChange
|
|
6279
|
+
}) {
|
|
6280
|
+
if (!value) {
|
|
6281
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
6282
|
+
/* @__PURE__ */ jsx(Label, { children: label }),
|
|
6283
|
+
/* @__PURE__ */ jsxs(
|
|
6284
|
+
Button,
|
|
6285
|
+
{
|
|
6286
|
+
type: "button",
|
|
6287
|
+
size: "sm",
|
|
6288
|
+
variant: "outline",
|
|
6289
|
+
className: "self-start",
|
|
6290
|
+
onClick: () => onChange(EMPTY_RICH_TEXT),
|
|
6291
|
+
children: [
|
|
6292
|
+
/* @__PURE__ */ jsx(Plus, { className: "h-3.5 w-3.5" }),
|
|
6293
|
+
" Add ",
|
|
6294
|
+
label.toLowerCase()
|
|
6295
|
+
]
|
|
6296
|
+
}
|
|
6297
|
+
),
|
|
6298
|
+
help && /* @__PURE__ */ jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: help })
|
|
6299
|
+
] });
|
|
6300
|
+
}
|
|
6301
|
+
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
6302
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
6303
|
+
/* @__PURE__ */ jsx(Label, { children: label }),
|
|
6304
|
+
/* @__PURE__ */ jsx(
|
|
6305
|
+
"button",
|
|
6306
|
+
{
|
|
6307
|
+
type: "button",
|
|
6308
|
+
"aria-label": `Remove ${label.toLowerCase()}`,
|
|
6309
|
+
onClick: () => onChange(void 0),
|
|
6310
|
+
className: "rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",
|
|
6311
|
+
children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
|
|
6312
|
+
}
|
|
6313
|
+
)
|
|
6314
|
+
] }),
|
|
6315
|
+
/* @__PURE__ */ jsx(RichTextEditor, { block: value, onChange }),
|
|
6316
|
+
help && /* @__PURE__ */ jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: help })
|
|
6317
|
+
] });
|
|
6318
|
+
}
|
|
6260
6319
|
function SourcesField({
|
|
6261
6320
|
sources,
|
|
6262
6321
|
onChange
|
|
@@ -6270,7 +6329,7 @@ function SourcesField({
|
|
|
6270
6329
|
};
|
|
6271
6330
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 rounded-md border bg-muted/20 p-3", children: [
|
|
6272
6331
|
/* @__PURE__ */ jsx("span", { className: "text-xs font-medium text-foreground", children: "Sources" }),
|
|
6273
|
-
|
|
6332
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "Array of URL source elements used to generate a response." }),
|
|
6274
6333
|
sources.map((src, idx) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2 rounded border bg-background p-2", children: [
|
|
6275
6334
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
6276
6335
|
/* @__PURE__ */ jsxs("span", { className: "text-xs font-medium text-foreground", children: [
|