From 5d855d13fb6d0172f7eaffa42ed0b56348e3102f Mon Sep 17 00:00:00 2001 From: Zach Hawtof Date: Tue, 19 May 2026 18:29:39 -0400 Subject: [PATCH] feat(palette): add alert block section to default palette The Slack alert block was wired through the type system, editor, and preview but excluded from the default palette to mirror Slack's own Block Kit Builder sidebar. Add it back as a first-class section (Bell icon) with all five severity variants (default, info, warning, error, success) so users can drag it onto the surface without configuring a custom palette. `extraAlertVariant` is retained for backward compatibility with consumers who previously spread it onto a custom palette; its JSDoc now notes the duplicate `alert_warning` id and that the alert ships in the default palette. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/lib/default-blocks.ts | 76 ++++++++++++++++++++++++++++++++++++--- src/types.ts | 4 +-- 2 files changed, 73 insertions(+), 7 deletions(-) diff --git a/src/lib/default-blocks.ts b/src/lib/default-blocks.ts index ffad40f..e4bbd6a 100644 --- a/src/lib/default-blocks.ts +++ b/src/lib/default-blocks.ts @@ -1,5 +1,6 @@ import { AlignLeft, + Bell, FileText, GalleryHorizontal, Image as ImageIcon, @@ -658,6 +659,71 @@ export const defaultPalette: readonly PaletteSection[] = [ } ] }, + { + name: 'Alert', + icon: Bell, + variants: [ + { + id: 'alert_default', + label: 'Default', + factory: () => ({ + type: 'alert', + text: { + type: 'mrkdwn', + text: 'A neutral alert message.' + } + }) + }, + { + id: 'alert_info', + label: 'Info', + factory: () => ({ + type: 'alert', + level: 'info', + text: { + type: 'mrkdwn', + text: 'FYI: the build finished in 42 seconds.' + } + }) + }, + { + id: 'alert_warning', + label: 'Warning', + factory: () => ({ + type: 'alert', + level: 'warning', + text: { + type: 'mrkdwn', + text: 'Heads up: this action cannot be undone.' + } + }) + }, + { + id: 'alert_error', + label: 'Error', + factory: () => ({ + type: 'alert', + level: 'error', + text: { + type: 'mrkdwn', + text: 'Something went wrong. Please try again.' + } + }) + }, + { + id: 'alert_success', + label: 'Success', + factory: () => ({ + type: 'alert', + level: 'success', + text: { + type: 'mrkdwn', + text: 'Your changes have been saved.' + } + }) + } + ] + }, { name: 'Rich Text', icon: Pilcrow, @@ -1273,10 +1339,12 @@ export const legacyInputVariants: readonly PaletteVariant[] = [ ] as const; /** - * Modal-only `alert` block variant. Dropped from `defaultPalette` to - * match Slack's Block Kit Builder sidebar (which doesn't list it), but - * kept reachable so consumers who want it back can re-add via a custom - * palette section. + * Standalone `alert` block variant. The full set of severity-level alert + * variants ships in `defaultPalette` under the "Alert" section; this + * export is retained for backward compatibility with consumers who + * previously spread it onto a custom palette. Shares the `alert_warning` + * id with its counterpart in `defaultPalette` — spread after + * `defaultPalette` (or omit it entirely) to avoid duplicate-id lookups. */ export const extraAlertVariant: PaletteVariant = { id: 'alert_warning', diff --git a/src/types.ts b/src/types.ts index d26b4da..1063e17 100644 --- a/src/types.ts +++ b/src/types.ts @@ -393,9 +393,7 @@ export interface BlockKitchenProps { * you previously relied on the long flat list of single-element * `input` variants (`input_users_select`, `input_multi_users_select`, * `input_radio_buttons`, etc.), import `legacyInputVariants` and - * spread them into a custom section. The modal-only `alert` block was - * also dropped from the default; reach for `extraAlertVariant` to - * keep it. + * spread them into a custom section. * * Variant ids must be unique across the array — the drag-drop lookup * keys by id, so duplicates would shadow each other. The palette is