@tightknitai/block-kitchen 0.10.8 → 0.10.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.
- package/dist/index.cjs +81 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +81 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6112,12 +6112,44 @@ function HeaderEditor({ block, onChange }) {
|
|
|
6112
6112
|
] });
|
|
6113
6113
|
}
|
|
6114
6114
|
function ImageEditor({ block, onChange }) {
|
|
6115
|
-
|
|
6116
|
-
return /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-muted-foreground", children: "This image references a Slack file. Not editable in the visual builder." });
|
|
6117
|
-
}
|
|
6115
|
+
const source = "slack_file" in block ? "slack_file" : "url";
|
|
6118
6116
|
const titleText = block.title?.text ?? "";
|
|
6117
|
+
const setSource = (next) => {
|
|
6118
|
+
if (next === source) {
|
|
6119
|
+
return;
|
|
6120
|
+
}
|
|
6121
|
+
if (next === "url") {
|
|
6122
|
+
const { slack_file: _omit, ...rest } = block;
|
|
6123
|
+
onChange({ image_url: "", ...rest });
|
|
6124
|
+
} else {
|
|
6125
|
+
const { image_url: _omit, ...rest } = block;
|
|
6126
|
+
onChange({ slack_file: { id: "" }, ...rest });
|
|
6127
|
+
}
|
|
6128
|
+
};
|
|
6119
6129
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
6120
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6130
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6131
|
+
EditorField,
|
|
6132
|
+
{
|
|
6133
|
+
label: "Image source",
|
|
6134
|
+
help: "Where the image comes from: a public URL, or a file already uploaded to your Slack workspace.",
|
|
6135
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6136
|
+
RadioGroup,
|
|
6137
|
+
{
|
|
6138
|
+
value: source,
|
|
6139
|
+
onValueChange: (v) => setSource(v),
|
|
6140
|
+
className: "flex flex-row flex-wrap gap-3",
|
|
6141
|
+
children: [
|
|
6142
|
+
["url", "Public URL"],
|
|
6143
|
+
["slack_file", "Slack file"]
|
|
6144
|
+
].map(([value, label]) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
6145
|
+
/* @__PURE__ */ jsxRuntime.jsx(RadioGroupItem, { value, id: `img-source-${value}` }),
|
|
6146
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: `img-source-${value}`, className: "text-xs", children: label })
|
|
6147
|
+
] }, value))
|
|
6148
|
+
}
|
|
6149
|
+
)
|
|
6150
|
+
}
|
|
6151
|
+
),
|
|
6152
|
+
"slack_file" in block ? /* @__PURE__ */ jsxRuntime.jsx(SlackFileFields, { block, onChange }) : /* @__PURE__ */ jsxRuntime.jsx(EditorField, { label: "Image URL", help: "A publicly accessible image URL (PNG, JPG, GIF).", htmlFor: "img-url", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6121
6153
|
Input,
|
|
6122
6154
|
{
|
|
6123
6155
|
id: "img-url",
|
|
@@ -6161,6 +6193,51 @@ function ImageEditor({ block, onChange }) {
|
|
|
6161
6193
|
) })
|
|
6162
6194
|
] });
|
|
6163
6195
|
}
|
|
6196
|
+
function SlackFileFields({
|
|
6197
|
+
block,
|
|
6198
|
+
onChange
|
|
6199
|
+
}) {
|
|
6200
|
+
const fileId = "id" in block.slack_file ? block.slack_file.id : "";
|
|
6201
|
+
const fileUrl = "url" in block.slack_file ? block.slack_file.url : "";
|
|
6202
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
6203
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "References a file already uploaded to your Slack workspace. The preview can't render workspace files \u2014 switch the source to Public URL to see the image here." }),
|
|
6204
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6205
|
+
EditorField,
|
|
6206
|
+
{
|
|
6207
|
+
label: "File ID",
|
|
6208
|
+
help: "The Slack file's ID. Slack accepts an ID or a URL, not both, so filling this clears File URL.",
|
|
6209
|
+
htmlFor: "img-file-id",
|
|
6210
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6211
|
+
Input,
|
|
6212
|
+
{
|
|
6213
|
+
id: "img-file-id",
|
|
6214
|
+
value: fileId,
|
|
6215
|
+
placeholder: "e.g. F0123456789",
|
|
6216
|
+
onChange: (e) => onChange({ ...block, slack_file: { id: e.target.value } })
|
|
6217
|
+
}
|
|
6218
|
+
)
|
|
6219
|
+
}
|
|
6220
|
+
),
|
|
6221
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
6222
|
+
EditorField,
|
|
6223
|
+
{
|
|
6224
|
+
label: "File URL",
|
|
6225
|
+
help: "The file's Slack-hosted URL. Filling this clears File ID.",
|
|
6226
|
+
htmlFor: "img-file-url",
|
|
6227
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
6228
|
+
Input,
|
|
6229
|
+
{
|
|
6230
|
+
id: "img-file-url",
|
|
6231
|
+
type: "url",
|
|
6232
|
+
value: fileUrl,
|
|
6233
|
+
placeholder: "e.g. https://files.slack.com/files-pri/T0123-F0123/image.png",
|
|
6234
|
+
onChange: (e) => onChange({ ...block, slack_file: { url: e.target.value } })
|
|
6235
|
+
}
|
|
6236
|
+
)
|
|
6237
|
+
}
|
|
6238
|
+
)
|
|
6239
|
+
] });
|
|
6240
|
+
}
|
|
6164
6241
|
function InputEditor({ block, onChange }) {
|
|
6165
6242
|
const updateElement = (next) => {
|
|
6166
6243
|
onChange({ ...block, element: next });
|