@tightknitai/block-kitchen 0.8.1 → 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 CHANGED
@@ -6237,10 +6237,14 @@ function TableEditor({ block, onChange }) {
6237
6237
  ] });
6238
6238
  }
6239
6239
  var STATUSES2 = ["pending", "in_progress", "complete", "error"];
6240
+ var EMPTY_RICH_TEXT = {
6241
+ type: "rich_text",
6242
+ elements: [{ type: "rich_text_section", elements: [{ type: "text", text: "" }] }]
6243
+ };
6240
6244
  function TaskCardEditor({ block, onChange }) {
6241
6245
  const status = block.status ?? "pending";
6242
6246
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
6243
- /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Title", help: "Short label shown at the top of the card.", htmlFor: "task-card-title", children: /* @__PURE__ */ jsxRuntime.jsx(
6247
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Title", help: "Title of the task in plain text.", htmlFor: "task-card-title", children: /* @__PURE__ */ jsxRuntime.jsx(
6244
6248
  Input,
6245
6249
  {
6246
6250
  id: "task-card-title",
@@ -6249,24 +6253,16 @@ function TaskCardEditor({ block, onChange }) {
6249
6253
  onChange: (e) => onChange({ ...block, title: e.target.value })
6250
6254
  }
6251
6255
  ) }),
6252
- /* @__PURE__ */ jsxRuntime.jsx(
6253
- EditorField,
6256
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Task ID", help: "ID for the task.", htmlFor: "task-card-id", children: /* @__PURE__ */ jsxRuntime.jsx(
6257
+ Input,
6254
6258
  {
6255
- label: "Task ID",
6256
- help: "Stable identifier you can reference from interaction payloads.",
6257
- htmlFor: "task-card-id",
6258
- children: /* @__PURE__ */ jsxRuntime.jsx(
6259
- Input,
6260
- {
6261
- id: "task-card-id",
6262
- value: block.task_id,
6263
- placeholder: "e.g. task_1",
6264
- onChange: (e) => onChange({ ...block, task_id: e.target.value })
6265
- }
6266
- )
6259
+ id: "task-card-id",
6260
+ value: block.task_id,
6261
+ placeholder: "e.g. task_1",
6262
+ onChange: (e) => onChange({ ...block, task_id: e.target.value })
6267
6263
  }
6268
- ),
6269
- /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Status", help: "Slack renders a matching status chip on the card.", children: /* @__PURE__ */ jsxRuntime.jsx(
6264
+ ) }),
6265
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Status", help: 'The state of a task. Can be "pending", "in_progress", "complete", or "error".', children: /* @__PURE__ */ jsxRuntime.jsx(
6270
6266
  RadioGroup,
6271
6267
  {
6272
6268
  value: status,
@@ -6278,6 +6274,24 @@ function TaskCardEditor({ block, onChange }) {
6278
6274
  ] }, s))
6279
6275
  }
6280
6276
  ) }),
6277
+ /* @__PURE__ */ jsxRuntime.jsx(
6278
+ RichTextField,
6279
+ {
6280
+ label: "Details",
6281
+ help: "Details of the task in the form of a single rich_text entity.",
6282
+ value: block.details,
6283
+ onChange: (next) => onChange({ ...block, details: next })
6284
+ }
6285
+ ),
6286
+ /* @__PURE__ */ jsxRuntime.jsx(
6287
+ RichTextField,
6288
+ {
6289
+ label: "Output",
6290
+ help: "Output of the task in the form of a single rich_text entity.",
6291
+ value: block.output,
6292
+ onChange: (next) => onChange({ ...block, output: next })
6293
+ }
6294
+ ),
6281
6295
  /* @__PURE__ */ jsxRuntime.jsx(
6282
6296
  SourcesField,
6283
6297
  {
@@ -6287,6 +6301,51 @@ function TaskCardEditor({ block, onChange }) {
6287
6301
  )
6288
6302
  ] });
6289
6303
  }
6304
+ function RichTextField({
6305
+ label,
6306
+ help,
6307
+ value,
6308
+ onChange
6309
+ }) {
6310
+ if (!value) {
6311
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5", children: [
6312
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: label }),
6313
+ /* @__PURE__ */ jsxRuntime.jsxs(
6314
+ Button,
6315
+ {
6316
+ type: "button",
6317
+ size: "sm",
6318
+ variant: "outline",
6319
+ className: "self-start",
6320
+ onClick: () => onChange(EMPTY_RICH_TEXT),
6321
+ children: [
6322
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-3.5 w-3.5" }),
6323
+ " Add ",
6324
+ label.toLowerCase()
6325
+ ]
6326
+ }
6327
+ ),
6328
+ help && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: help })
6329
+ ] });
6330
+ }
6331
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1.5", children: [
6332
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
6333
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: label }),
6334
+ /* @__PURE__ */ jsxRuntime.jsx(
6335
+ "button",
6336
+ {
6337
+ type: "button",
6338
+ "aria-label": `Remove ${label.toLowerCase()}`,
6339
+ onClick: () => onChange(void 0),
6340
+ className: "rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive",
6341
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-3.5 w-3.5" })
6342
+ }
6343
+ )
6344
+ ] }),
6345
+ /* @__PURE__ */ jsxRuntime.jsx(RichTextEditor, { block: value, onChange }),
6346
+ help && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: help })
6347
+ ] });
6348
+ }
6290
6349
  function SourcesField({
6291
6350
  sources,
6292
6351
  onChange
@@ -6300,7 +6359,7 @@ function SourcesField({
6300
6359
  };
6301
6360
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 rounded-md border bg-muted/20 p-3", children: [
6302
6361
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs font-medium text-foreground", children: "Sources" }),
6303
- sources.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "No sources. Add one to cite a document or link beneath the card." }) : null,
6362
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "Array of URL source elements used to generate a response." }),
6304
6363
  sources.map((src, idx) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2 rounded border bg-background p-2", children: [
6305
6364
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
6306
6365
  /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs font-medium text-foreground", children: [