@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.
@@ -1,5 +1,5 @@
1
- import { J as SupportedBlock } from './palette-WZCUVJTn.cjs';
2
- export { K as SupportedBlockType } from './palette-WZCUVJTn.cjs';
1
+ import { L as SupportedBlock } from './palette-5_Tx97Gk.cjs';
2
+ export { N as SupportedBlockType } from './palette-5_Tx97Gk.cjs';
3
3
  import 'react';
4
4
  import 'slack-web-api-client';
5
5
 
package/dist/helpers.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { J as SupportedBlock } from './palette-WZCUVJTn.js';
2
- export { K as SupportedBlockType } from './palette-WZCUVJTn.js';
1
+ import { L as SupportedBlock } from './palette-5_Tx97Gk.js';
2
+ export { N as SupportedBlockType } from './palette-5_Tx97Gk.js';
3
3
  import 'react';
4
4
  import 'slack-web-api-client';
5
5
 
package/dist/index.cjs CHANGED
@@ -1151,6 +1151,49 @@ var defaultPalette = [
1151
1151
  })
1152
1152
  }
1153
1153
  ]
1154
+ },
1155
+ {
1156
+ name: "Container",
1157
+ icon: lucideReact.Container,
1158
+ variants: [
1159
+ {
1160
+ id: "container_collapsible",
1161
+ label: "Collapsible container",
1162
+ factory: () => ({
1163
+ type: "container",
1164
+ title: { type: "plain_text", text: "Bulk update: 2 records selected" },
1165
+ subtitle: { type: "plain_text", text: "Review changes before confirming" },
1166
+ is_collapsible: true,
1167
+ child_blocks: [
1168
+ {
1169
+ type: "section",
1170
+ text: { type: "mrkdwn", text: "*DCW-1024*\nStatus: Open \u2192 Closed" }
1171
+ },
1172
+ { type: "divider" },
1173
+ {
1174
+ type: "section",
1175
+ text: { type: "mrkdwn", text: "*DCW-1025*\nStatus: In Progress \u2192 Closed" }
1176
+ },
1177
+ {
1178
+ type: "actions",
1179
+ elements: [
1180
+ {
1181
+ type: "button",
1182
+ text: { type: "plain_text", text: "Confirm All", emoji: true },
1183
+ style: "primary",
1184
+ action_id: "bulk_confirm"
1185
+ },
1186
+ {
1187
+ type: "button",
1188
+ text: { type: "plain_text", text: "Cancel", emoji: true },
1189
+ action_id: "bulk_cancel"
1190
+ }
1191
+ ]
1192
+ }
1193
+ ]
1194
+ })
1195
+ }
1196
+ ]
1154
1197
  }
1155
1198
  ];
1156
1199
  var legacyInputVariants = [
@@ -1631,6 +1674,8 @@ function labelForBlockType(type) {
1631
1674
  return "Task Card";
1632
1675
  case "data_visualization":
1633
1676
  return "Data Visualization";
1677
+ case "container":
1678
+ return "Container";
1634
1679
  }
1635
1680
  }
1636
1681
  function cn(...inputs) {
@@ -3545,6 +3590,160 @@ function CarouselEditor({ block, onChange }) {
3545
3590
  ] })
3546
3591
  ] });
3547
3592
  }
3593
+ var MAX_CHILDREN = 10;
3594
+ var WIDTHS = ["narrow", "standard", "wide", "full"];
3595
+ function ContainerEditor({ block, onChange }) {
3596
+ const children = block.child_blocks ?? [];
3597
+ const iconUrl = block.icon && "image_url" in block.icon ? block.icon.image_url ?? "" : "";
3598
+ const iconAlt = block.icon?.alt_text ?? "";
3599
+ const removeChildAt = (idx) => {
3600
+ onChange({ ...block, child_blocks: children.filter((_, i) => i !== idx) });
3601
+ };
3602
+ const addChild = () => {
3603
+ const child = {
3604
+ type: "section",
3605
+ text: { type: "mrkdwn", text: "New block." }
3606
+ };
3607
+ onChange({ ...block, child_blocks: [...children, child] });
3608
+ };
3609
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-4", children: [
3610
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Title", help: "Heading shown at the top of the container.", htmlFor: "container-title", children: /* @__PURE__ */ jsxRuntime.jsx(
3611
+ Input,
3612
+ {
3613
+ id: "container-title",
3614
+ value: block.title?.text ?? "",
3615
+ maxLength: 150,
3616
+ placeholder: "e.g. Bulk update: 2 records selected",
3617
+ onChange: (e) => onChange({ ...block, title: { type: "plain_text", text: e.target.value } })
3618
+ }
3619
+ ) }),
3620
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Subtitle", help: "Optional secondary line under the title.", htmlFor: "container-subtitle", children: /* @__PURE__ */ jsxRuntime.jsx(
3621
+ Input,
3622
+ {
3623
+ id: "container-subtitle",
3624
+ value: block.subtitle?.text ?? "",
3625
+ maxLength: 150,
3626
+ placeholder: "e.g. Review changes before confirming",
3627
+ onChange: (e) => onChange({
3628
+ ...block,
3629
+ subtitle: e.target.value ? { type: "plain_text", text: e.target.value } : void 0
3630
+ })
3631
+ }
3632
+ ) }),
3633
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Icon URL", help: "Optional image shown left of the title.", htmlFor: "container-icon", children: /* @__PURE__ */ jsxRuntime.jsx(
3634
+ Input,
3635
+ {
3636
+ id: "container-icon",
3637
+ type: "url",
3638
+ value: iconUrl,
3639
+ placeholder: "https://example.com/icon.png",
3640
+ onChange: (e) => onChange({
3641
+ ...block,
3642
+ icon: e.target.value ? { type: "image", image_url: e.target.value, alt_text: iconAlt || "Container icon" } : void 0
3643
+ })
3644
+ }
3645
+ ) }),
3646
+ /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Width", help: "How wide the container renders in the message.", children: /* @__PURE__ */ jsxRuntime.jsx(
3647
+ RadioGroup,
3648
+ {
3649
+ value: block.width ?? "standard",
3650
+ onValueChange: (v) => onChange({ ...block, width: v }),
3651
+ className: "flex flex-row flex-wrap gap-3",
3652
+ children: WIDTHS.map((w) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
3653
+ /* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value: w, id: `container-width-${w}` }),
3654
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: `container-width-${w}`, className: "text-xs capitalize", children: w })
3655
+ ] }, w))
3656
+ }
3657
+ ) }),
3658
+ /* @__PURE__ */ jsxRuntime.jsx(
3659
+ Checkbox,
3660
+ {
3661
+ id: "container-collapsible",
3662
+ label: "Collapsible",
3663
+ help: "Let readers expand and collapse the container.",
3664
+ checked: !!block.is_collapsible,
3665
+ onChange: (checked) => onChange({
3666
+ ...block,
3667
+ is_collapsible: checked || void 0,
3668
+ default_collapsed: checked ? block.default_collapsed : void 0
3669
+ })
3670
+ }
3671
+ ),
3672
+ /* @__PURE__ */ jsxRuntime.jsx(
3673
+ Checkbox,
3674
+ {
3675
+ id: "container-default-collapsed",
3676
+ label: "Collapsed by default",
3677
+ help: "Start collapsed on first render. Requires Collapsible.",
3678
+ checked: !!block.default_collapsed,
3679
+ disabled: !block.is_collapsible,
3680
+ onChange: (checked) => onChange({ ...block, default_collapsed: checked || void 0 })
3681
+ }
3682
+ ),
3683
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-2", children: [
3684
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { children: "Child blocks" }),
3685
+ /* @__PURE__ */ jsxRuntime.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." }),
3686
+ children.map((child, idx) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-2 rounded-md border bg-muted/20 px-3 py-2", children: [
3687
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-xs font-medium text-foreground", children: [
3688
+ idx + 1,
3689
+ ". ",
3690
+ labelForBlockType(child.type)
3691
+ ] }),
3692
+ /* @__PURE__ */ jsxRuntime.jsx(
3693
+ "button",
3694
+ {
3695
+ type: "button",
3696
+ "aria-label": "Remove child block",
3697
+ onClick: () => removeChildAt(idx),
3698
+ disabled: children.length <= 1,
3699
+ className: "rounded p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive disabled:cursor-not-allowed disabled:opacity-40",
3700
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { className: "h-3.5 w-3.5" })
3701
+ }
3702
+ )
3703
+ ] }, idx)),
3704
+ /* @__PURE__ */ jsxRuntime.jsxs(
3705
+ Button,
3706
+ {
3707
+ type: "button",
3708
+ size: "sm",
3709
+ onClick: addChild,
3710
+ disabled: children.length >= MAX_CHILDREN,
3711
+ className: "self-start",
3712
+ children: [
3713
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { className: "h-3.5 w-3.5" }),
3714
+ " Add block"
3715
+ ]
3716
+ }
3717
+ )
3718
+ ] })
3719
+ ] });
3720
+ }
3721
+ function Checkbox({
3722
+ id,
3723
+ label,
3724
+ help,
3725
+ checked,
3726
+ disabled,
3727
+ onChange
3728
+ }) {
3729
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-1", children: [
3730
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
3731
+ /* @__PURE__ */ jsxRuntime.jsx(
3732
+ "input",
3733
+ {
3734
+ id,
3735
+ type: "checkbox",
3736
+ checked,
3737
+ disabled,
3738
+ onChange: (e) => onChange(e.target.checked),
3739
+ className: "h-3.5 w-3.5 cursor-pointer rounded border-input disabled:cursor-not-allowed disabled:opacity-40"
3740
+ }
3741
+ ),
3742
+ /* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: id, className: "cursor-pointer text-xs", children: label })
3743
+ ] }),
3744
+ help ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ml-5 text-[11px] leading-snug text-muted-foreground", children: help }) : null
3745
+ ] });
3746
+ }
3548
3747
  var MAX_ELEMENTS = 5;
3549
3748
  function ContextActionsEditor({ block, onChange }) {
3550
3749
  const elements = block.elements ?? [];
@@ -7714,6 +7913,8 @@ function dispatch(block, onChange) {
7714
7913
  return /* @__PURE__ */ jsxRuntime.jsx(TaskCardEditor, { block, onChange: (next) => onChange(next) });
7715
7914
  case "data_visualization":
7716
7915
  return /* @__PURE__ */ jsxRuntime.jsx(DataVisualizationEditor, { block, onChange: (next) => onChange(next) });
7916
+ case "container":
7917
+ return /* @__PURE__ */ jsxRuntime.jsx(ContainerEditor, { block, onChange: (next) => onChange(next) });
7717
7918
  default:
7718
7919
  return null;
7719
7920
  }
@@ -7790,7 +7991,8 @@ var BLOCK_TYPE_LABELS = {
7790
7991
  video: "Video",
7791
7992
  plan: "Plan",
7792
7993
  task_card: "Task Card",
7793
- data_visualization: "Data Visualization"
7994
+ data_visualization: "Data Visualization",
7995
+ container: "Container"
7794
7996
  };
7795
7997
  function BlockRow({
7796
7998
  builderBlock,