@tightknitai/block-kitchen 0.8.7 → 0.8.8

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.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
- import { B as BlockKitchenProps, U as Template, y as PreviewSurface, z as PreviewTheme } from './palette-WZCUVJTn.cjs';
3
- export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContextActionsBlock, o as ContextActionsElement, p as CustomEmoji, D as DataVisualizationBlock, F as FeedbackButtonSubobject, q as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, r as IconButtonIcon, s as InputBlock, M as MarkdownBlock, P as PaletteSection, t as PaletteVariant, u as PieChart, v as PieChartSegment, w as PlanBlock, x as PreviewHooks, S as SendAsUserStatus, E as SendPayload, G as SendResult, J as SupportedBlock, K as SupportedBlockType, L as SupportedHeaderBlock, T as TableBlock, N as TableCell, O as TableColumnSetting, Q as TaskCardBlock, R as TaskCardStatus, V as UrlSourceElement, W as VideoBlock, Y as defaultPalette, Z as extraAlertVariant, _ as legacyInputVariants } from './palette-WZCUVJTn.cjs';
2
+ import { B as BlockKitchenProps, W as Template, E as PreviewSurface, G as PreviewTheme } from './palette-5_Tx97Gk.cjs';
3
+ export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContainerBlock, o as ContainerChildBlock, p as ContextActionsBlock, q as ContextActionsElement, r as CustomEmoji, D as DataVisualizationBlock, F as FeedbackButtonSubobject, s as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, t as IconButtonIcon, u as InputBlock, M as MarkdownBlock, P as PaletteSection, v as PaletteVariant, w as PieChart, x as PieChartSegment, y as PlanBlock, z as PreviewHooks, S as SendAsUserStatus, J as SendPayload, K as SendResult, L as SupportedBlock, N as SupportedBlockType, O as SupportedHeaderBlock, T as TableBlock, Q as TableCell, R as TableColumnSetting, U as TaskCardBlock, V as TaskCardStatus, X as UrlSourceElement, Y as VideoBlock, _ as defaultPalette, $ as extraAlertVariant, a0 as legacyInputVariants } from './palette-5_Tx97Gk.cjs';
4
4
  export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.cjs';
5
5
  import 'slack-web-api-client';
6
6
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
- import { B as BlockKitchenProps, U as Template, y as PreviewSurface, z as PreviewTheme } from './palette-WZCUVJTn.js';
3
- export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContextActionsBlock, o as ContextActionsElement, p as CustomEmoji, D as DataVisualizationBlock, F as FeedbackButtonSubobject, q as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, r as IconButtonIcon, s as InputBlock, M as MarkdownBlock, P as PaletteSection, t as PaletteVariant, u as PieChart, v as PieChartSegment, w as PlanBlock, x as PreviewHooks, S as SendAsUserStatus, E as SendPayload, G as SendResult, J as SupportedBlock, K as SupportedBlockType, L as SupportedHeaderBlock, T as TableBlock, N as TableCell, O as TableColumnSetting, Q as TaskCardBlock, R as TaskCardStatus, V as UrlSourceElement, W as VideoBlock, Y as defaultPalette, Z as extraAlertVariant, _ as legacyInputVariants } from './palette-WZCUVJTn.js';
2
+ import { B as BlockKitchenProps, W as Template, E as PreviewSurface, G as PreviewTheme } from './palette-5_Tx97Gk.js';
3
+ export { A as AlertBlock, a as AlertLevel, b as BrandPreset, c as BrandTheme, d as BrandTokens, e as BuilderBlock, C as CardBlock, f as CarouselBlock, g as CartesianChart, h as ChannelOption, i as Chart, j as ChartAxisConfig, k as ChartDataPoint, l as ChartSeries, m as ChartType, n as ContainerBlock, o as ContainerChildBlock, p as ContextActionsBlock, q as ContextActionsElement, r as CustomEmoji, D as DataVisualizationBlock, F as FeedbackButtonSubobject, s as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, t as IconButtonIcon, u as InputBlock, M as MarkdownBlock, P as PaletteSection, v as PaletteVariant, w as PieChart, x as PieChartSegment, y as PlanBlock, z as PreviewHooks, S as SendAsUserStatus, J as SendPayload, K as SendResult, L as SupportedBlock, N as SupportedBlockType, O as SupportedHeaderBlock, T as TableBlock, Q as TableCell, R as TableColumnSetting, U as TaskCardBlock, V as TaskCardStatus, X as UrlSourceElement, Y as VideoBlock, _ as defaultPalette, $ as extraAlertVariant, a0 as legacyInputVariants } from './palette-5_Tx97Gk.js';
4
4
  export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.js';
5
5
  import 'slack-web-api-client';
6
6
 
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { useSensors, useSensor, PointerSensor, TouchSensor, KeyboardSensor, pointerWithin, closestCenter, DndContext, DragOverlay, useDroppable, useDraggable } from '@dnd-kit/core';
2
2
  import { sortableKeyboardCoordinates, SortableContext, verticalListSortingStrategy, useSortable } from '@dnd-kit/sortable';
3
- import { X, Circle, Sparkles, FileText, AlignLeft, MousePointerClick, TextCursorInput, LayoutTemplate, Bell, Pilcrow, Image, Video, GalleryHorizontal, Table, ChartColumnBig, GripVertical, Sun, Moon, MessageSquare, AppWindow, Home, Plus, ChevronDown, BookOpen, ExternalLink, AlertTriangle, Trash2, Code2, MoreHorizontal, Send, Search, CheckCircle2, Check, ChevronRight, LayoutGrid, ArrowUp, ArrowDown, Pencil, Copy, Type, Bold, Italic, Strikethrough, Underline, Code, List, ListOrdered, Quote, Undo2, Redo2, Link as Link$1, Smile } from 'lucide-react';
3
+ import { X, Circle, Sparkles, FileText, AlignLeft, MousePointerClick, TextCursorInput, LayoutTemplate, Bell, Pilcrow, Image, Video, GalleryHorizontal, Table, ChartColumnBig, Container, GripVertical, Sun, Moon, MessageSquare, AppWindow, Home, Plus, ChevronDown, BookOpen, ExternalLink, AlertTriangle, Trash2, Code2, MoreHorizontal, Send, Search, CheckCircle2, Check, ChevronRight, LayoutGrid, ArrowUp, ArrowDown, Pencil, Copy, Type, Bold, Italic, Strikethrough, Underline, Code, List, ListOrdered, Quote, Undo2, Redo2, Link as Link$1, Smile } from 'lucide-react';
4
4
  import * as React from 'react';
5
5
  import { createContext, useMemo, useState, useCallback, useRef, useEffect, useId, useContext } from 'react';
6
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
@@ -1121,6 +1121,49 @@ var defaultPalette = [
1121
1121
  })
1122
1122
  }
1123
1123
  ]
1124
+ },
1125
+ {
1126
+ name: "Container",
1127
+ icon: Container,
1128
+ variants: [
1129
+ {
1130
+ id: "container_collapsible",
1131
+ label: "Collapsible container",
1132
+ factory: () => ({
1133
+ type: "container",
1134
+ title: { type: "plain_text", text: "Bulk update: 2 records selected" },
1135
+ subtitle: { type: "plain_text", text: "Review changes before confirming" },
1136
+ is_collapsible: true,
1137
+ child_blocks: [
1138
+ {
1139
+ type: "section",
1140
+ text: { type: "mrkdwn", text: "*DCW-1024*\nStatus: Open \u2192 Closed" }
1141
+ },
1142
+ { type: "divider" },
1143
+ {
1144
+ type: "section",
1145
+ text: { type: "mrkdwn", text: "*DCW-1025*\nStatus: In Progress \u2192 Closed" }
1146
+ },
1147
+ {
1148
+ type: "actions",
1149
+ elements: [
1150
+ {
1151
+ type: "button",
1152
+ text: { type: "plain_text", text: "Confirm All", emoji: true },
1153
+ style: "primary",
1154
+ action_id: "bulk_confirm"
1155
+ },
1156
+ {
1157
+ type: "button",
1158
+ text: { type: "plain_text", text: "Cancel", emoji: true },
1159
+ action_id: "bulk_cancel"
1160
+ }
1161
+ ]
1162
+ }
1163
+ ]
1164
+ })
1165
+ }
1166
+ ]
1124
1167
  }
1125
1168
  ];
1126
1169
  var legacyInputVariants = [
@@ -1601,6 +1644,8 @@ function labelForBlockType(type) {
1601
1644
  return "Task Card";
1602
1645
  case "data_visualization":
1603
1646
  return "Data Visualization";
1647
+ case "container":
1648
+ return "Container";
1604
1649
  }
1605
1650
  }
1606
1651
  function cn(...inputs) {
@@ -3515,6 +3560,160 @@ function CarouselEditor({ block, onChange }) {
3515
3560
  ] })
3516
3561
  ] });
3517
3562
  }
3563
+ var MAX_CHILDREN = 10;
3564
+ var WIDTHS = ["narrow", "standard", "wide", "full"];
3565
+ function ContainerEditor({ block, onChange }) {
3566
+ const children = block.child_blocks ?? [];
3567
+ const iconUrl = block.icon && "image_url" in block.icon ? block.icon.image_url ?? "" : "";
3568
+ const iconAlt = block.icon?.alt_text ?? "";
3569
+ const removeChildAt = (idx) => {
3570
+ onChange({ ...block, child_blocks: children.filter((_, i) => i !== idx) });
3571
+ };
3572
+ const addChild = () => {
3573
+ const child = {
3574
+ type: "section",
3575
+ text: { type: "mrkdwn", text: "New block." }
3576
+ };
3577
+ onChange({ ...block, child_blocks: [...children, child] });
3578
+ };
3579
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
3580
+ /* @__PURE__ */ jsx(EditorField, { label: "Title", help: "Heading shown at the top of the container.", htmlFor: "container-title", children: /* @__PURE__ */ jsx(
3581
+ Input,
3582
+ {
3583
+ id: "container-title",
3584
+ value: block.title?.text ?? "",
3585
+ maxLength: 150,
3586
+ placeholder: "e.g. Bulk update: 2 records selected",
3587
+ onChange: (e) => onChange({ ...block, title: { type: "plain_text", text: e.target.value } })
3588
+ }
3589
+ ) }),
3590
+ /* @__PURE__ */ jsx(EditorField, { label: "Subtitle", help: "Optional secondary line under the title.", htmlFor: "container-subtitle", children: /* @__PURE__ */ jsx(
3591
+ Input,
3592
+ {
3593
+ id: "container-subtitle",
3594
+ value: block.subtitle?.text ?? "",
3595
+ maxLength: 150,
3596
+ placeholder: "e.g. Review changes before confirming",
3597
+ onChange: (e) => onChange({
3598
+ ...block,
3599
+ subtitle: e.target.value ? { type: "plain_text", text: e.target.value } : void 0
3600
+ })
3601
+ }
3602
+ ) }),
3603
+ /* @__PURE__ */ jsx(EditorField, { label: "Icon URL", help: "Optional image shown left of the title.", htmlFor: "container-icon", children: /* @__PURE__ */ jsx(
3604
+ Input,
3605
+ {
3606
+ id: "container-icon",
3607
+ type: "url",
3608
+ value: iconUrl,
3609
+ placeholder: "https://example.com/icon.png",
3610
+ onChange: (e) => onChange({
3611
+ ...block,
3612
+ icon: e.target.value ? { type: "image", image_url: e.target.value, alt_text: iconAlt || "Container icon" } : void 0
3613
+ })
3614
+ }
3615
+ ) }),
3616
+ /* @__PURE__ */ jsx(EditorField, { label: "Width", help: "How wide the container renders in the message.", children: /* @__PURE__ */ jsx(
3617
+ RadioGroup,
3618
+ {
3619
+ value: block.width ?? "standard",
3620
+ onValueChange: (v) => onChange({ ...block, width: v }),
3621
+ className: "flex flex-row flex-wrap gap-3",
3622
+ children: WIDTHS.map((w) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
3623
+ /* @__PURE__ */ jsx(RadioGroupItem, { value: w, id: `container-width-${w}` }),
3624
+ /* @__PURE__ */ jsx(Label, { htmlFor: `container-width-${w}`, className: "text-xs capitalize", children: w })
3625
+ ] }, w))
3626
+ }
3627
+ ) }),
3628
+ /* @__PURE__ */ jsx(
3629
+ Checkbox,
3630
+ {
3631
+ id: "container-collapsible",
3632
+ label: "Collapsible",
3633
+ help: "Let readers expand and collapse the container.",
3634
+ checked: !!block.is_collapsible,
3635
+ onChange: (checked) => onChange({
3636
+ ...block,
3637
+ is_collapsible: checked || void 0,
3638
+ default_collapsed: checked ? block.default_collapsed : void 0
3639
+ })
3640
+ }
3641
+ ),
3642
+ /* @__PURE__ */ jsx(
3643
+ Checkbox,
3644
+ {
3645
+ id: "container-default-collapsed",
3646
+ label: "Collapsed by default",
3647
+ help: "Start collapsed on first render. Requires Collapsible.",
3648
+ checked: !!block.default_collapsed,
3649
+ disabled: !block.is_collapsible,
3650
+ onChange: (checked) => onChange({ ...block, default_collapsed: checked || void 0 })
3651
+ }
3652
+ ),
3653
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-2", children: [
3654
+ /* @__PURE__ */ jsx(Label, { children: "Child blocks" }),
3655
+ /* @__PURE__ */ jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "A container holds 1-10 blocks. To edit a child's content, use the View JSON drawer." }),
3656
+ children.map((child, idx) => /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 rounded-md border bg-muted/20 px-3 py-2", children: [
3657
+ /* @__PURE__ */ jsxs("span", { className: "text-xs font-medium text-foreground", children: [
3658
+ idx + 1,
3659
+ ". ",
3660
+ labelForBlockType(child.type)
3661
+ ] }),
3662
+ /* @__PURE__ */ jsx(
3663
+ "button",
3664
+ {
3665
+ type: "button",
3666
+ "aria-label": "Remove child block",
3667
+ onClick: () => removeChildAt(idx),
3668
+ disabled: children.length <= 1,
3669
+ className: "rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive disabled:cursor-not-allowed disabled:opacity-40",
3670
+ children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" })
3671
+ }
3672
+ )
3673
+ ] }, idx)),
3674
+ /* @__PURE__ */ jsxs(
3675
+ Button,
3676
+ {
3677
+ type: "button",
3678
+ size: "sm",
3679
+ onClick: addChild,
3680
+ disabled: children.length >= MAX_CHILDREN,
3681
+ className: "self-start",
3682
+ children: [
3683
+ /* @__PURE__ */ jsx(Plus, { className: "h-3.5 w-3.5" }),
3684
+ " Add block"
3685
+ ]
3686
+ }
3687
+ )
3688
+ ] })
3689
+ ] });
3690
+ }
3691
+ function Checkbox({
3692
+ id,
3693
+ label,
3694
+ help,
3695
+ checked,
3696
+ disabled,
3697
+ onChange
3698
+ }) {
3699
+ return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1", children: [
3700
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
3701
+ /* @__PURE__ */ jsx(
3702
+ "input",
3703
+ {
3704
+ id,
3705
+ type: "checkbox",
3706
+ checked,
3707
+ disabled,
3708
+ onChange: (e) => onChange(e.target.checked),
3709
+ className: "h-3.5 w-3.5 cursor-pointer rounded border-input disabled:cursor-not-allowed disabled:opacity-40"
3710
+ }
3711
+ ),
3712
+ /* @__PURE__ */ jsx(Label, { htmlFor: id, className: "cursor-pointer text-xs", children: label })
3713
+ ] }),
3714
+ help ? /* @__PURE__ */ jsx("p", { className: "ml-5 text-[11px] leading-snug text-muted-foreground", children: help }) : null
3715
+ ] });
3716
+ }
3518
3717
  var MAX_ELEMENTS = 5;
3519
3718
  function ContextActionsEditor({ block, onChange }) {
3520
3719
  const elements = block.elements ?? [];
@@ -7684,6 +7883,8 @@ function dispatch(block, onChange) {
7684
7883
  return /* @__PURE__ */ jsx(TaskCardEditor, { block, onChange: (next) => onChange(next) });
7685
7884
  case "data_visualization":
7686
7885
  return /* @__PURE__ */ jsx(DataVisualizationEditor, { block, onChange: (next) => onChange(next) });
7886
+ case "container":
7887
+ return /* @__PURE__ */ jsx(ContainerEditor, { block, onChange: (next) => onChange(next) });
7687
7888
  default:
7688
7889
  return null;
7689
7890
  }
@@ -7760,7 +7961,8 @@ var BLOCK_TYPE_LABELS = {
7760
7961
  video: "Video",
7761
7962
  plan: "Plan",
7762
7963
  task_card: "Task Card",
7763
- data_visualization: "Data Visualization"
7964
+ data_visualization: "Data Visualization",
7965
+ container: "Container"
7764
7966
  };
7765
7967
  function BlockRow({
7766
7968
  builderBlock,