@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.js
CHANGED
|
@@ -6082,12 +6082,44 @@ function HeaderEditor({ block, onChange }) {
|
|
|
6082
6082
|
] });
|
|
6083
6083
|
}
|
|
6084
6084
|
function ImageEditor({ block, onChange }) {
|
|
6085
|
-
|
|
6086
|
-
return /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: "This image references a Slack file. Not editable in the visual builder." });
|
|
6087
|
-
}
|
|
6085
|
+
const source = "slack_file" in block ? "slack_file" : "url";
|
|
6088
6086
|
const titleText = block.title?.text ?? "";
|
|
6087
|
+
const setSource = (next) => {
|
|
6088
|
+
if (next === source) {
|
|
6089
|
+
return;
|
|
6090
|
+
}
|
|
6091
|
+
if (next === "url") {
|
|
6092
|
+
const { slack_file: _omit, ...rest } = block;
|
|
6093
|
+
onChange({ image_url: "", ...rest });
|
|
6094
|
+
} else {
|
|
6095
|
+
const { image_url: _omit, ...rest } = block;
|
|
6096
|
+
onChange({ slack_file: { id: "" }, ...rest });
|
|
6097
|
+
}
|
|
6098
|
+
};
|
|
6089
6099
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
6090
|
-
/* @__PURE__ */ jsx(
|
|
6100
|
+
/* @__PURE__ */ jsx(
|
|
6101
|
+
EditorField,
|
|
6102
|
+
{
|
|
6103
|
+
label: "Image source",
|
|
6104
|
+
help: "Where the image comes from: a public URL, or a file already uploaded to your Slack workspace.",
|
|
6105
|
+
children: /* @__PURE__ */ jsx(
|
|
6106
|
+
RadioGroup,
|
|
6107
|
+
{
|
|
6108
|
+
value: source,
|
|
6109
|
+
onValueChange: (v) => setSource(v),
|
|
6110
|
+
className: "flex flex-row flex-wrap gap-3",
|
|
6111
|
+
children: [
|
|
6112
|
+
["url", "Public URL"],
|
|
6113
|
+
["slack_file", "Slack file"]
|
|
6114
|
+
].map(([value, label]) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
6115
|
+
/* @__PURE__ */ jsx(RadioGroupItem, { value, id: `img-source-${value}` }),
|
|
6116
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `img-source-${value}`, className: "text-xs", children: label })
|
|
6117
|
+
] }, value))
|
|
6118
|
+
}
|
|
6119
|
+
)
|
|
6120
|
+
}
|
|
6121
|
+
),
|
|
6122
|
+
"slack_file" in block ? /* @__PURE__ */ jsx(SlackFileFields, { block, onChange }) : /* @__PURE__ */ jsx(EditorField, { label: "Image URL", help: "A publicly accessible image URL (PNG, JPG, GIF).", htmlFor: "img-url", children: /* @__PURE__ */ jsx(
|
|
6091
6123
|
Input,
|
|
6092
6124
|
{
|
|
6093
6125
|
id: "img-url",
|
|
@@ -6131,6 +6163,51 @@ function ImageEditor({ block, onChange }) {
|
|
|
6131
6163
|
) })
|
|
6132
6164
|
] });
|
|
6133
6165
|
}
|
|
6166
|
+
function SlackFileFields({
|
|
6167
|
+
block,
|
|
6168
|
+
onChange
|
|
6169
|
+
}) {
|
|
6170
|
+
const fileId = "id" in block.slack_file ? block.slack_file.id : "";
|
|
6171
|
+
const fileUrl = "url" in block.slack_file ? block.slack_file.url : "";
|
|
6172
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
6173
|
+
/* @__PURE__ */ 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." }),
|
|
6174
|
+
/* @__PURE__ */ jsx(
|
|
6175
|
+
EditorField,
|
|
6176
|
+
{
|
|
6177
|
+
label: "File ID",
|
|
6178
|
+
help: "The Slack file's ID. Slack accepts an ID or a URL, not both, so filling this clears File URL.",
|
|
6179
|
+
htmlFor: "img-file-id",
|
|
6180
|
+
children: /* @__PURE__ */ jsx(
|
|
6181
|
+
Input,
|
|
6182
|
+
{
|
|
6183
|
+
id: "img-file-id",
|
|
6184
|
+
value: fileId,
|
|
6185
|
+
placeholder: "e.g. F0123456789",
|
|
6186
|
+
onChange: (e) => onChange({ ...block, slack_file: { id: e.target.value } })
|
|
6187
|
+
}
|
|
6188
|
+
)
|
|
6189
|
+
}
|
|
6190
|
+
),
|
|
6191
|
+
/* @__PURE__ */ jsx(
|
|
6192
|
+
EditorField,
|
|
6193
|
+
{
|
|
6194
|
+
label: "File URL",
|
|
6195
|
+
help: "The file's Slack-hosted URL. Filling this clears File ID.",
|
|
6196
|
+
htmlFor: "img-file-url",
|
|
6197
|
+
children: /* @__PURE__ */ jsx(
|
|
6198
|
+
Input,
|
|
6199
|
+
{
|
|
6200
|
+
id: "img-file-url",
|
|
6201
|
+
type: "url",
|
|
6202
|
+
value: fileUrl,
|
|
6203
|
+
placeholder: "e.g. https://files.slack.com/files-pri/T0123-F0123/image.png",
|
|
6204
|
+
onChange: (e) => onChange({ ...block, slack_file: { url: e.target.value } })
|
|
6205
|
+
}
|
|
6206
|
+
)
|
|
6207
|
+
}
|
|
6208
|
+
)
|
|
6209
|
+
] });
|
|
6210
|
+
}
|
|
6134
6211
|
function InputEditor({ block, onChange }) {
|
|
6135
6212
|
const updateElement = (next) => {
|
|
6136
6213
|
onChange({ ...block, element: next });
|