@tightknitai/block-kitchen 0.10.7 → 0.10.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/README.md +9 -3
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.cjs +87 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +88 -30
- package/dist/index.js.map +1 -1
- package/dist/{palette-QbOx7kAa.d.cts → palette-CvSGn2z6.d.cts} +13 -6
- package/dist/{palette-QbOx7kAa.d.ts → palette-CvSGn2z6.d.ts} +13 -6
- package/dist/palette.cjs +10 -2
- package/dist/palette.cjs.map +1 -1
- package/dist/palette.d.cts +1 -1
- package/dist/palette.d.ts +1 -1
- package/dist/palette.js +10 -2
- package/dist/palette.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { B as BlockKitchenProps, S as SupportedBlock, C as ChannelOption, a as SendAsUserStatus, b as SendPayload, c as SendExtrasContext, T as Template, P as PreviewSurface, d as PreviewTheme } from './palette-
|
|
4
|
-
export { A as AlertBlock, e as AlertLevel, f as BlockKitchenBaseProps, g as BlockKitchenComposeOnlyProps, h as BlockKitchenSendProps, i as BrandPreset, j as BrandTheme, k as BrandTokens, l as BuilderBlock, m as CardBlock, n as CarouselBlock, o as CartesianChart, p as Chart, q as ChartAxisConfig, r as ChartDataPoint, s as ChartSeries, t as ChartType, u as ContainerBlock, v as ContainerChildBlock, w as ContextActionsBlock, x as ContextActionsElement, y as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, F as FeedbackButtonSubobject, z as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, G as IconButtonIcon, J as InputBlock, L as LoadMessageInput, K as LoadResult, M as LoadedMessage, N as LoadingConfig, O as MarkdownBlock, Q as PaletteMode, R as PaletteSection, U as PaletteVariant, V as PieChart, W as PieChartSegment, X as PlanBlock, Y as PreviewHooks, Z as PrimaryActionConfig, _ as PrimaryActionContext, $ as RecentMessage, a0 as SendResult, a1 as SupportedBlockType, a2 as SupportedHeaderBlock, a3 as TableBlock, a4 as TableCell, a5 as TableColumnSetting, a6 as TaskCardBlock, a7 as TaskCardStatus, a8 as UpdatePayload, a9 as UpdateResult, aa as UrlSourceElement, ab as ValidationSummary, ac as VideoBlock, ad as defaultPalette, ae as extraAlertVariant, af as legacyInputVariants } from './palette-
|
|
3
|
+
import { B as BlockKitchenProps, S as SupportedBlock, C as ChannelOption, a as SendAsUserStatus, b as SendPayload, c as SendExtrasContext, T as Template, P as PreviewSurface, d as PreviewTheme } from './palette-CvSGn2z6.cjs';
|
|
4
|
+
export { A as AlertBlock, e as AlertLevel, f as BlockKitchenBaseProps, g as BlockKitchenComposeOnlyProps, h as BlockKitchenSendProps, i as BrandPreset, j as BrandTheme, k as BrandTokens, l as BuilderBlock, m as CardBlock, n as CarouselBlock, o as CartesianChart, p as Chart, q as ChartAxisConfig, r as ChartDataPoint, s as ChartSeries, t as ChartType, u as ContainerBlock, v as ContainerChildBlock, w as ContextActionsBlock, x as ContextActionsElement, y as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, F as FeedbackButtonSubobject, z as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, G as IconButtonIcon, J as InputBlock, L as LoadMessageInput, K as LoadResult, M as LoadedMessage, N as LoadingConfig, O as MarkdownBlock, Q as PaletteMode, R as PaletteSection, U as PaletteVariant, V as PieChart, W as PieChartSegment, X as PlanBlock, Y as PreviewHooks, Z as PrimaryActionConfig, _ as PrimaryActionContext, $ as RecentMessage, a0 as SendResult, a1 as SupportedBlockType, a2 as SupportedHeaderBlock, a3 as TableBlock, a4 as TableCell, a5 as TableColumnSetting, a6 as TaskCardBlock, a7 as TaskCardStatus, a8 as UpdatePayload, a9 as UpdateResult, aa as UrlSourceElement, ab as ValidationSummary, ac as VideoBlock, ad as defaultPalette, ae as extraAlertVariant, af as legacyInputVariants } from './palette-CvSGn2z6.cjs';
|
|
5
5
|
export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.cjs';
|
|
6
6
|
import 'slack-web-api-client';
|
|
7
7
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { B as BlockKitchenProps, S as SupportedBlock, C as ChannelOption, a as SendAsUserStatus, b as SendPayload, c as SendExtrasContext, T as Template, P as PreviewSurface, d as PreviewTheme } from './palette-
|
|
4
|
-
export { A as AlertBlock, e as AlertLevel, f as BlockKitchenBaseProps, g as BlockKitchenComposeOnlyProps, h as BlockKitchenSendProps, i as BrandPreset, j as BrandTheme, k as BrandTokens, l as BuilderBlock, m as CardBlock, n as CarouselBlock, o as CartesianChart, p as Chart, q as ChartAxisConfig, r as ChartDataPoint, s as ChartSeries, t as ChartType, u as ContainerBlock, v as ContainerChildBlock, w as ContextActionsBlock, x as ContextActionsElement, y as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, F as FeedbackButtonSubobject, z as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, G as IconButtonIcon, J as InputBlock, L as LoadMessageInput, K as LoadResult, M as LoadedMessage, N as LoadingConfig, O as MarkdownBlock, Q as PaletteMode, R as PaletteSection, U as PaletteVariant, V as PieChart, W as PieChartSegment, X as PlanBlock, Y as PreviewHooks, Z as PrimaryActionConfig, _ as PrimaryActionContext, $ as RecentMessage, a0 as SendResult, a1 as SupportedBlockType, a2 as SupportedHeaderBlock, a3 as TableBlock, a4 as TableCell, a5 as TableColumnSetting, a6 as TaskCardBlock, a7 as TaskCardStatus, a8 as UpdatePayload, a9 as UpdateResult, aa as UrlSourceElement, ab as ValidationSummary, ac as VideoBlock, ad as defaultPalette, ae as extraAlertVariant, af as legacyInputVariants } from './palette-
|
|
3
|
+
import { B as BlockKitchenProps, S as SupportedBlock, C as ChannelOption, a as SendAsUserStatus, b as SendPayload, c as SendExtrasContext, T as Template, P as PreviewSurface, d as PreviewTheme } from './palette-CvSGn2z6.js';
|
|
4
|
+
export { A as AlertBlock, e as AlertLevel, f as BlockKitchenBaseProps, g as BlockKitchenComposeOnlyProps, h as BlockKitchenSendProps, i as BrandPreset, j as BrandTheme, k as BrandTokens, l as BuilderBlock, m as CardBlock, n as CarouselBlock, o as CartesianChart, p as Chart, q as ChartAxisConfig, r as ChartDataPoint, s as ChartSeries, t as ChartType, u as ContainerBlock, v as ContainerChildBlock, w as ContextActionsBlock, x as ContextActionsElement, y as CustomEmoji, D as DataVisualizationBlock, E as EditableVia, F as FeedbackButtonSubobject, z as FeedbackButtonsElement, H as HeaderLevel, I as IconButtonElement, G as IconButtonIcon, J as InputBlock, L as LoadMessageInput, K as LoadResult, M as LoadedMessage, N as LoadingConfig, O as MarkdownBlock, Q as PaletteMode, R as PaletteSection, U as PaletteVariant, V as PieChart, W as PieChartSegment, X as PlanBlock, Y as PreviewHooks, Z as PrimaryActionConfig, _ as PrimaryActionContext, $ as RecentMessage, a0 as SendResult, a1 as SupportedBlockType, a2 as SupportedHeaderBlock, a3 as TableBlock, a4 as TableCell, a5 as TableColumnSetting, a6 as TaskCardBlock, a7 as TaskCardStatus, a8 as UpdatePayload, a9 as UpdateResult, aa as UrlSourceElement, ab as ValidationSummary, ac as VideoBlock, ad as defaultPalette, ae as extraAlertVariant, af as legacyInputVariants } from './palette-CvSGn2z6.js';
|
|
5
5
|
export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.js';
|
|
6
6
|
import 'slack-web-api-client';
|
|
7
7
|
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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, Container, Loader2, ExternalLink, AlertTriangle, GripVertical, Sun, Moon, MessageSquare, AppWindow, Home, Plus, ChevronDown, BookOpen, Undo2, Redo2, Trash2, Code2, Pencil, Send, Search, Check, Copy, Info, CheckCircle2,
|
|
3
|
+
import { X, Circle, Sparkles, FileText, AlignLeft, MousePointerClick, TextCursorInput, LayoutTemplate, Bell, Pilcrow, Image, Video, GalleryHorizontal, Table, ChartColumnBig, Container, Loader2, ExternalLink, AlertTriangle, ChevronRight, ChevronLeft, GripVertical, Sun, Moon, MessageSquare, AppWindow, Home, Plus, ChevronDown, BookOpen, Undo2, Redo2, Trash2, Code2, Pencil, Send, Search, Check, Copy, Info, CheckCircle2, LayoutGrid, ArrowUp, ArrowDown, Type, Bold, Italic, Strikethrough, Underline, Code, List, ListOrdered, Quote, Smile, Link as Link$1 } from 'lucide-react';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { createContext, useState, useRef, useEffect, useCallback, useMemo, useId, useContext } from 'react';
|
|
6
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
|
-
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
8
6
|
import { clsx } from 'clsx';
|
|
9
7
|
import { twMerge } from 'tailwind-merge';
|
|
8
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
9
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
10
10
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
11
11
|
import { validateBlockKit, CARD_ACTIONS_MAX } from '@tightknitai/slack-block-kit-validator';
|
|
12
12
|
import { nanoid } from 'nanoid';
|
|
@@ -23,6 +23,9 @@ import { Node, ReactNodeViewRenderer, mergeAttributes, NodeViewWrapper, useEdito
|
|
|
23
23
|
import StarterKit from '@tiptap/starter-kit';
|
|
24
24
|
|
|
25
25
|
// src/components/block-kitchen.tsx
|
|
26
|
+
function cn(...inputs) {
|
|
27
|
+
return twMerge(clsx(inputs));
|
|
28
|
+
}
|
|
26
29
|
|
|
27
30
|
// src/lib/container-blocks.ts
|
|
28
31
|
var CONTAINER_CHILD_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -704,6 +707,7 @@ var defaultPalette = [
|
|
|
704
707
|
{
|
|
705
708
|
id: "structure_header",
|
|
706
709
|
label: "Header",
|
|
710
|
+
basic: true,
|
|
707
711
|
factory: () => ({
|
|
708
712
|
type: "header",
|
|
709
713
|
text: { type: "plain_text", text: "Heading text", emoji: true }
|
|
@@ -712,6 +716,7 @@ var defaultPalette = [
|
|
|
712
716
|
{
|
|
713
717
|
id: "structure_divider",
|
|
714
718
|
label: "Divider",
|
|
719
|
+
basic: true,
|
|
715
720
|
factory: () => ({ type: "divider" })
|
|
716
721
|
},
|
|
717
722
|
{
|
|
@@ -819,8 +824,9 @@ var defaultPalette = [
|
|
|
819
824
|
{
|
|
820
825
|
id: "rich_text_section",
|
|
821
826
|
label: "Rich Text Section",
|
|
822
|
-
// The
|
|
823
|
-
//
|
|
827
|
+
// The block a message is mostly made of, and so one of the handful
|
|
828
|
+
// simple mode offers — listed there without its section heading,
|
|
829
|
+
// hence the self-describing label.
|
|
824
830
|
basic: true,
|
|
825
831
|
factory: () => ({
|
|
826
832
|
type: "rich_text",
|
|
@@ -857,6 +863,11 @@ var defaultPalette = [
|
|
|
857
863
|
{
|
|
858
864
|
id: "image_no_title",
|
|
859
865
|
label: "No title",
|
|
866
|
+
// The plain image is the one an ordinary message reaches for, so it
|
|
867
|
+
// carries simple mode's image slot — under its own name there, with
|
|
868
|
+
// no "Image" heading overhead to lend "No title" its meaning.
|
|
869
|
+
basic: true,
|
|
870
|
+
basicLabel: "Image",
|
|
860
871
|
factory: () => ({
|
|
861
872
|
type: "image",
|
|
862
873
|
image_url: "https://placehold.co/600x300?text=Image",
|
|
@@ -1679,9 +1690,6 @@ function labelForBlockType(type) {
|
|
|
1679
1690
|
return "Container";
|
|
1680
1691
|
}
|
|
1681
1692
|
}
|
|
1682
|
-
function cn(...inputs) {
|
|
1683
|
-
return twMerge(clsx(inputs));
|
|
1684
|
-
}
|
|
1685
1693
|
var Sheet = DialogPrimitive.Root;
|
|
1686
1694
|
var SheetOverlay = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
1687
1695
|
DialogPrimitive.Overlay,
|
|
@@ -3782,14 +3790,14 @@ function isDefaultOpen(sectionName, config) {
|
|
|
3782
3790
|
return config.includes(sectionName);
|
|
3783
3791
|
}
|
|
3784
3792
|
var PALETTE_TITLE = "Message Elements";
|
|
3785
|
-
var ADVANCED_HELP = "Browse every Slack block type \u2014 sections, images, buttons, inputs, tables and more
|
|
3786
|
-
var BASIC_HELP = "Go back to the short list:
|
|
3793
|
+
var ADVANCED_HELP = "Browse every Slack block type \u2014 sections, images, buttons, inputs, tables and more.";
|
|
3794
|
+
var BASIC_HELP = "Go back to the short list: the few blocks an ordinary message is made of.";
|
|
3787
3795
|
function basicVariants(sections) {
|
|
3788
3796
|
const out = [];
|
|
3789
3797
|
for (const section of sections) {
|
|
3790
3798
|
for (const variant of section.variants) {
|
|
3791
3799
|
if (variant.basic) {
|
|
3792
|
-
out.push(variant);
|
|
3800
|
+
out.push(variant.basicLabel ? { ...variant, label: variant.basicLabel } : variant);
|
|
3793
3801
|
}
|
|
3794
3802
|
}
|
|
3795
3803
|
}
|
|
@@ -3818,10 +3826,12 @@ function Palette({
|
|
|
3818
3826
|
showSearch = true,
|
|
3819
3827
|
searchPlaceholder = "Search blocks\u2026",
|
|
3820
3828
|
mode = "advanced",
|
|
3829
|
+
defaultAdvanced = false,
|
|
3830
|
+
onAdvancedChange,
|
|
3821
3831
|
variant = "aside"
|
|
3822
3832
|
}) {
|
|
3823
3833
|
const [query, setQuery] = useState("");
|
|
3824
|
-
const [advancedOpen, setAdvancedOpen] = useState(
|
|
3834
|
+
const [advancedOpen, setAdvancedOpen] = useState(defaultAdvanced);
|
|
3825
3835
|
const [prevMode, setPrevMode] = useState(mode);
|
|
3826
3836
|
if (prevMode !== mode) {
|
|
3827
3837
|
setPrevMode(mode);
|
|
@@ -3843,7 +3853,7 @@ function Palette({
|
|
|
3843
3853
|
{
|
|
3844
3854
|
className: cn(
|
|
3845
3855
|
"flex min-h-0 flex-col overflow-x-hidden overflow-y-auto",
|
|
3846
|
-
isSheet ? "w-full flex-1 bg-background" : "w-
|
|
3856
|
+
isSheet ? "w-full flex-1 bg-background" : "w-56 shrink-0 border-r bg-muted/20"
|
|
3847
3857
|
),
|
|
3848
3858
|
children: [
|
|
3849
3859
|
offersSimple || searchVisible ? (
|
|
@@ -3876,7 +3886,9 @@ function Palette({
|
|
|
3876
3886
|
isSheet,
|
|
3877
3887
|
onToggle: () => {
|
|
3878
3888
|
setQuery("");
|
|
3879
|
-
|
|
3889
|
+
const next = !advancedOpen;
|
|
3890
|
+
setAdvancedOpen(next);
|
|
3891
|
+
onAdvancedChange?.(next);
|
|
3880
3892
|
}
|
|
3881
3893
|
}
|
|
3882
3894
|
)
|
|
@@ -4004,8 +4016,8 @@ function PaletteItem({
|
|
|
4004
4016
|
isDragging && "opacity-50"
|
|
4005
4017
|
),
|
|
4006
4018
|
children: [
|
|
4007
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
4008
|
-
/* @__PURE__ */ jsx("span", { className: "
|
|
4019
|
+
/* @__PURE__ */ jsx("span", { className: "min-w-0 flex-1 truncate", children: variant.label }),
|
|
4020
|
+
/* @__PURE__ */ jsx("span", { className: "flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground transition-colors group-hover:bg-primary/10 group-hover:text-primary", children: /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4" }) })
|
|
4009
4021
|
]
|
|
4010
4022
|
}
|
|
4011
4023
|
);
|
|
@@ -4015,7 +4027,7 @@ function PaletteItem({
|
|
|
4015
4027
|
{
|
|
4016
4028
|
ref: setNodeRef,
|
|
4017
4029
|
className: cn(
|
|
4018
|
-
"group flex items-center gap-2 rounded px-2 py-1
|
|
4030
|
+
"group flex items-center gap-2 rounded px-2 py-1 text-sm text-muted-foreground transition-colors hover:bg-accent hover:text-foreground has-[:focus-visible]:bg-accent has-[:focus-visible]:text-foreground",
|
|
4019
4031
|
isDragging && "opacity-50"
|
|
4020
4032
|
),
|
|
4021
4033
|
children: [
|
|
@@ -4023,7 +4035,7 @@ function PaletteItem({
|
|
|
4023
4035
|
"div",
|
|
4024
4036
|
{
|
|
4025
4037
|
ref: setActivatorNodeRef,
|
|
4026
|
-
className: "-my-1
|
|
4038
|
+
className: "-my-1 flex min-w-0 flex-1 cursor-grab items-center gap-2 rounded py-1 active:cursor-grabbing focus-visible:outline-none",
|
|
4027
4039
|
...attributes,
|
|
4028
4040
|
...listeners,
|
|
4029
4041
|
children: [
|
|
@@ -10000,7 +10012,7 @@ function Toolbar2({
|
|
|
10000
10012
|
variant: "ghost",
|
|
10001
10013
|
size: "sm",
|
|
10002
10014
|
onClick: onOpenPalette,
|
|
10003
|
-
className: "md:hidden",
|
|
10015
|
+
className: "gap-1 md:hidden",
|
|
10004
10016
|
"aria-label": "Add a block",
|
|
10005
10017
|
children: [
|
|
10006
10018
|
/* @__PURE__ */ jsx(Plus, { className: "h-4 w-4" }),
|
|
@@ -10556,12 +10568,20 @@ function BlockKitchen(props) {
|
|
|
10556
10568
|
useNotifyOnChange(activeEditTarget, loadedMessageKey, loading?.onLoadedMessageChange);
|
|
10557
10569
|
const [issuesOpen, setIssuesOpen] = useState(false);
|
|
10558
10570
|
const [paletteOpen, setPaletteOpen] = useState(false);
|
|
10571
|
+
const [paletteCollapsed, setPaletteCollapsed] = useState(false);
|
|
10572
|
+
const [paletteAdvanced, setPaletteAdvanced] = useState(false);
|
|
10573
|
+
const [prevPaletteMode, setPrevPaletteMode] = useState(paletteMode);
|
|
10574
|
+
if (prevPaletteMode !== paletteMode) {
|
|
10575
|
+
setPrevPaletteMode(paletteMode);
|
|
10576
|
+
setPaletteAdvanced(false);
|
|
10577
|
+
}
|
|
10559
10578
|
const [openBlockId, setOpenBlockId] = useState(null);
|
|
10560
10579
|
const [uncontrolledPreviewTheme, setUncontrolledPreviewTheme] = useState(defaultPreviewTheme);
|
|
10561
10580
|
const isPreviewThemeControlled = controlledPreviewTheme !== void 0;
|
|
10562
10581
|
const previewTheme = controlledPreviewTheme ?? uncontrolledPreviewTheme;
|
|
10563
10582
|
const [previewSurface, setPreviewSurface] = useState(allowedSurfaces[0]);
|
|
10564
10583
|
const [activePaletteVariantId, setActivePaletteVariantId] = useState(null);
|
|
10584
|
+
const paletteSheetRef = useRef(null);
|
|
10565
10585
|
const isMobile = useIsMobile();
|
|
10566
10586
|
const mergedPreviewHooks = useMemo(() => {
|
|
10567
10587
|
if (!customEmojis || customEmojis.length === 0) {
|
|
@@ -10745,17 +10765,48 @@ function BlockKitchen(props) {
|
|
|
10745
10765
|
}
|
|
10746
10766
|
),
|
|
10747
10767
|
/* @__PURE__ */ jsxs("div", { className: "flex min-h-0 flex-1 items-stretch", children: [
|
|
10748
|
-
/* @__PURE__ */
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10768
|
+
/* @__PURE__ */ jsxs("div", { className: "relative hidden min-h-0 shrink-0 md:flex", children: [
|
|
10769
|
+
/* @__PURE__ */ jsx("div", { hidden: paletteCollapsed, className: cn("min-h-0", !paletteCollapsed && "flex"), children: /* @__PURE__ */ jsx(
|
|
10770
|
+
Palette,
|
|
10771
|
+
{
|
|
10772
|
+
onAddBlock: (block) => addBlock(block),
|
|
10773
|
+
sections: paletteSections,
|
|
10774
|
+
mode: paletteMode,
|
|
10775
|
+
showSearch: showPaletteSearch,
|
|
10776
|
+
searchPlaceholder: paletteSearchPlaceholder,
|
|
10777
|
+
defaultOpenSections,
|
|
10778
|
+
defaultAdvanced: paletteAdvanced,
|
|
10779
|
+
onAdvancedChange: setPaletteAdvanced
|
|
10780
|
+
}
|
|
10781
|
+
) }),
|
|
10782
|
+
paletteCollapsed ? (
|
|
10783
|
+
// In a host that hands the builder no height of its own,
|
|
10784
|
+
// the rail is what the shell takes its height from (see
|
|
10785
|
+
// the shell's `max-h` note above) — so hiding it would
|
|
10786
|
+
// shrink the whole frame to the height of the message and
|
|
10787
|
+
// grow it back on the way out. This stands in for the rail
|
|
10788
|
+
// at no width. Inert to everything but layout.
|
|
10789
|
+
/* @__PURE__ */ jsx("div", { "aria-hidden": true, className: "w-0 shrink-0 md:h-[var(--bk-max-height,100svh)]" })
|
|
10790
|
+
) : null,
|
|
10791
|
+
/* @__PURE__ */ jsx(
|
|
10792
|
+
"button",
|
|
10793
|
+
{
|
|
10794
|
+
type: "button",
|
|
10795
|
+
onClick: () => setPaletteCollapsed((v) => !v),
|
|
10796
|
+
"aria-expanded": !paletteCollapsed,
|
|
10797
|
+
"aria-label": paletteCollapsed ? "Show block palette" : "Hide block palette",
|
|
10798
|
+
title: paletteCollapsed ? "Show block palette" : "Hide block palette",
|
|
10799
|
+
className: cn(
|
|
10800
|
+
// A hairline outline in the rail's own border color, so
|
|
10801
|
+
// the handle reads as part of the edge it rides rather
|
|
10802
|
+
// than a chevron floating loose over the border line.
|
|
10803
|
+
"absolute top-1/2 z-10 flex h-10 w-4 -translate-y-1/2 cursor-pointer appearance-none items-center justify-center rounded-sm border bg-background p-0 text-muted-foreground transition-colors hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring",
|
|
10804
|
+
paletteCollapsed ? "left-0" : "right-0 translate-x-1/2"
|
|
10805
|
+
),
|
|
10806
|
+
children: paletteCollapsed ? /* @__PURE__ */ jsx(ChevronRight, { className: "h-4 w-4", strokeWidth: 1.5 }) : /* @__PURE__ */ jsx(ChevronLeft, { className: "h-4 w-4", strokeWidth: 1.5 })
|
|
10807
|
+
}
|
|
10808
|
+
)
|
|
10809
|
+
] }),
|
|
10759
10810
|
/* @__PURE__ */ jsx(
|
|
10760
10811
|
Surface,
|
|
10761
10812
|
{
|
|
@@ -10788,8 +10839,13 @@ function BlockKitchen(props) {
|
|
|
10788
10839
|
/* @__PURE__ */ jsx(Sheet, { open: paletteOpen && isMobile, onOpenChange: setPaletteOpen, children: /* @__PURE__ */ jsxs(
|
|
10789
10840
|
SheetContent,
|
|
10790
10841
|
{
|
|
10842
|
+
ref: paletteSheetRef,
|
|
10791
10843
|
side: "bottom",
|
|
10792
10844
|
className: "bk-portal-content flex h-[85svh] max-h-[85svh] flex-col gap-3 p-0 sm:max-w-none",
|
|
10845
|
+
onOpenAutoFocus: (e) => {
|
|
10846
|
+
e.preventDefault();
|
|
10847
|
+
paletteSheetRef.current?.focus();
|
|
10848
|
+
},
|
|
10793
10849
|
children: [
|
|
10794
10850
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 px-4 pt-5", children: [
|
|
10795
10851
|
/* @__PURE__ */ jsx(SheetTitle, { children: "Add a block" }),
|
|
@@ -10807,6 +10863,8 @@ function BlockKitchen(props) {
|
|
|
10807
10863
|
showSearch: showPaletteSearch,
|
|
10808
10864
|
searchPlaceholder: paletteSearchPlaceholder,
|
|
10809
10865
|
defaultOpenSections,
|
|
10866
|
+
defaultAdvanced: paletteAdvanced,
|
|
10867
|
+
onAdvancedChange: setPaletteAdvanced,
|
|
10810
10868
|
variant: "sheet"
|
|
10811
10869
|
}
|
|
10812
10870
|
) })
|