@tightknitai/block-kitchen 0.8.7 → 0.8.9

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.
@@ -151,7 +151,7 @@ declare function buildVariantById(sections: readonly PaletteSection[]): Readonly
151
151
  /**
152
152
  * The Slack Block Kit block types supported by the builder in v1.
153
153
  */
154
- type SupportedBlockType = 'section' | 'header' | 'divider' | 'context' | 'actions' | 'image' | 'markdown' | 'rich_text' | 'table' | 'alert' | 'card' | 'carousel' | 'context_actions' | 'input' | 'video' | 'plan' | 'task_card' | 'data_visualization';
154
+ type SupportedBlockType = 'section' | 'header' | 'divider' | 'context' | 'actions' | 'image' | 'markdown' | 'rich_text' | 'table' | 'alert' | 'card' | 'carousel' | 'context_actions' | 'input' | 'video' | 'plan' | 'task_card' | 'data_visualization' | 'container';
155
155
  /**
156
156
  * Slack `markdown` block payload. Renders standard markdown (GFM)
157
157
  * via `slack-blocks-to-jsx`'s react-markdown integration.
@@ -473,6 +473,46 @@ interface DataVisualizationBlock {
473
473
  chart: Chart;
474
474
  block_id?: string;
475
475
  }
476
+ /**
477
+ * A block allowed inside a {@link ContainerBlock}'s `child_blocks` array.
478
+ * Slack permits actions, context, divider, file, header, image, input,
479
+ * rich_text, section, table, and video — notably not `container` itself
480
+ * (no nesting) nor message-only chrome like card / carousel / markdown.
481
+ * This mirrors that set across the block types the builder models (`file`
482
+ * is omitted because the builder has no file block).
483
+ * @see https://docs.slack.dev/reference/block-kit/blocks/container-block
484
+ */
485
+ type ContainerChildBlock = SectionBlock | SupportedHeaderBlock | DividerBlock | ContextBlock | ActionsBlock | ImageBlock | RichTextBlock | TableBlock | InputBlock | VideoBlock;
486
+ /**
487
+ * Slack `container` block payload. A general-purpose wrapper that groups
488
+ * 1-10 child blocks into a single, optionally collapsible unit with a
489
+ * configurable width. Valid on the message surface only.
490
+ * `default_collapsed` only takes effect when `is_collapsible` is true.
491
+ *
492
+ * Note: despite what the API reference says, `title` and `subtitle` are
493
+ * `plain_text` text objects, not plain strings. `slack-web-api-client`
494
+ * doesn't ship this type yet, so we declare it.
495
+ * @see https://docs.slack.dev/reference/block-kit/blocks/container-block
496
+ */
497
+ interface ContainerBlock {
498
+ type: 'container';
499
+ title: {
500
+ type: 'plain_text';
501
+ text: string;
502
+ emoji?: boolean;
503
+ };
504
+ child_blocks: ContainerChildBlock[];
505
+ subtitle?: {
506
+ type: 'plain_text';
507
+ text: string;
508
+ emoji?: boolean;
509
+ };
510
+ icon?: ImageElement;
511
+ width?: 'narrow' | 'standard' | 'wide' | 'full';
512
+ is_collapsible?: boolean;
513
+ default_collapsed?: boolean;
514
+ block_id?: string;
515
+ }
476
516
  /**
477
517
  * Header heading level shown in the preview. Slack's API has no
478
518
  * `level` field on header blocks, so this is a builder-only extension
@@ -491,15 +531,22 @@ type SupportedHeaderBlock = HeaderBlock & {
491
531
  * Subset of {@link AnyMessageBlock} from `slack-web-api-client`,
492
532
  * plus a header `level` extension.
493
533
  */
494
- type SupportedBlock = SectionBlock | SupportedHeaderBlock | DividerBlock | ContextBlock | ActionsBlock | ImageBlock | MarkdownBlock | RichTextBlock | TableBlock | AlertBlock | CardBlock | CarouselBlock | ContextActionsBlock | InputBlock | VideoBlock | PlanBlock | TaskCardBlock | DataVisualizationBlock;
534
+ type SupportedBlock = SectionBlock | SupportedHeaderBlock | DividerBlock | ContextBlock | ActionsBlock | ImageBlock | MarkdownBlock | RichTextBlock | TableBlock | AlertBlock | CardBlock | CarouselBlock | ContextActionsBlock | InputBlock | VideoBlock | PlanBlock | TaskCardBlock | DataVisualizationBlock | ContainerBlock;
495
535
  /**
496
536
  * A block as represented inside the builder's working state.
497
537
  * `id` is an ephemeral client-side identifier used by DnD and selection.
498
538
  * It is stripped before serialization to Slack.
539
+ *
540
+ * For `container` blocks, `children` holds the wrapped child blocks and is
541
+ * the authoritative store for drag-and-drop identity; `block.child_blocks`
542
+ * is kept mirrored from it so the payload stays valid for serialization,
543
+ * validation, and preview without those paths needing to know about the
544
+ * nesting. `children` is absent for every other block type.
499
545
  */
500
546
  interface BuilderBlock {
501
547
  id: string;
502
548
  block: SupportedBlock;
549
+ children?: BuilderBlock[];
503
550
  }
504
551
  /**
505
552
  * Channel record returned by {@link BlockKitchenProps.loadChannels}.
@@ -806,4 +853,4 @@ interface BlockKitchenProps {
806
853
  theme?: BrandTheme | BrandPreset;
807
854
  }
808
855
 
809
- export { type AlertBlock as A, type BlockKitchenProps as B, type CardBlock as C, type DataVisualizationBlock as D, type SendPayload as E, type FeedbackButtonSubobject as F, type SendResult as G, type HeaderLevel as H, type IconButtonElement as I, type SupportedBlock as J, type SupportedBlockType as K, type SupportedHeaderBlock as L, type MarkdownBlock as M, type TableCell as N, type TableColumnSetting as O, type PaletteSection as P, type TaskCardBlock as Q, type TaskCardStatus as R, type SendAsUserStatus as S, type TableBlock as T, type Template as U, type UrlSourceElement as V, type VideoBlock as W, buildVariantById as X, defaultPalette as Y, extraAlertVariant as Z, legacyInputVariants as _, type AlertLevel as a, type BrandPreset as b, type BrandTheme as c, type BrandTokens as d, type BuilderBlock as e, type CarouselBlock as f, type CartesianChart as g, type ChannelOption as h, type Chart as i, type ChartAxisConfig as j, type ChartDataPoint as k, type ChartSeries as l, type ChartType as m, type ContextActionsBlock as n, type ContextActionsElement as o, type CustomEmoji as p, type FeedbackButtonsElement as q, type IconButtonIcon as r, type InputBlock as s, type PaletteVariant as t, type PieChart as u, type PieChartSegment as v, type PlanBlock as w, type PreviewHooks as x, type PreviewSurface as y, type PreviewTheme as z };
856
+ export { extraAlertVariant as $, type AlertBlock as A, type BlockKitchenProps as B, type CardBlock as C, type DataVisualizationBlock as D, type PreviewSurface as E, type FeedbackButtonSubobject as F, type PreviewTheme as G, type HeaderLevel as H, type IconButtonElement as I, type SendPayload as J, type SendResult as K, type SupportedBlock as L, type MarkdownBlock as M, type SupportedBlockType as N, type SupportedHeaderBlock as O, type PaletteSection as P, type TableCell as Q, type TableColumnSetting as R, type SendAsUserStatus as S, type TableBlock as T, type TaskCardBlock as U, type TaskCardStatus as V, type Template as W, type UrlSourceElement as X, type VideoBlock as Y, buildVariantById as Z, defaultPalette as _, type AlertLevel as a, legacyInputVariants as a0, type BrandPreset as b, type BrandTheme as c, type BrandTokens as d, type BuilderBlock as e, type CarouselBlock as f, type CartesianChart as g, type ChannelOption as h, type Chart as i, type ChartAxisConfig as j, type ChartDataPoint as k, type ChartSeries as l, type ChartType as m, type ContainerBlock as n, type ContainerChildBlock as o, type ContextActionsBlock as p, type ContextActionsElement as q, type CustomEmoji as r, type FeedbackButtonsElement as s, type IconButtonIcon as t, type InputBlock as u, type PaletteVariant as v, type PieChart as w, type PieChartSegment as x, type PlanBlock as y, type PreviewHooks as z };
@@ -151,7 +151,7 @@ declare function buildVariantById(sections: readonly PaletteSection[]): Readonly
151
151
  /**
152
152
  * The Slack Block Kit block types supported by the builder in v1.
153
153
  */
154
- type SupportedBlockType = 'section' | 'header' | 'divider' | 'context' | 'actions' | 'image' | 'markdown' | 'rich_text' | 'table' | 'alert' | 'card' | 'carousel' | 'context_actions' | 'input' | 'video' | 'plan' | 'task_card' | 'data_visualization';
154
+ type SupportedBlockType = 'section' | 'header' | 'divider' | 'context' | 'actions' | 'image' | 'markdown' | 'rich_text' | 'table' | 'alert' | 'card' | 'carousel' | 'context_actions' | 'input' | 'video' | 'plan' | 'task_card' | 'data_visualization' | 'container';
155
155
  /**
156
156
  * Slack `markdown` block payload. Renders standard markdown (GFM)
157
157
  * via `slack-blocks-to-jsx`'s react-markdown integration.
@@ -473,6 +473,46 @@ interface DataVisualizationBlock {
473
473
  chart: Chart;
474
474
  block_id?: string;
475
475
  }
476
+ /**
477
+ * A block allowed inside a {@link ContainerBlock}'s `child_blocks` array.
478
+ * Slack permits actions, context, divider, file, header, image, input,
479
+ * rich_text, section, table, and video — notably not `container` itself
480
+ * (no nesting) nor message-only chrome like card / carousel / markdown.
481
+ * This mirrors that set across the block types the builder models (`file`
482
+ * is omitted because the builder has no file block).
483
+ * @see https://docs.slack.dev/reference/block-kit/blocks/container-block
484
+ */
485
+ type ContainerChildBlock = SectionBlock | SupportedHeaderBlock | DividerBlock | ContextBlock | ActionsBlock | ImageBlock | RichTextBlock | TableBlock | InputBlock | VideoBlock;
486
+ /**
487
+ * Slack `container` block payload. A general-purpose wrapper that groups
488
+ * 1-10 child blocks into a single, optionally collapsible unit with a
489
+ * configurable width. Valid on the message surface only.
490
+ * `default_collapsed` only takes effect when `is_collapsible` is true.
491
+ *
492
+ * Note: despite what the API reference says, `title` and `subtitle` are
493
+ * `plain_text` text objects, not plain strings. `slack-web-api-client`
494
+ * doesn't ship this type yet, so we declare it.
495
+ * @see https://docs.slack.dev/reference/block-kit/blocks/container-block
496
+ */
497
+ interface ContainerBlock {
498
+ type: 'container';
499
+ title: {
500
+ type: 'plain_text';
501
+ text: string;
502
+ emoji?: boolean;
503
+ };
504
+ child_blocks: ContainerChildBlock[];
505
+ subtitle?: {
506
+ type: 'plain_text';
507
+ text: string;
508
+ emoji?: boolean;
509
+ };
510
+ icon?: ImageElement;
511
+ width?: 'narrow' | 'standard' | 'wide' | 'full';
512
+ is_collapsible?: boolean;
513
+ default_collapsed?: boolean;
514
+ block_id?: string;
515
+ }
476
516
  /**
477
517
  * Header heading level shown in the preview. Slack's API has no
478
518
  * `level` field on header blocks, so this is a builder-only extension
@@ -491,15 +531,22 @@ type SupportedHeaderBlock = HeaderBlock & {
491
531
  * Subset of {@link AnyMessageBlock} from `slack-web-api-client`,
492
532
  * plus a header `level` extension.
493
533
  */
494
- type SupportedBlock = SectionBlock | SupportedHeaderBlock | DividerBlock | ContextBlock | ActionsBlock | ImageBlock | MarkdownBlock | RichTextBlock | TableBlock | AlertBlock | CardBlock | CarouselBlock | ContextActionsBlock | InputBlock | VideoBlock | PlanBlock | TaskCardBlock | DataVisualizationBlock;
534
+ type SupportedBlock = SectionBlock | SupportedHeaderBlock | DividerBlock | ContextBlock | ActionsBlock | ImageBlock | MarkdownBlock | RichTextBlock | TableBlock | AlertBlock | CardBlock | CarouselBlock | ContextActionsBlock | InputBlock | VideoBlock | PlanBlock | TaskCardBlock | DataVisualizationBlock | ContainerBlock;
495
535
  /**
496
536
  * A block as represented inside the builder's working state.
497
537
  * `id` is an ephemeral client-side identifier used by DnD and selection.
498
538
  * It is stripped before serialization to Slack.
539
+ *
540
+ * For `container` blocks, `children` holds the wrapped child blocks and is
541
+ * the authoritative store for drag-and-drop identity; `block.child_blocks`
542
+ * is kept mirrored from it so the payload stays valid for serialization,
543
+ * validation, and preview without those paths needing to know about the
544
+ * nesting. `children` is absent for every other block type.
499
545
  */
500
546
  interface BuilderBlock {
501
547
  id: string;
502
548
  block: SupportedBlock;
549
+ children?: BuilderBlock[];
503
550
  }
504
551
  /**
505
552
  * Channel record returned by {@link BlockKitchenProps.loadChannels}.
@@ -806,4 +853,4 @@ interface BlockKitchenProps {
806
853
  theme?: BrandTheme | BrandPreset;
807
854
  }
808
855
 
809
- export { type AlertBlock as A, type BlockKitchenProps as B, type CardBlock as C, type DataVisualizationBlock as D, type SendPayload as E, type FeedbackButtonSubobject as F, type SendResult as G, type HeaderLevel as H, type IconButtonElement as I, type SupportedBlock as J, type SupportedBlockType as K, type SupportedHeaderBlock as L, type MarkdownBlock as M, type TableCell as N, type TableColumnSetting as O, type PaletteSection as P, type TaskCardBlock as Q, type TaskCardStatus as R, type SendAsUserStatus as S, type TableBlock as T, type Template as U, type UrlSourceElement as V, type VideoBlock as W, buildVariantById as X, defaultPalette as Y, extraAlertVariant as Z, legacyInputVariants as _, type AlertLevel as a, type BrandPreset as b, type BrandTheme as c, type BrandTokens as d, type BuilderBlock as e, type CarouselBlock as f, type CartesianChart as g, type ChannelOption as h, type Chart as i, type ChartAxisConfig as j, type ChartDataPoint as k, type ChartSeries as l, type ChartType as m, type ContextActionsBlock as n, type ContextActionsElement as o, type CustomEmoji as p, type FeedbackButtonsElement as q, type IconButtonIcon as r, type InputBlock as s, type PaletteVariant as t, type PieChart as u, type PieChartSegment as v, type PlanBlock as w, type PreviewHooks as x, type PreviewSurface as y, type PreviewTheme as z };
856
+ export { extraAlertVariant as $, type AlertBlock as A, type BlockKitchenProps as B, type CardBlock as C, type DataVisualizationBlock as D, type PreviewSurface as E, type FeedbackButtonSubobject as F, type PreviewTheme as G, type HeaderLevel as H, type IconButtonElement as I, type SendPayload as J, type SendResult as K, type SupportedBlock as L, type MarkdownBlock as M, type SupportedBlockType as N, type SupportedHeaderBlock as O, type PaletteSection as P, type TableCell as Q, type TableColumnSetting as R, type SendAsUserStatus as S, type TableBlock as T, type TaskCardBlock as U, type TaskCardStatus as V, type Template as W, type UrlSourceElement as X, type VideoBlock as Y, buildVariantById as Z, defaultPalette as _, type AlertLevel as a, legacyInputVariants as a0, type BrandPreset as b, type BrandTheme as c, type BrandTokens as d, type BuilderBlock as e, type CarouselBlock as f, type CartesianChart as g, type ChannelOption as h, type Chart as i, type ChartAxisConfig as j, type ChartDataPoint as k, type ChartSeries as l, type ChartType as m, type ContainerBlock as n, type ContainerChildBlock as o, type ContextActionsBlock as p, type ContextActionsElement as q, type CustomEmoji as r, type FeedbackButtonsElement as s, type IconButtonIcon as t, type InputBlock as u, type PaletteVariant as v, type PieChart as w, type PieChartSegment as x, type PlanBlock as y, type PreviewHooks as z };
package/dist/palette.cjs CHANGED
@@ -1072,6 +1072,49 @@ var defaultPalette = [
1072
1072
  })
1073
1073
  }
1074
1074
  ]
1075
+ },
1076
+ {
1077
+ name: "Container",
1078
+ icon: lucideReact.Container,
1079
+ variants: [
1080
+ {
1081
+ id: "container_collapsible",
1082
+ label: "Collapsible container",
1083
+ factory: () => ({
1084
+ type: "container",
1085
+ title: { type: "plain_text", text: "Bulk update: 2 records selected" },
1086
+ subtitle: { type: "plain_text", text: "Review changes before confirming" },
1087
+ is_collapsible: true,
1088
+ child_blocks: [
1089
+ {
1090
+ type: "section",
1091
+ text: { type: "mrkdwn", text: "*DCW-1024*\nStatus: Open \u2192 Closed" }
1092
+ },
1093
+ { type: "divider" },
1094
+ {
1095
+ type: "section",
1096
+ text: { type: "mrkdwn", text: "*DCW-1025*\nStatus: In Progress \u2192 Closed" }
1097
+ },
1098
+ {
1099
+ type: "actions",
1100
+ elements: [
1101
+ {
1102
+ type: "button",
1103
+ text: { type: "plain_text", text: "Confirm All", emoji: true },
1104
+ style: "primary",
1105
+ action_id: "bulk_confirm"
1106
+ },
1107
+ {
1108
+ type: "button",
1109
+ text: { type: "plain_text", text: "Cancel", emoji: true },
1110
+ action_id: "bulk_cancel"
1111
+ }
1112
+ ]
1113
+ }
1114
+ ]
1115
+ })
1116
+ }
1117
+ ]
1075
1118
  }
1076
1119
  ];
1077
1120
  var legacyInputVariants = [