@tightknitai/block-kitchen 0.10.1 → 0.10.3
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 +1 -1
- package/dist/helpers.cjs +1 -8
- package/dist/helpers.cjs.map +1 -1
- package/dist/helpers.d.cts +17 -11
- package/dist/helpers.d.ts +17 -11
- package/dist/helpers.js +1 -8
- package/dist/helpers.js.map +1 -1
- package/dist/index.cjs +70 -12
- 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 +70 -12
- package/dist/index.js.map +1 -1
- package/dist/{palette-C8sPJuXx.d.cts → palette-TGNFqyja.d.cts} +7 -5
- package/dist/{palette-C8sPJuXx.d.ts → palette-TGNFqyja.d.ts} +7 -5
- package/dist/palette.d.cts +1 -1
- package/dist/palette.d.ts +1 -1
- package/dist/styles.css +1 -1
- package/package.json +44 -38
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 {
|
|
4
|
-
export { A as AlertBlock,
|
|
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-TGNFqyja.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 PaletteSection, R as PaletteVariant, U as PieChart, V as PieChartSegment, W as PlanBlock, X as PreviewHooks, Y as PrimaryActionConfig, Z as PrimaryActionContext, _ as RecentMessage, $ as SendResult, a0 as SupportedBlockType, a1 as SupportedHeaderBlock, a2 as TableBlock, a3 as TableCell, a4 as TableColumnSetting, a5 as TaskCardBlock, a6 as TaskCardStatus, a7 as UpdatePayload, a8 as UpdateResult, a9 as UrlSourceElement, aa as ValidationSummary, ab as VideoBlock, ac as defaultPalette, ad as extraAlertVariant, ae as legacyInputVariants } from './palette-TGNFqyja.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 {
|
|
4
|
-
export { A as AlertBlock,
|
|
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-TGNFqyja.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 PaletteSection, R as PaletteVariant, U as PieChart, V as PieChartSegment, W as PlanBlock, X as PreviewHooks, Y as PrimaryActionConfig, Z as PrimaryActionContext, _ as RecentMessage, $ as SendResult, a0 as SupportedBlockType, a1 as SupportedHeaderBlock, a2 as TableBlock, a3 as TableCell, a4 as TableColumnSetting, a5 as TaskCardBlock, a6 as TaskCardStatus, a7 as UpdatePayload, a8 as UpdateResult, a9 as UrlSourceElement, aa as ValidationSummary, ab as VideoBlock, ac as defaultPalette, ad as extraAlertVariant, ae as legacyInputVariants } from './palette-TGNFqyja.js';
|
|
5
5
|
export { decodeBlocksFromString, encodeBlocksToString, toSlackBlocks } from './helpers.js';
|
|
6
6
|
import 'slack-web-api-client';
|
|
7
7
|
|
package/dist/index.js
CHANGED
|
@@ -1957,14 +1957,7 @@ function sanitizeBlocks(blocks) {
|
|
|
1957
1957
|
|
|
1958
1958
|
// src/lib/to-slack-blocks.ts
|
|
1959
1959
|
function toSlackBlocks(blocks) {
|
|
1960
|
-
return blocks.map((block) =>
|
|
1961
|
-
const safe = sanitizeBlock(block);
|
|
1962
|
-
if (safe.type === "header" && "level" in safe) {
|
|
1963
|
-
const { level: _omit, ...rest } = safe;
|
|
1964
|
-
return rest;
|
|
1965
|
-
}
|
|
1966
|
-
return safe;
|
|
1967
|
-
});
|
|
1960
|
+
return blocks.map((block) => sanitizeBlock(block));
|
|
1968
1961
|
}
|
|
1969
1962
|
|
|
1970
1963
|
// src/lib/validation-sanitize.ts
|
|
@@ -3881,6 +3874,27 @@ function EditorField({
|
|
|
3881
3874
|
help && /* @__PURE__ */ jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: help })
|
|
3882
3875
|
] });
|
|
3883
3876
|
}
|
|
3877
|
+
function AdvancedIdField({
|
|
3878
|
+
label,
|
|
3879
|
+
help,
|
|
3880
|
+
htmlFor,
|
|
3881
|
+
value,
|
|
3882
|
+
placeholder,
|
|
3883
|
+
onChange
|
|
3884
|
+
}) {
|
|
3885
|
+
return /* @__PURE__ */ jsxs("details", { className: "rounded-md border bg-muted/20 px-2.5 py-1.5", children: [
|
|
3886
|
+
/* @__PURE__ */ jsx("summary", { className: "cursor-pointer text-[11px] font-medium text-muted-foreground hover:text-foreground", children: "Advanced" }),
|
|
3887
|
+
/* @__PURE__ */ jsx("div", { className: "pt-2 pb-1", children: /* @__PURE__ */ jsx(EditorField, { label, help, htmlFor, children: /* @__PURE__ */ jsx(
|
|
3888
|
+
Input,
|
|
3889
|
+
{
|
|
3890
|
+
id: htmlFor,
|
|
3891
|
+
value: value ?? "",
|
|
3892
|
+
placeholder,
|
|
3893
|
+
onChange: (e) => onChange(e.target.value || void 0)
|
|
3894
|
+
}
|
|
3895
|
+
) }) })
|
|
3896
|
+
] });
|
|
3897
|
+
}
|
|
3884
3898
|
function ActionsEditor({ block, onChange }) {
|
|
3885
3899
|
const elements = block.elements ?? [];
|
|
3886
3900
|
const updateButton = (idx, update) => {
|
|
@@ -3979,7 +3993,18 @@ function ActionsEditor({ block, onChange }) {
|
|
|
3979
3993
|
/* @__PURE__ */ jsx(Label, { htmlFor: `btn-style-${idx}-${s}`, className: "text-xs capitalize", children: s })
|
|
3980
3994
|
] }, s))
|
|
3981
3995
|
}
|
|
3982
|
-
) })
|
|
3996
|
+
) }),
|
|
3997
|
+
/* @__PURE__ */ jsx(
|
|
3998
|
+
AdvancedIdField,
|
|
3999
|
+
{
|
|
4000
|
+
label: "Action ID",
|
|
4001
|
+
help: "Optional. Sent in the interaction payload so your app knows which button was clicked.",
|
|
4002
|
+
htmlFor: `btn-action-${idx}`,
|
|
4003
|
+
value: el.action_id,
|
|
4004
|
+
placeholder: "e.g. approve_request",
|
|
4005
|
+
onChange: (next) => updateButton(idx, { action_id: next })
|
|
4006
|
+
}
|
|
4007
|
+
)
|
|
3983
4008
|
] }, idx);
|
|
3984
4009
|
}),
|
|
3985
4010
|
/* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", onClick: addButton, className: "self-start", children: [
|
|
@@ -4262,7 +4287,18 @@ function ButtonsField({
|
|
|
4262
4287
|
/* @__PURE__ */ jsx(Label, { htmlFor: `${idPrefix}-btn-style-${idx}-${s}`, className: "text-xs capitalize", children: s })
|
|
4263
4288
|
] }, s))
|
|
4264
4289
|
}
|
|
4265
|
-
) })
|
|
4290
|
+
) }),
|
|
4291
|
+
/* @__PURE__ */ jsx(
|
|
4292
|
+
AdvancedIdField,
|
|
4293
|
+
{
|
|
4294
|
+
label: "Action ID",
|
|
4295
|
+
help: "Optional. Sent in the interaction payload so your app knows which button was clicked.",
|
|
4296
|
+
htmlFor: `${idPrefix}-btn-action-${idx}`,
|
|
4297
|
+
value: btn.action_id,
|
|
4298
|
+
placeholder: "e.g. open_details",
|
|
4299
|
+
onChange: (next) => update(idx, { action_id: next })
|
|
4300
|
+
}
|
|
4301
|
+
)
|
|
4266
4302
|
] }, idx);
|
|
4267
4303
|
}),
|
|
4268
4304
|
/* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", onClick: addButton, disabled: atLimit, className: "self-start", children: [
|
|
@@ -5611,7 +5647,7 @@ function HeaderEditor({ block, onChange }) {
|
|
|
5611
5647
|
] })
|
|
5612
5648
|
}
|
|
5613
5649
|
),
|
|
5614
|
-
/* @__PURE__ */ jsx(EditorField, { label: "Level", help: "Optional.
|
|
5650
|
+
/* @__PURE__ */ jsx(EditorField, { label: "Level", help: "Optional. Sets the heading size Slack renders, from H1 (largest) to H4.", children: /* @__PURE__ */ jsxs(
|
|
5615
5651
|
RadioGroup,
|
|
5616
5652
|
{
|
|
5617
5653
|
value: level === void 0 ? "default" : String(level),
|
|
@@ -8090,7 +8126,18 @@ function ButtonAccessoryFields({ button, onChange }) {
|
|
|
8090
8126
|
/* @__PURE__ */ jsx(Label, { htmlFor: `section-acc-btn-style-${s}`, className: "text-xs capitalize", children: s })
|
|
8091
8127
|
] }, s))
|
|
8092
8128
|
}
|
|
8093
|
-
) })
|
|
8129
|
+
) }),
|
|
8130
|
+
/* @__PURE__ */ jsx(
|
|
8131
|
+
AdvancedIdField,
|
|
8132
|
+
{
|
|
8133
|
+
label: "Action ID",
|
|
8134
|
+
help: "Optional. Sent in the interaction payload so your app knows which button was clicked.",
|
|
8135
|
+
htmlFor: "section-acc-btn-action",
|
|
8136
|
+
value: button.action_id,
|
|
8137
|
+
placeholder: "e.g. learn_more",
|
|
8138
|
+
onChange: (next) => onChange({ ...button, action_id: next })
|
|
8139
|
+
}
|
|
8140
|
+
)
|
|
8094
8141
|
] });
|
|
8095
8142
|
}
|
|
8096
8143
|
function ImageAccessoryFields({ image, onChange }) {
|
|
@@ -8572,6 +8619,17 @@ function BlockEditor({
|
|
|
8572
8619
|
] }) }),
|
|
8573
8620
|
errors && errors.length > 0 ? /* @__PURE__ */ jsx("ul", { className: "flex flex-col gap-0.5 rounded-md border border-destructive/30 bg-destructive/5 p-2 text-xs text-destructive", children: errors.map((err, i) => /* @__PURE__ */ jsx("li", { children: err }, i)) }) : null,
|
|
8574
8621
|
dispatch(block, onChange),
|
|
8622
|
+
/* @__PURE__ */ jsx(
|
|
8623
|
+
AdvancedIdField,
|
|
8624
|
+
{
|
|
8625
|
+
label: "Block ID",
|
|
8626
|
+
help: "Optional. Unique within the message or view. Slack returns it in interaction payloads.",
|
|
8627
|
+
htmlFor: "block-id",
|
|
8628
|
+
value: block.block_id,
|
|
8629
|
+
placeholder: "e.g. approval_row",
|
|
8630
|
+
onChange: (next) => onChange({ ...block, block_id: next })
|
|
8631
|
+
}
|
|
8632
|
+
),
|
|
8575
8633
|
onDone ? /* @__PURE__ */ jsx("div", { className: "flex justify-end border-t pt-3", children: /* @__PURE__ */ jsx(Button, { type: "button", size: "sm", onClick: onDone, children: "Done" }) }) : null
|
|
8576
8634
|
] });
|
|
8577
8635
|
}
|