@tightknitai/block-kitchen 0.10.22 → 0.10.24
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 +48 -0
- package/dist/helpers.d.cts +2 -2
- package/dist/helpers.d.ts +2 -2
- package/dist/index.cjs +220 -149
- 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 +220 -149
- package/dist/index.js.map +1 -1
- package/dist/{palette-CXXqlwIH.d.cts → palette-Bup6i-9c.d.cts} +42 -1
- package/dist/{palette-CXXqlwIH.d.ts → palette-Bup6i-9c.d.ts} +42 -1
- package/dist/palette.d.cts +1 -1
- package/dist/palette.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
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
|
|
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-Bup6i-9c.cjs';
|
|
4
|
+
export { A as AlertBlock, e as AlertLevel, f as BlockAction, g as BlockKitchenBaseProps, h as BlockKitchenComposeOnlyProps, i as BlockKitchenSendProps, j as BlockPosition, k as BrandPreset, l as BrandTheme, m as BrandTokens, n as BuilderBlock, o as CardBlock, p as CarouselBlock, q as CartesianChart, r as Chart, s as ChartAxisConfig, t as ChartDataPoint, u as ChartSeries, v as ChartType, w as ContainerBlock, x as ContainerChildBlock, y as ContextActionsBlock, z as ContextActionsElement, D as CustomEmoji, E as DataTableActionCell, F as DataTableBlock, G as DataTableCell, H as DataTableRawNumberCell, I as DataVisualizationBlock, J as EditableVia, K as FeedbackButtonSubobject, L as FeedbackButtonsElement, M as HeaderLevel, N as IconButtonElement, O as IconButtonIcon, Q as InputBlock, R as LoadMessageInput, U as LoadResult, V as LoadedMessage, W as LoadingConfig, X as MarkdownBlock, Y as MentionChannel, Z as MentionUser, _ as MentionsConfig, $ as PaletteMode, a0 as PaletteSection, a1 as PaletteVariant, a2 as PieChart, a3 as PieChartSegment, a4 as PlanBlock, a5 as PreviewHooks, a6 as PrimaryActionConfig, a7 as PrimaryActionContext, a8 as RecentMessage, a9 as SendResult, aa as SupportedBlockType, ab as SupportedHeaderBlock, ac as TableBlock, ad as TableCell, ae as TableColumnSetting, af as TableRawTextCell, ag as TaskCardBlock, ah as TaskCardStatus, ai as UpdatePayload, aj as UpdateResult, ak as UrlSourceElement, al as ValidationSummary, am as VideoBlock, an as defaultPalette, ao as extraAlertVariant, ap as legacyInputVariants } from './palette-Bup6i-9c.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
|
|
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-Bup6i-9c.js';
|
|
4
|
+
export { A as AlertBlock, e as AlertLevel, f as BlockAction, g as BlockKitchenBaseProps, h as BlockKitchenComposeOnlyProps, i as BlockKitchenSendProps, j as BlockPosition, k as BrandPreset, l as BrandTheme, m as BrandTokens, n as BuilderBlock, o as CardBlock, p as CarouselBlock, q as CartesianChart, r as Chart, s as ChartAxisConfig, t as ChartDataPoint, u as ChartSeries, v as ChartType, w as ContainerBlock, x as ContainerChildBlock, y as ContextActionsBlock, z as ContextActionsElement, D as CustomEmoji, E as DataTableActionCell, F as DataTableBlock, G as DataTableCell, H as DataTableRawNumberCell, I as DataVisualizationBlock, J as EditableVia, K as FeedbackButtonSubobject, L as FeedbackButtonsElement, M as HeaderLevel, N as IconButtonElement, O as IconButtonIcon, Q as InputBlock, R as LoadMessageInput, U as LoadResult, V as LoadedMessage, W as LoadingConfig, X as MarkdownBlock, Y as MentionChannel, Z as MentionUser, _ as MentionsConfig, $ as PaletteMode, a0 as PaletteSection, a1 as PaletteVariant, a2 as PieChart, a3 as PieChartSegment, a4 as PlanBlock, a5 as PreviewHooks, a6 as PrimaryActionConfig, a7 as PrimaryActionContext, a8 as RecentMessage, a9 as SendResult, aa as SupportedBlockType, ab as SupportedHeaderBlock, ac as TableBlock, ad as TableCell, ae as TableColumnSetting, af as TableRawTextCell, ag as TaskCardBlock, ah as TaskCardStatus, ai as UpdatePayload, aj as UpdateResult, ak as UrlSourceElement, al as ValidationSummary, am as VideoBlock, an as defaultPalette, ao as extraAlertVariant, ap as legacyInputVariants } from './palette-Bup6i-9c.js';
|
|
5
5
|
export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.js';
|
|
6
6
|
import 'slack-web-api-client';
|
|
7
7
|
|
package/dist/index.js
CHANGED
|
@@ -4601,6 +4601,40 @@ function SendDialog({
|
|
|
4601
4601
|
] })
|
|
4602
4602
|
] }) });
|
|
4603
4603
|
}
|
|
4604
|
+
function BlockActionButtons({
|
|
4605
|
+
actions,
|
|
4606
|
+
position,
|
|
4607
|
+
variant
|
|
4608
|
+
}) {
|
|
4609
|
+
if (!actions?.length || !position) {
|
|
4610
|
+
return null;
|
|
4611
|
+
}
|
|
4612
|
+
return actions.map(
|
|
4613
|
+
(action) => variant === "toolbar" ? /* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
4614
|
+
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
4615
|
+
"button",
|
|
4616
|
+
{
|
|
4617
|
+
type: "button",
|
|
4618
|
+
"aria-label": action.label,
|
|
4619
|
+
onClick: () => action.onSelect(position),
|
|
4620
|
+
className: "flex h-6 w-6 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring [&_svg]:h-3.5 [&_svg]:w-3.5",
|
|
4621
|
+
children: action.icon
|
|
4622
|
+
}
|
|
4623
|
+
) }),
|
|
4624
|
+
/* @__PURE__ */ jsx(TooltipContent, { side: "top", children: action.label })
|
|
4625
|
+
] }, action.id) : /* @__PURE__ */ jsx(
|
|
4626
|
+
"button",
|
|
4627
|
+
{
|
|
4628
|
+
type: "button",
|
|
4629
|
+
"aria-label": action.label,
|
|
4630
|
+
onClick: () => action.onSelect(position),
|
|
4631
|
+
className: "flex h-9 w-9 items-center justify-center rounded text-muted-foreground hover:bg-accent hover:text-foreground [&_svg]:h-4 [&_svg]:w-4",
|
|
4632
|
+
children: action.icon
|
|
4633
|
+
},
|
|
4634
|
+
action.id
|
|
4635
|
+
)
|
|
4636
|
+
);
|
|
4637
|
+
}
|
|
4604
4638
|
var RadioGroup = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, { className: cn("grid gap-2", className), ...props, ref }));
|
|
4605
4639
|
RadioGroup.displayName = RadioGroupPrimitive.Root.displayName;
|
|
4606
4640
|
var RadioGroupItem = React.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
@@ -10435,7 +10469,10 @@ function BlockRow({
|
|
|
10435
10469
|
index,
|
|
10436
10470
|
total,
|
|
10437
10471
|
onReorder,
|
|
10438
|
-
isPaletteDrag = false
|
|
10472
|
+
isPaletteDrag = false,
|
|
10473
|
+
position,
|
|
10474
|
+
blockActions,
|
|
10475
|
+
renderBlockAdornment
|
|
10439
10476
|
}) {
|
|
10440
10477
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging, isOver } = useSortable({
|
|
10441
10478
|
id: builderBlock.id
|
|
@@ -10450,11 +10487,70 @@ function BlockRow({
|
|
|
10450
10487
|
const [inlineEditing, setInlineEditing] = useState(false);
|
|
10451
10488
|
const showDropIndicator = isPaletteDrag && isOver;
|
|
10452
10489
|
const preview = /* @__PURE__ */ jsx(SlackBlockPreview, { block: builderBlock.block, hooks: previewHooks, theme: previewTheme });
|
|
10490
|
+
const body = isRichText && inlineEditing ? /* @__PURE__ */ jsx(
|
|
10491
|
+
RichTextInlineEditor,
|
|
10492
|
+
{
|
|
10493
|
+
block: builderBlock.block,
|
|
10494
|
+
onSave: (next) => {
|
|
10495
|
+
onUpdate(builderBlock.id, next);
|
|
10496
|
+
setInlineEditing(false);
|
|
10497
|
+
},
|
|
10498
|
+
onCancel: () => setInlineEditing(false)
|
|
10499
|
+
}
|
|
10500
|
+
) : isRichText ? /* @__PURE__ */ jsx(
|
|
10501
|
+
"button",
|
|
10502
|
+
{
|
|
10503
|
+
type: "button",
|
|
10504
|
+
"aria-label": "Edit block",
|
|
10505
|
+
onClick: () => setInlineEditing(true),
|
|
10506
|
+
...attributes,
|
|
10507
|
+
...listeners,
|
|
10508
|
+
className: cn(
|
|
10509
|
+
"block w-full cursor-grab rounded-sm border-0 bg-transparent p-0 text-left transition-shadow hover:shadow-md focus-visible:ring-1 focus-visible:ring-ring active:cursor-grabbing",
|
|
10510
|
+
hasErrors ? "ring-1 ring-destructive/60 hover:ring-destructive" : "hover:ring-1 hover:ring-border"
|
|
10511
|
+
),
|
|
10512
|
+
children: preview
|
|
10513
|
+
}
|
|
10514
|
+
) : /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange, children: [
|
|
10515
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
10516
|
+
"div",
|
|
10517
|
+
{
|
|
10518
|
+
role: "button",
|
|
10519
|
+
tabIndex: 0,
|
|
10520
|
+
"aria-label": "Edit block",
|
|
10521
|
+
...sortableA11yAttrs,
|
|
10522
|
+
...listeners,
|
|
10523
|
+
onKeyDown: (e) => {
|
|
10524
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
10525
|
+
e.preventDefault();
|
|
10526
|
+
onOpenChange?.(!isOpen);
|
|
10527
|
+
}
|
|
10528
|
+
},
|
|
10529
|
+
className: cn(
|
|
10530
|
+
"block w-full cursor-grab rounded-sm transition-shadow hover:shadow-md focus-visible:ring-1 focus-visible:ring-ring active:cursor-grabbing",
|
|
10531
|
+
hasErrors ? "ring-1 ring-destructive/60 hover:ring-destructive" : "hover:ring-1 hover:ring-border"
|
|
10532
|
+
),
|
|
10533
|
+
children: preview
|
|
10534
|
+
}
|
|
10535
|
+
) }),
|
|
10536
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-[min(32rem,calc(100vw-1.5rem))] sm:w-[32rem]", align: "start", children: /* @__PURE__ */ jsx(
|
|
10537
|
+
BlockEditor,
|
|
10538
|
+
{
|
|
10539
|
+
block: builderBlock.block,
|
|
10540
|
+
errors,
|
|
10541
|
+
onChange: (next) => onUpdate(builderBlock.id, next),
|
|
10542
|
+
onDone: () => onOpenChange?.(false)
|
|
10543
|
+
}
|
|
10544
|
+
) })
|
|
10545
|
+
] });
|
|
10546
|
+
const adornment = position && renderBlockAdornment?.(position);
|
|
10453
10547
|
return /* @__PURE__ */ jsxs(
|
|
10454
10548
|
"div",
|
|
10455
10549
|
{
|
|
10456
10550
|
ref: setNodeRef,
|
|
10457
10551
|
style,
|
|
10552
|
+
"data-bk-block-index": position?.index,
|
|
10553
|
+
"data-bk-child-index": position?.childIndex ?? void 0,
|
|
10458
10554
|
className: cn("group relative mb-2 last:mb-0 hover:z-10 md:mb-0", isDragging && "opacity-40"),
|
|
10459
10555
|
children: [
|
|
10460
10556
|
showDropIndicator ? /* @__PURE__ */ jsx(
|
|
@@ -10466,62 +10562,10 @@ function BlockRow({
|
|
|
10466
10562
|
}
|
|
10467
10563
|
) : null,
|
|
10468
10564
|
/* @__PURE__ */ jsxs("div", { className: "relative w-full", children: [
|
|
10469
|
-
|
|
10470
|
-
|
|
10471
|
-
{
|
|
10472
|
-
|
|
10473
|
-
onSave: (next) => {
|
|
10474
|
-
onUpdate(builderBlock.id, next);
|
|
10475
|
-
setInlineEditing(false);
|
|
10476
|
-
},
|
|
10477
|
-
onCancel: () => setInlineEditing(false)
|
|
10478
|
-
}
|
|
10479
|
-
) : isRichText ? /* @__PURE__ */ jsx(
|
|
10480
|
-
"button",
|
|
10481
|
-
{
|
|
10482
|
-
type: "button",
|
|
10483
|
-
"aria-label": "Edit block",
|
|
10484
|
-
onClick: () => setInlineEditing(true),
|
|
10485
|
-
...attributes,
|
|
10486
|
-
...listeners,
|
|
10487
|
-
className: cn(
|
|
10488
|
-
"block w-full cursor-grab rounded-sm border-0 bg-transparent p-0 text-left transition-shadow hover:shadow-md focus-visible:ring-1 focus-visible:ring-ring active:cursor-grabbing",
|
|
10489
|
-
hasErrors ? "ring-1 ring-destructive/60 hover:ring-destructive" : "hover:ring-1 hover:ring-border"
|
|
10490
|
-
),
|
|
10491
|
-
children: preview
|
|
10492
|
-
}
|
|
10493
|
-
) : /* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange, children: [
|
|
10494
|
-
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
10495
|
-
"div",
|
|
10496
|
-
{
|
|
10497
|
-
role: "button",
|
|
10498
|
-
tabIndex: 0,
|
|
10499
|
-
"aria-label": "Edit block",
|
|
10500
|
-
...sortableA11yAttrs,
|
|
10501
|
-
...listeners,
|
|
10502
|
-
onKeyDown: (e) => {
|
|
10503
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
10504
|
-
e.preventDefault();
|
|
10505
|
-
onOpenChange?.(!isOpen);
|
|
10506
|
-
}
|
|
10507
|
-
},
|
|
10508
|
-
className: cn(
|
|
10509
|
-
"block w-full cursor-grab rounded-sm transition-shadow hover:shadow-md focus-visible:ring-1 focus-visible:ring-ring active:cursor-grabbing",
|
|
10510
|
-
hasErrors ? "ring-1 ring-destructive/60 hover:ring-destructive" : "hover:ring-1 hover:ring-border"
|
|
10511
|
-
),
|
|
10512
|
-
children: preview
|
|
10513
|
-
}
|
|
10514
|
-
) }),
|
|
10515
|
-
/* @__PURE__ */ jsx(PopoverContent, { className: "w-[min(32rem,calc(100vw-1.5rem))] sm:w-[32rem]", align: "start", children: /* @__PURE__ */ jsx(
|
|
10516
|
-
BlockEditor,
|
|
10517
|
-
{
|
|
10518
|
-
block: builderBlock.block,
|
|
10519
|
-
errors,
|
|
10520
|
-
onChange: (next) => onUpdate(builderBlock.id, next),
|
|
10521
|
-
onDone: () => onOpenChange?.(false)
|
|
10522
|
-
}
|
|
10523
|
-
) })
|
|
10524
|
-
] }),
|
|
10565
|
+
renderBlockAdornment ? /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
10566
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: body }),
|
|
10567
|
+
adornment != null && adornment !== false ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: adornment }) : null
|
|
10568
|
+
] }) : body,
|
|
10525
10569
|
/* @__PURE__ */ jsx("span", { className: "-translate-x-1/2 pointer-events-none absolute bottom-full left-1/2 z-10 hidden bg-background px-1.5 text-[11px] text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 md:block", children: BLOCK_TYPE_LABELS[builderBlock.block.type] }),
|
|
10526
10570
|
/* @__PURE__ */ jsxs(
|
|
10527
10571
|
"div",
|
|
@@ -10587,6 +10631,7 @@ function BlockRow({
|
|
|
10587
10631
|
/* @__PURE__ */ jsx(TooltipContent, { side: "top", children: "Move down" })
|
|
10588
10632
|
] })
|
|
10589
10633
|
] }) : null,
|
|
10634
|
+
/* @__PURE__ */ jsx(BlockActionButtons, { actions: blockActions, position, variant: "toolbar" }),
|
|
10590
10635
|
/* @__PURE__ */ jsxs(Tooltip, { children: [
|
|
10591
10636
|
/* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
10592
10637
|
"button",
|
|
@@ -10649,6 +10694,7 @@ function BlockRow({
|
|
|
10649
10694
|
children: /* @__PURE__ */ jsx(AlertTriangle, { className: "h-4 w-4" })
|
|
10650
10695
|
}
|
|
10651
10696
|
) : null,
|
|
10697
|
+
/* @__PURE__ */ jsx(BlockActionButtons, { actions: blockActions, position, variant: "inline" }),
|
|
10652
10698
|
/* @__PURE__ */ jsx(
|
|
10653
10699
|
"button",
|
|
10654
10700
|
{
|
|
@@ -10730,7 +10776,9 @@ function ContainerRow({
|
|
|
10730
10776
|
onReorder,
|
|
10731
10777
|
index,
|
|
10732
10778
|
total,
|
|
10733
|
-
isPaletteDrag = false
|
|
10779
|
+
isPaletteDrag = false,
|
|
10780
|
+
blockActions,
|
|
10781
|
+
renderBlockAdornment
|
|
10734
10782
|
}) {
|
|
10735
10783
|
const { id } = builderBlock;
|
|
10736
10784
|
const block = builderBlock.block;
|
|
@@ -10743,102 +10791,112 @@ function ContainerRow({
|
|
|
10743
10791
|
const { setNodeRef: setBodyRef, isOver: isBodyOver } = useDroppable({ id: containerBodyId(id) });
|
|
10744
10792
|
const style = { transform: CSS.Transform.toString(transform), transition };
|
|
10745
10793
|
const icon = block.icon && "image_url" in block.icon ? block.icon.image_url : void 0;
|
|
10746
|
-
|
|
10794
|
+
const position = typeof index === "number" ? { index, childIndex: null } : void 0;
|
|
10795
|
+
const adornment = position && renderBlockAdornment?.(position);
|
|
10796
|
+
const card = /* @__PURE__ */ jsxs(
|
|
10747
10797
|
"div",
|
|
10748
10798
|
{
|
|
10749
|
-
|
|
10750
|
-
|
|
10751
|
-
|
|
10799
|
+
className: cn(
|
|
10800
|
+
"overflow-hidden rounded-md border bg-card transition-shadow",
|
|
10801
|
+
hasErrors ? "border-destructive/60" : "border-border"
|
|
10802
|
+
),
|
|
10752
10803
|
children: [
|
|
10753
|
-
/* @__PURE__ */ jsxs(
|
|
10804
|
+
/* @__PURE__ */ jsxs(Popover, { open: isOpen, onOpenChange: (open) => onOpenBlockChange?.(open ? id : null), children: [
|
|
10805
|
+
/* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
10806
|
+
"div",
|
|
10807
|
+
{
|
|
10808
|
+
role: "button",
|
|
10809
|
+
tabIndex: 0,
|
|
10810
|
+
"aria-label": "Edit container",
|
|
10811
|
+
...sortableA11yAttrs,
|
|
10812
|
+
...listeners,
|
|
10813
|
+
onKeyDown: (e) => {
|
|
10814
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
10815
|
+
e.preventDefault();
|
|
10816
|
+
onOpenBlockChange?.(!isOpen ? id : null);
|
|
10817
|
+
}
|
|
10818
|
+
},
|
|
10819
|
+
className: "flex w-full cursor-grab items-center gap-2 border-b bg-muted/40 px-3 py-2 text-left transition-colors hover:bg-muted active:cursor-grabbing",
|
|
10820
|
+
children: [
|
|
10821
|
+
icon ? /* @__PURE__ */ jsx("img", { src: icon, alt: "", "aria-hidden": "true", className: "h-5 w-5 shrink-0 rounded object-cover" }) : null,
|
|
10822
|
+
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-col", children: [
|
|
10823
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-xs font-semibold text-foreground", children: containerTitleText(block) || "Container" }),
|
|
10824
|
+
block.subtitle?.text ? /* @__PURE__ */ jsx("span", { className: "truncate text-[11px] text-muted-foreground", children: block.subtitle.text }) : null
|
|
10825
|
+
] }),
|
|
10826
|
+
/* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: "Container" })
|
|
10827
|
+
]
|
|
10828
|
+
}
|
|
10829
|
+
) }),
|
|
10830
|
+
/* @__PURE__ */ jsx(PopoverContent, { className: "w-[min(32rem,calc(100vw-1.5rem))] sm:w-[32rem]", align: "start", children: /* @__PURE__ */ jsx(
|
|
10831
|
+
BlockEditor,
|
|
10832
|
+
{
|
|
10833
|
+
block,
|
|
10834
|
+
errors,
|
|
10835
|
+
onChange: (next) => onUpdate(id, next),
|
|
10836
|
+
onDone: () => onOpenBlockChange?.(null)
|
|
10837
|
+
}
|
|
10838
|
+
) })
|
|
10839
|
+
] }),
|
|
10840
|
+
/* @__PURE__ */ jsx(
|
|
10754
10841
|
"div",
|
|
10755
10842
|
{
|
|
10843
|
+
ref: setBodyRef,
|
|
10756
10844
|
className: cn(
|
|
10757
|
-
"
|
|
10758
|
-
|
|
10845
|
+
"flex flex-col gap-2 p-3 transition-colors",
|
|
10846
|
+
isPaletteDrag && "outline-2 -outline-offset-2 outline-dashed outline-primary/40",
|
|
10847
|
+
isPaletteDrag && isBodyOver && "bg-primary/5"
|
|
10759
10848
|
),
|
|
10760
|
-
children:
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
e.preventDefault();
|
|
10773
|
-
onOpenBlockChange?.(!isOpen ? id : null);
|
|
10774
|
-
}
|
|
10775
|
-
},
|
|
10776
|
-
className: "flex w-full cursor-grab items-center gap-2 border-b bg-muted/40 px-3 py-2 text-left transition-colors hover:bg-muted active:cursor-grabbing",
|
|
10777
|
-
children: [
|
|
10778
|
-
icon ? /* @__PURE__ */ jsx("img", { src: icon, alt: "", "aria-hidden": "true", className: "h-5 w-5 shrink-0 rounded object-cover" }) : null,
|
|
10779
|
-
/* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-col", children: [
|
|
10780
|
-
/* @__PURE__ */ jsx("span", { className: "truncate text-xs font-semibold text-foreground", children: containerTitleText(block) || "Container" }),
|
|
10781
|
-
block.subtitle?.text ? /* @__PURE__ */ jsx("span", { className: "truncate text-[11px] text-muted-foreground", children: block.subtitle.text }) : null
|
|
10782
|
-
] }),
|
|
10783
|
-
/* @__PURE__ */ jsx("span", { className: "ml-auto shrink-0 text-[10px] font-medium uppercase tracking-wide text-muted-foreground", children: "Container" })
|
|
10784
|
-
]
|
|
10785
|
-
}
|
|
10786
|
-
) }),
|
|
10787
|
-
/* @__PURE__ */ jsx(PopoverContent, { className: "w-[min(32rem,calc(100vw-1.5rem))] sm:w-[32rem]", align: "start", children: /* @__PURE__ */ jsx(
|
|
10788
|
-
BlockEditor,
|
|
10789
|
-
{
|
|
10790
|
-
block,
|
|
10791
|
-
errors,
|
|
10792
|
-
onChange: (next) => onUpdate(id, next),
|
|
10793
|
-
onDone: () => onOpenBlockChange?.(null)
|
|
10794
|
-
}
|
|
10795
|
-
) })
|
|
10796
|
-
] }),
|
|
10797
|
-
/* @__PURE__ */ jsx(
|
|
10798
|
-
"div",
|
|
10849
|
+
children: children.length === 0 ? /* @__PURE__ */ jsx(
|
|
10850
|
+
"div",
|
|
10851
|
+
{
|
|
10852
|
+
className: cn(
|
|
10853
|
+
"flex items-center justify-center rounded-md border border-dashed px-3 py-6 text-center text-[11px] transition-colors",
|
|
10854
|
+
isBodyOver ? "border-primary/60 text-primary" : "border-border text-muted-foreground"
|
|
10855
|
+
),
|
|
10856
|
+
children: "Drag blocks here"
|
|
10857
|
+
}
|
|
10858
|
+
) : /* @__PURE__ */ jsxs(SortableContext, { items: children.map((c) => c.id), strategy: verticalListSortingStrategy, children: [
|
|
10859
|
+
children.map((child, idx) => /* @__PURE__ */ jsx(
|
|
10860
|
+
BlockRow,
|
|
10799
10861
|
{
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10805
|
-
),
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
|
|
10818
|
-
|
|
10819
|
-
|
|
10820
|
-
|
|
10821
|
-
previewTheme,
|
|
10822
|
-
errors: errorsByBlockId?.get(child.id),
|
|
10823
|
-
isOpen: openBlockId === child.id,
|
|
10824
|
-
onOpenChange: (open) => onOpenBlockChange?.(open ? child.id : null),
|
|
10825
|
-
onUpdate,
|
|
10826
|
-
onDuplicate,
|
|
10827
|
-
onDelete,
|
|
10828
|
-
index: idx,
|
|
10829
|
-
total: children.length,
|
|
10830
|
-
onReorder,
|
|
10831
|
-
isPaletteDrag
|
|
10832
|
-
},
|
|
10833
|
-
child.id
|
|
10834
|
-
)),
|
|
10835
|
-
isPaletteDrag && isBodyOver ? /* @__PURE__ */ jsx(DropIndicator, {}) : null
|
|
10836
|
-
] })
|
|
10837
|
-
}
|
|
10838
|
-
)
|
|
10839
|
-
]
|
|
10862
|
+
builderBlock: child,
|
|
10863
|
+
previewHooks,
|
|
10864
|
+
previewTheme,
|
|
10865
|
+
errors: errorsByBlockId?.get(child.id),
|
|
10866
|
+
isOpen: openBlockId === child.id,
|
|
10867
|
+
onOpenChange: (open) => onOpenBlockChange?.(open ? child.id : null),
|
|
10868
|
+
onUpdate,
|
|
10869
|
+
onDuplicate,
|
|
10870
|
+
onDelete,
|
|
10871
|
+
index: idx,
|
|
10872
|
+
total: children.length,
|
|
10873
|
+
onReorder,
|
|
10874
|
+
isPaletteDrag,
|
|
10875
|
+
position: typeof index === "number" ? { index, childIndex: idx } : void 0,
|
|
10876
|
+
blockActions,
|
|
10877
|
+
renderBlockAdornment
|
|
10878
|
+
},
|
|
10879
|
+
child.id
|
|
10880
|
+
)),
|
|
10881
|
+
isPaletteDrag && isBodyOver ? /* @__PURE__ */ jsx(DropIndicator, {}) : null
|
|
10882
|
+
] })
|
|
10840
10883
|
}
|
|
10841
|
-
)
|
|
10884
|
+
)
|
|
10885
|
+
]
|
|
10886
|
+
}
|
|
10887
|
+
);
|
|
10888
|
+
return /* @__PURE__ */ jsxs(
|
|
10889
|
+
"div",
|
|
10890
|
+
{
|
|
10891
|
+
ref: setNodeRef,
|
|
10892
|
+
style,
|
|
10893
|
+
"data-bk-block-index": index,
|
|
10894
|
+
className: cn("group/container relative mb-2 last:mb-0 hover:z-10", isDragging && "opacity-40"),
|
|
10895
|
+
children: [
|
|
10896
|
+
renderBlockAdornment ? /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-2", children: [
|
|
10897
|
+
/* @__PURE__ */ jsx("div", { className: "min-w-0 flex-1", children: card }),
|
|
10898
|
+
adornment != null && adornment !== false ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: adornment }) : null
|
|
10899
|
+
] }) : card,
|
|
10842
10900
|
/* @__PURE__ */ jsxs(
|
|
10843
10901
|
"div",
|
|
10844
10902
|
{
|
|
@@ -10871,6 +10929,7 @@ function ContainerRow({
|
|
|
10871
10929
|
/* @__PURE__ */ jsx(ToolbarButton2, { label: "Move up", disabled: index === 0, onClick: () => onReorder(id, index - 1), children: /* @__PURE__ */ jsx(ArrowUp, { className: "h-3.5 w-3.5" }) }),
|
|
10872
10930
|
/* @__PURE__ */ jsx(ToolbarButton2, { label: "Move down", disabled: index >= total - 1, onClick: () => onReorder(id, index + 1), children: /* @__PURE__ */ jsx(ArrowDown, { className: "h-3.5 w-3.5" }) })
|
|
10873
10931
|
] }) : null,
|
|
10932
|
+
/* @__PURE__ */ jsx(BlockActionButtons, { actions: blockActions, position, variant: "toolbar" }),
|
|
10874
10933
|
/* @__PURE__ */ jsx(ToolbarButton2, { label: "Edit", onClick: () => onOpenBlockChange?.(id), children: /* @__PURE__ */ jsx(Pencil, { className: "h-3.5 w-3.5" }) }),
|
|
10875
10934
|
/* @__PURE__ */ jsx(ToolbarButton2, { label: "Duplicate", onClick: () => onDuplicate(id), children: /* @__PURE__ */ jsx(Copy, { className: "h-3.5 w-3.5" }) }),
|
|
10876
10935
|
/* @__PURE__ */ jsx(ToolbarButton2, { label: "Delete", destructive: true, onClick: () => onDelete(id), children: /* @__PURE__ */ jsx(Trash2, { className: "h-3.5 w-3.5" }) })
|
|
@@ -10880,6 +10939,7 @@ function ContainerRow({
|
|
|
10880
10939
|
/* @__PURE__ */ jsxs("div", { className: "mt-1 flex items-center justify-between gap-2 rounded-md border border-dashed bg-muted/40 px-2 py-1 md:hidden", children: [
|
|
10881
10940
|
/* @__PURE__ */ jsx("span", { className: "truncate text-[11px] font-medium text-muted-foreground", children: "Container" }),
|
|
10882
10941
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1", children: [
|
|
10942
|
+
/* @__PURE__ */ jsx(BlockActionButtons, { actions: blockActions, position, variant: "inline" }),
|
|
10883
10943
|
/* @__PURE__ */ jsx(
|
|
10884
10944
|
"button",
|
|
10885
10945
|
{
|
|
@@ -10961,7 +11021,9 @@ function Surface({
|
|
|
10961
11021
|
onDelete,
|
|
10962
11022
|
onReorder,
|
|
10963
11023
|
isPaletteDrag = false,
|
|
10964
|
-
onOpenPalette
|
|
11024
|
+
onOpenPalette,
|
|
11025
|
+
blockActions,
|
|
11026
|
+
renderBlockAdornment
|
|
10965
11027
|
}) {
|
|
10966
11028
|
const { setNodeRef, isOver } = useDroppable({ id: SURFACE_DROPPABLE_ID });
|
|
10967
11029
|
const isDark = previewTheme === "dark";
|
|
@@ -10993,7 +11055,9 @@ function Surface({
|
|
|
10993
11055
|
index: idx,
|
|
10994
11056
|
total: blocks.length,
|
|
10995
11057
|
onReorder,
|
|
10996
|
-
isPaletteDrag
|
|
11058
|
+
isPaletteDrag,
|
|
11059
|
+
blockActions,
|
|
11060
|
+
renderBlockAdornment
|
|
10997
11061
|
},
|
|
10998
11062
|
block.id
|
|
10999
11063
|
) : /* @__PURE__ */ jsx(
|
|
@@ -11011,7 +11075,10 @@ function Surface({
|
|
|
11011
11075
|
index: idx,
|
|
11012
11076
|
total: blocks.length,
|
|
11013
11077
|
onReorder,
|
|
11014
|
-
isPaletteDrag
|
|
11078
|
+
isPaletteDrag,
|
|
11079
|
+
position: { index: idx, childIndex: null },
|
|
11080
|
+
blockActions,
|
|
11081
|
+
renderBlockAdornment
|
|
11015
11082
|
},
|
|
11016
11083
|
block.id
|
|
11017
11084
|
)
|
|
@@ -11769,6 +11836,8 @@ function BlockKitchen(props) {
|
|
|
11769
11836
|
onChange,
|
|
11770
11837
|
onValidationChange,
|
|
11771
11838
|
previewHooks,
|
|
11839
|
+
blockActions,
|
|
11840
|
+
renderBlockAdornment,
|
|
11772
11841
|
customEmojis,
|
|
11773
11842
|
mentions,
|
|
11774
11843
|
loadChannels,
|
|
@@ -12149,7 +12218,9 @@ function BlockKitchen(props) {
|
|
|
12149
12218
|
onDelete: removeBlock,
|
|
12150
12219
|
onReorder: reorderBlock,
|
|
12151
12220
|
isPaletteDrag: activePaletteVariant !== null,
|
|
12152
|
-
onOpenPalette: () => setPaletteOpen(true)
|
|
12221
|
+
onOpenPalette: () => setPaletteOpen(true),
|
|
12222
|
+
blockActions,
|
|
12223
|
+
renderBlockAdornment
|
|
12153
12224
|
}
|
|
12154
12225
|
) })
|
|
12155
12226
|
] })
|