slack-blocks-to-jsx 0.3.4 → 0.3.6
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.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.js +533 -258
- package/dist/index.mjs +506 -231
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/readme.md +2 -2
package/dist/index.js
CHANGED
|
@@ -1989,27 +1989,6 @@ var parseEmojis = (text) => {
|
|
|
1989
1989
|
// src/utils/markdown_parser/parser.tsx
|
|
1990
1990
|
var import_parser = __toESM(require("@yozora/parser"));
|
|
1991
1991
|
|
|
1992
|
-
// src/utils/markdown_parser/sub_elements/text.tsx
|
|
1993
|
-
var import_jsx_runtime = require("react/jsx-runtime");
|
|
1994
|
-
var Text = (props) => {
|
|
1995
|
-
const { element } = props;
|
|
1996
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: element.value.split("[[DOUBLE_LINE_BREAK]]").map((line, index) => {
|
|
1997
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
1998
|
-
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "slack_blocks_to_jsx__line_break_not_first" }),
|
|
1999
|
-
line
|
|
2000
|
-
] }, index);
|
|
2001
|
-
}) });
|
|
2002
|
-
};
|
|
2003
|
-
|
|
2004
|
-
// src/utils/markdown_parser/sub_elements/delete.tsx
|
|
2005
|
-
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2006
|
-
var Delete = (props) => {
|
|
2007
|
-
const { element } = props;
|
|
2008
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("s", { children: element.children.map((child, i) => {
|
|
2009
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(Text, { element: child }, i);
|
|
2010
|
-
}) });
|
|
2011
|
-
};
|
|
2012
|
-
|
|
2013
1992
|
// src/store/useGlobalData.ts
|
|
2014
1993
|
var import_zustand = require("zustand");
|
|
2015
1994
|
var useBearStore = (0, import_zustand.create)((set) => ({
|
|
@@ -2036,25 +2015,128 @@ var useGlobalData = () => {
|
|
|
2036
2015
|
};
|
|
2037
2016
|
};
|
|
2038
2017
|
|
|
2018
|
+
// src/utils/markdown_parser/sub_elements/slack_date.tsx
|
|
2019
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
2020
|
+
var SlackDate = (props) => {
|
|
2021
|
+
const { element } = props;
|
|
2022
|
+
const { fallbackText, optionalLink, timestamp, tokenString } = element.value;
|
|
2023
|
+
const { hooks } = useGlobalData();
|
|
2024
|
+
if (hooks.date)
|
|
2025
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: hooks.date({
|
|
2026
|
+
fallback: fallbackText,
|
|
2027
|
+
timestamp,
|
|
2028
|
+
format: tokenString,
|
|
2029
|
+
link: optionalLink || null
|
|
2030
|
+
}) });
|
|
2031
|
+
const date = new Date(Number(timestamp) * 1e3);
|
|
2032
|
+
let date_text = tokenString;
|
|
2033
|
+
if (tokenString.includes("{date_num}")) {
|
|
2034
|
+
date_text = date_text.replace("{date_num}", date_token_to_label(date, "{date_num}"));
|
|
2035
|
+
}
|
|
2036
|
+
if (tokenString.includes("{date}"))
|
|
2037
|
+
date_text = date_text.replace("{date}", date_token_to_label(date, "{date}"));
|
|
2038
|
+
if (tokenString.includes("{date_short}"))
|
|
2039
|
+
date_text = date_text.replace("{date_short}", date_token_to_label(date, "{date_short}"));
|
|
2040
|
+
if (tokenString.includes("{date_long}"))
|
|
2041
|
+
date_text = date_text.replace("{date_long}", date_token_to_label(date, "{date_long}"));
|
|
2042
|
+
if (tokenString.includes("{date_pretty}"))
|
|
2043
|
+
date_text = date_text.replace("{date_pretty}", date_token_to_label(date, "{date_pretty}"));
|
|
2044
|
+
if (tokenString.includes("{date_short_pretty}"))
|
|
2045
|
+
date_text = date_text.replace(
|
|
2046
|
+
"{date_short_pretty}",
|
|
2047
|
+
date_token_to_label(date, "{date_short_pretty}")
|
|
2048
|
+
);
|
|
2049
|
+
if (tokenString.includes("{date_long_pretty}"))
|
|
2050
|
+
date_text = date_text.replace(
|
|
2051
|
+
"{date_long_pretty}",
|
|
2052
|
+
date_token_to_label(date, "{date_long_pretty}")
|
|
2053
|
+
);
|
|
2054
|
+
if (tokenString.includes("{time}")) {
|
|
2055
|
+
date_text = date_text.replace("{time}", date_token_to_label(date, "{time}"));
|
|
2056
|
+
}
|
|
2057
|
+
if (tokenString.includes("{time_secs}")) {
|
|
2058
|
+
date_text = date_text.replace("{time_secs}", date_token_to_label(date, "{time_secs}"));
|
|
2059
|
+
}
|
|
2060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "slack_date", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(WrapWithLink, { wrap: !!optionalLink, href: optionalLink, children: date_text }) });
|
|
2061
|
+
};
|
|
2062
|
+
var WrapWithLink = (props) => {
|
|
2063
|
+
if (!props.wrap)
|
|
2064
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: props.children });
|
|
2065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: props.href, target: "_blank", rel: "noopener noreferrer", className: "text-blue-primary", children: props.children });
|
|
2066
|
+
};
|
|
2067
|
+
var date_token_to_label = (inputDate, formatString) => {
|
|
2068
|
+
const dateObj = new Date(inputDate);
|
|
2069
|
+
const getMonthWithZero = (date) => {
|
|
2070
|
+
return (date.getMonth() + 1).toString().padStart(2, "0");
|
|
2071
|
+
};
|
|
2072
|
+
const getDayWithSuffix = (date) => {
|
|
2073
|
+
const day = date.getDate();
|
|
2074
|
+
const suffixes = ["th", "st", "nd", "rd"];
|
|
2075
|
+
const relevantDigits = (day < 30 ? day % 20 : day % 30) % 10;
|
|
2076
|
+
return day + (suffixes[relevantDigits] || suffixes[0] || "");
|
|
2077
|
+
};
|
|
2078
|
+
switch (formatString) {
|
|
2079
|
+
case "{date_num}":
|
|
2080
|
+
return `${dateObj.getFullYear()}-${getMonthWithZero(dateObj)}-${dateObj.getDate().toString().padStart(2, "0")}`;
|
|
2081
|
+
case "{date}":
|
|
2082
|
+
return `${dateObj.toLocaleString("en-US", { month: "long" })} ${getDayWithSuffix(
|
|
2083
|
+
dateObj
|
|
2084
|
+
)}, ${dateObj.getFullYear()}`;
|
|
2085
|
+
case "{date_short}":
|
|
2086
|
+
return `${dateObj.toLocaleString("en-US", { month: "short" })} ${getDayWithSuffix(
|
|
2087
|
+
dateObj
|
|
2088
|
+
)}, ${dateObj.getFullYear()}`;
|
|
2089
|
+
case "{date_long}":
|
|
2090
|
+
return `${dateObj.toLocaleString("en-US", {
|
|
2091
|
+
weekday: "long",
|
|
2092
|
+
month: "long"
|
|
2093
|
+
})} ${getDayWithSuffix(dateObj)}, ${dateObj.getFullYear()}`;
|
|
2094
|
+
case "{date_pretty}":
|
|
2095
|
+
return `${dateObj.toLocaleString("en-US", { month: "long" })} ${getDayWithSuffix(
|
|
2096
|
+
dateObj
|
|
2097
|
+
)}, ${dateObj.getFullYear()}`;
|
|
2098
|
+
case "{date_short_pretty}":
|
|
2099
|
+
return `${dateObj.toLocaleString("en-US", { month: "short" })} ${getDayWithSuffix(
|
|
2100
|
+
dateObj
|
|
2101
|
+
)}, ${dateObj.getFullYear()}`;
|
|
2102
|
+
case "{date_long_pretty}":
|
|
2103
|
+
return `${dateObj.toLocaleString("en-US", {
|
|
2104
|
+
weekday: "long",
|
|
2105
|
+
month: "long"
|
|
2106
|
+
})} ${getDayWithSuffix(dateObj)}, ${dateObj.getFullYear()}`;
|
|
2107
|
+
case "{time}":
|
|
2108
|
+
return dateObj.toLocaleString("en-US", { hour: "numeric", minute: "numeric", hour12: true });
|
|
2109
|
+
case "{time_secs}":
|
|
2110
|
+
return dateObj.toLocaleString("en-US", {
|
|
2111
|
+
hour: "numeric",
|
|
2112
|
+
minute: "numeric",
|
|
2113
|
+
second: "numeric",
|
|
2114
|
+
hour12: true
|
|
2115
|
+
});
|
|
2116
|
+
default:
|
|
2117
|
+
return formatString;
|
|
2118
|
+
}
|
|
2119
|
+
};
|
|
2120
|
+
|
|
2039
2121
|
// src/utils/markdown_parser/sub_elements/slack_broadcast.tsx
|
|
2040
|
-
var
|
|
2122
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2041
2123
|
var SlackBroadcast = (props) => {
|
|
2042
2124
|
const { element } = props;
|
|
2043
2125
|
const { hooks } = useGlobalData();
|
|
2044
2126
|
if (element.value === "here" && hooks.atHere)
|
|
2045
|
-
return /* @__PURE__ */ (0,
|
|
2127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: hooks.atHere() });
|
|
2046
2128
|
if (element.value === "everyone" && hooks.atEveryone)
|
|
2047
|
-
return /* @__PURE__ */ (0,
|
|
2129
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: hooks.atEveryone() });
|
|
2048
2130
|
if (element.value === "channel" && hooks.atChannel)
|
|
2049
|
-
return /* @__PURE__ */ (0,
|
|
2050
|
-
return /* @__PURE__ */ (0,
|
|
2131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_jsx_runtime2.Fragment, { children: hooks.atChannel() });
|
|
2132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("span", { className: "slack_broadcast", children: [
|
|
2051
2133
|
"@",
|
|
2052
2134
|
element.value
|
|
2053
2135
|
] });
|
|
2054
2136
|
};
|
|
2055
2137
|
|
|
2056
2138
|
// src/utils/markdown_parser/sub_elements/slack_channel_mention.tsx
|
|
2057
|
-
var
|
|
2139
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2058
2140
|
var SlackChannelMention = (props) => {
|
|
2059
2141
|
const { element } = props;
|
|
2060
2142
|
const { hooks, channels } = useGlobalData();
|
|
@@ -2062,15 +2144,15 @@ var SlackChannelMention = (props) => {
|
|
|
2062
2144
|
const channel = channels.find((u) => u.id === channel_id || u.name === channel_id);
|
|
2063
2145
|
const label = (channel == null ? void 0 : channel.name) || channel_id;
|
|
2064
2146
|
if (hooks.channel)
|
|
2065
|
-
return /* @__PURE__ */ (0,
|
|
2066
|
-
return /* @__PURE__ */ (0,
|
|
2147
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: hooks.channel(channel || { id: channel_id, name: label }) });
|
|
2148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { className: "slack_channel", "data-channel-id": (channel == null ? void 0 : channel.id) || channel_id, children: [
|
|
2067
2149
|
"#",
|
|
2068
2150
|
label
|
|
2069
2151
|
] });
|
|
2070
2152
|
};
|
|
2071
2153
|
|
|
2072
2154
|
// src/utils/markdown_parser/sub_elements/slack_user_group_mention.tsx
|
|
2073
|
-
var
|
|
2155
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2074
2156
|
var SlackUserGroupMention = (props) => {
|
|
2075
2157
|
const { element } = props;
|
|
2076
2158
|
const { hooks, user_groups } = useGlobalData();
|
|
@@ -2078,34 +2160,50 @@ var SlackUserGroupMention = (props) => {
|
|
|
2078
2160
|
const group = user_groups.find((u) => u.id === group_id || u.name === group_id);
|
|
2079
2161
|
const label = (group == null ? void 0 : group.name) || group_id;
|
|
2080
2162
|
if (hooks.usergroup)
|
|
2081
|
-
return /* @__PURE__ */ (0,
|
|
2082
|
-
return /* @__PURE__ */ (0,
|
|
2163
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: hooks.usergroup(group || { id: group_id, name: label }) });
|
|
2164
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { "data-usergroup-id": (group == null ? void 0 : group.id) || group_id, className: "slack_user_group", children: [
|
|
2083
2165
|
"@",
|
|
2084
2166
|
label
|
|
2085
2167
|
] });
|
|
2086
2168
|
};
|
|
2087
2169
|
|
|
2088
2170
|
// src/utils/markdown_parser/sub_elements/slack_user_mention.tsx
|
|
2089
|
-
var
|
|
2171
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
2090
2172
|
var SlackUserMention = (props) => {
|
|
2091
2173
|
const { element } = props;
|
|
2092
2174
|
const { hooks, users } = useGlobalData();
|
|
2093
2175
|
const user_id = element.value;
|
|
2094
2176
|
const user = users.find((u) => u.id === user_id || u.name === user_id);
|
|
2095
2177
|
if (hooks.user)
|
|
2096
|
-
return /* @__PURE__ */ (0,
|
|
2178
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_jsx_runtime5.Fragment, { children: hooks.user(user || { id: user_id, name: user_id }) });
|
|
2097
2179
|
const label = (user == null ? void 0 : user.name) || user_id;
|
|
2098
|
-
return /* @__PURE__ */ (0,
|
|
2180
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "slack_user", "data-user-id": (user == null ? void 0 : user.id) || user_id, children: [
|
|
2099
2181
|
"@",
|
|
2100
2182
|
label
|
|
2101
2183
|
] });
|
|
2102
2184
|
};
|
|
2103
2185
|
|
|
2104
|
-
// src/utils/markdown_parser/sub_elements/
|
|
2186
|
+
// src/utils/markdown_parser/sub_elements/text.tsx
|
|
2187
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
2188
|
+
var Text = (props) => {
|
|
2189
|
+
const { element } = props;
|
|
2190
|
+
if (!element.value)
|
|
2191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: element.value });
|
|
2192
|
+
if (element.value === " ")
|
|
2193
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "\xA0" });
|
|
2194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: element.value.split("[[DOUBLE_LINE_BREAK]]").map((line, index) => {
|
|
2195
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("span", { children: [
|
|
2196
|
+
index > 0 && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "slack_blocks_to_jsx__line_break_not_first" }),
|
|
2197
|
+
line
|
|
2198
|
+
] }, index);
|
|
2199
|
+
}) });
|
|
2200
|
+
};
|
|
2201
|
+
|
|
2202
|
+
// src/utils/markdown_parser/sub_elements/strong.tsx
|
|
2105
2203
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
2106
|
-
var
|
|
2204
|
+
var Strong = (props) => {
|
|
2107
2205
|
const { element } = props;
|
|
2108
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("
|
|
2206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { children: element.children.map((child, i) => {
|
|
2109
2207
|
if (child.type === "delete")
|
|
2110
2208
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Delete, { element: child }, i);
|
|
2111
2209
|
if (child.type === "slack_user_mention")
|
|
@@ -2116,22 +2214,34 @@ var Emphasis = (props) => {
|
|
|
2116
2214
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SlackUserGroupMention, { element: child }, i);
|
|
2117
2215
|
if (child.type === "slack_broadcast")
|
|
2118
2216
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SlackBroadcast, { element: child }, i);
|
|
2217
|
+
if (child.type === "slack_date")
|
|
2218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SlackDate, { element: child }, i);
|
|
2219
|
+
if (child.type === "emphasis")
|
|
2220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Emphasis, { element: child }, i);
|
|
2119
2221
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { element: child }, i);
|
|
2120
2222
|
}) });
|
|
2121
2223
|
};
|
|
2122
2224
|
|
|
2123
|
-
// src/utils/markdown_parser/sub_elements/
|
|
2225
|
+
// src/utils/markdown_parser/sub_elements/delete.tsx
|
|
2124
2226
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
2125
|
-
var
|
|
2227
|
+
var Delete = (props) => {
|
|
2126
2228
|
const { element } = props;
|
|
2127
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("
|
|
2229
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("s", { children: element.children.map((child, i) => {
|
|
2230
|
+
if (child.type === "slack_date")
|
|
2231
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SlackDate, { element: child }, i);
|
|
2232
|
+
if (child.type === "strong")
|
|
2233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Strong, { element: child }, i);
|
|
2234
|
+
if (child.type === "emphasis")
|
|
2235
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Emphasis, { element: child }, i);
|
|
2236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { element: child }, i);
|
|
2237
|
+
}) });
|
|
2128
2238
|
};
|
|
2129
2239
|
|
|
2130
|
-
// src/utils/markdown_parser/sub_elements/
|
|
2240
|
+
// src/utils/markdown_parser/sub_elements/emphasis.tsx
|
|
2131
2241
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
2132
|
-
var
|
|
2242
|
+
var Emphasis = (props) => {
|
|
2133
2243
|
const { element } = props;
|
|
2134
|
-
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("
|
|
2244
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("em", { children: element.children.map((child, i) => {
|
|
2135
2245
|
if (child.type === "delete")
|
|
2136
2246
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Delete, { element: child }, i);
|
|
2137
2247
|
if (child.type === "slack_user_mention")
|
|
@@ -2142,68 +2252,81 @@ var Strong = (props) => {
|
|
|
2142
2252
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SlackUserGroupMention, { element: child }, i);
|
|
2143
2253
|
if (child.type === "slack_broadcast")
|
|
2144
2254
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SlackBroadcast, { element: child }, i);
|
|
2255
|
+
if (child.type === "slack_date")
|
|
2256
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SlackDate, { element: child }, i);
|
|
2257
|
+
if (child.type === "strong")
|
|
2258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Strong, { element: child }, i);
|
|
2145
2259
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { element: child }, i);
|
|
2146
2260
|
}) });
|
|
2147
2261
|
};
|
|
2148
2262
|
|
|
2149
|
-
// src/utils/markdown_parser/sub_elements/
|
|
2263
|
+
// src/utils/markdown_parser/sub_elements/inline_code.tsx
|
|
2150
2264
|
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
2265
|
+
var InlineCode = (props) => {
|
|
2266
|
+
const { element } = props;
|
|
2267
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("code", { className: "slack_code_inline", children: element.value });
|
|
2268
|
+
};
|
|
2269
|
+
|
|
2270
|
+
// src/utils/markdown_parser/sub_elements/link.tsx
|
|
2271
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
2151
2272
|
var Link = (props) => {
|
|
2152
2273
|
const { element } = props;
|
|
2153
|
-
return /* @__PURE__ */ (0,
|
|
2274
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("a", { href: element.url, className: "slack_link", children: element.children.map((child, i) => {
|
|
2154
2275
|
if (child.type === "delete")
|
|
2155
|
-
return /* @__PURE__ */ (0,
|
|
2276
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Delete, { element: child }, i);
|
|
2156
2277
|
if (child.type === "emphasis")
|
|
2157
|
-
return /* @__PURE__ */ (0,
|
|
2278
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Emphasis, { element: child }, i);
|
|
2158
2279
|
if (child.type === "strong")
|
|
2159
|
-
return /* @__PURE__ */ (0,
|
|
2160
|
-
return /* @__PURE__ */ (0,
|
|
2280
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Strong, { element: child }, i);
|
|
2281
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Text, { element: child }, i);
|
|
2161
2282
|
}) });
|
|
2162
2283
|
};
|
|
2163
2284
|
|
|
2164
2285
|
// src/utils/markdown_parser/elements/paragraph.tsx
|
|
2165
|
-
var
|
|
2286
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
2166
2287
|
var Paragraph = (props) => {
|
|
2167
2288
|
const { element } = props;
|
|
2168
|
-
return /* @__PURE__ */ (0,
|
|
2289
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_jsx_runtime12.Fragment, { children: element.children.map((subelement, i) => {
|
|
2169
2290
|
if (subelement.type === "text")
|
|
2170
|
-
return /* @__PURE__ */ (0,
|
|
2291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { element: subelement }, i);
|
|
2171
2292
|
if (subelement.type === "emphasis")
|
|
2172
|
-
return /* @__PURE__ */ (0,
|
|
2293
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Emphasis, { element: subelement }, i);
|
|
2173
2294
|
if (subelement.type === "inlineCode")
|
|
2174
|
-
return /* @__PURE__ */ (0,
|
|
2295
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(InlineCode, { element: subelement }, i);
|
|
2175
2296
|
if (subelement.type === "delete")
|
|
2176
|
-
return /* @__PURE__ */ (0,
|
|
2297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Delete, { element: subelement }, i);
|
|
2177
2298
|
if (subelement.type === "strong")
|
|
2178
|
-
return /* @__PURE__ */ (0,
|
|
2299
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Strong, { element: subelement }, i);
|
|
2179
2300
|
if (subelement.type === "link")
|
|
2180
|
-
return /* @__PURE__ */ (0,
|
|
2301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Link, { element: subelement }, i);
|
|
2181
2302
|
if (subelement.type === "slack_user_mention")
|
|
2182
|
-
return /* @__PURE__ */ (0,
|
|
2303
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SlackUserMention, { element: subelement }, i);
|
|
2183
2304
|
if (subelement.type === "slack_channel_mention")
|
|
2184
|
-
return /* @__PURE__ */ (0,
|
|
2305
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SlackChannelMention, { element: subelement }, i);
|
|
2185
2306
|
if (subelement.type === "slack_user_group_mention")
|
|
2186
|
-
return /* @__PURE__ */ (0,
|
|
2307
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SlackUserGroupMention, { element: subelement }, i);
|
|
2187
2308
|
if (subelement.type === "slack_broadcast")
|
|
2188
|
-
return /* @__PURE__ */ (0,
|
|
2309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SlackBroadcast, { element: subelement }, i);
|
|
2310
|
+
if (subelement.type === "slack_date")
|
|
2311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SlackDate, { element: subelement }, i);
|
|
2189
2312
|
return null;
|
|
2190
2313
|
}) });
|
|
2191
2314
|
};
|
|
2192
2315
|
|
|
2193
2316
|
// src/utils/markdown_parser/elements/blockquote.tsx
|
|
2194
|
-
var
|
|
2317
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
2195
2318
|
var Blockquote = (props) => {
|
|
2196
2319
|
const { element } = props;
|
|
2197
|
-
return /* @__PURE__ */ (0,
|
|
2198
|
-
return /* @__PURE__ */ (0,
|
|
2320
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_jsx_runtime13.Fragment, { children: element.children.map((para) => {
|
|
2321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Paragraph, { element: para });
|
|
2199
2322
|
}) });
|
|
2200
2323
|
};
|
|
2201
2324
|
|
|
2202
2325
|
// src/utils/markdown_parser/elements/code.tsx
|
|
2203
|
-
var
|
|
2326
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
2204
2327
|
var Code = (props) => {
|
|
2205
2328
|
const { element } = props;
|
|
2206
|
-
return /* @__PURE__ */ (0,
|
|
2329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("code", { className: "slack_code", children: element.value });
|
|
2207
2330
|
};
|
|
2208
2331
|
|
|
2209
2332
|
// src/utils/markdown_parser/tokenizers/slack_user_mention/tokenizer.ts
|
|
@@ -2648,9 +2771,136 @@ var SlackBroadcastTokenizer = class extends import_core_tokenizer7.BaseInlineTok
|
|
|
2648
2771
|
}
|
|
2649
2772
|
};
|
|
2650
2773
|
|
|
2774
|
+
// src/utils/markdown_parser/tokenizers/slack_date/tokenizer.ts
|
|
2775
|
+
var import_core_tokenizer8 = require("@yozora/core-tokenizer");
|
|
2776
|
+
|
|
2777
|
+
// src/utils/markdown_parser/tokenizers/slack_date/match.ts
|
|
2778
|
+
var import_character9 = require("@yozora/character");
|
|
2779
|
+
|
|
2780
|
+
// src/utils/markdown_parser/tokenizers/slack_date/types.ts
|
|
2781
|
+
var SlackDateType = "slack_date";
|
|
2782
|
+
|
|
2783
|
+
// src/utils/markdown_parser/tokenizers/slack_date/match.ts
|
|
2784
|
+
var match5 = function(api) {
|
|
2785
|
+
return { findDelimiter, processSingleDelimiter };
|
|
2786
|
+
function* findDelimiter() {
|
|
2787
|
+
var _a, _b;
|
|
2788
|
+
const nodePoints = api.getNodePoints();
|
|
2789
|
+
const blockStartIndex = api.getBlockStartIndex();
|
|
2790
|
+
const blockEndIndex = api.getBlockEndIndex();
|
|
2791
|
+
const potentialDelimiters = [];
|
|
2792
|
+
for (let i = blockStartIndex; i < blockEndIndex; ++i) {
|
|
2793
|
+
if (((_a = nodePoints[i]) == null ? void 0 : _a.codePoint) === import_character9.AsciiCodePoint.OPEN_ANGLE && ((_b = nodePoints[i + 1]) == null ? void 0 : _b.codePoint) === import_character9.AsciiCodePoint.EXCLAMATION_MARK && matchDateTag(nodePoints, i)) {
|
|
2794
|
+
const endIndex = findEndDelimiter(nodePoints, i, blockEndIndex);
|
|
2795
|
+
if (endIndex !== -1) {
|
|
2796
|
+
potentialDelimiters.push({
|
|
2797
|
+
type: "full",
|
|
2798
|
+
startIndex: i,
|
|
2799
|
+
endIndex: endIndex + 1,
|
|
2800
|
+
thickness: endIndex + 1 - i
|
|
2801
|
+
});
|
|
2802
|
+
i = endIndex;
|
|
2803
|
+
}
|
|
2804
|
+
}
|
|
2805
|
+
}
|
|
2806
|
+
let pIndex = 0;
|
|
2807
|
+
let lastEndIndex = -1;
|
|
2808
|
+
let currentDelimiter = null;
|
|
2809
|
+
while (pIndex < potentialDelimiters.length) {
|
|
2810
|
+
const [startIndex, endIndex] = yield currentDelimiter;
|
|
2811
|
+
if (lastEndIndex === endIndex) {
|
|
2812
|
+
if (currentDelimiter == null || currentDelimiter.startIndex >= startIndex)
|
|
2813
|
+
continue;
|
|
2814
|
+
}
|
|
2815
|
+
lastEndIndex = endIndex;
|
|
2816
|
+
for (; pIndex < potentialDelimiters.length; ++pIndex) {
|
|
2817
|
+
const delimiter = potentialDelimiters[pIndex];
|
|
2818
|
+
if (delimiter.startIndex >= startIndex) {
|
|
2819
|
+
currentDelimiter = {
|
|
2820
|
+
type: "full",
|
|
2821
|
+
startIndex: delimiter.startIndex,
|
|
2822
|
+
endIndex: delimiter.endIndex,
|
|
2823
|
+
thickness: delimiter.thickness
|
|
2824
|
+
};
|
|
2825
|
+
break;
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
}
|
|
2830
|
+
function matchDateTag(nodePoints, startIndex) {
|
|
2831
|
+
var _a;
|
|
2832
|
+
const tag = "<!date^";
|
|
2833
|
+
for (let j = 0; j < tag.length; ++j) {
|
|
2834
|
+
if (((_a = nodePoints[startIndex + j]) == null ? void 0 : _a.codePoint) !== tag.charCodeAt(j)) {
|
|
2835
|
+
return false;
|
|
2836
|
+
}
|
|
2837
|
+
}
|
|
2838
|
+
return true;
|
|
2839
|
+
}
|
|
2840
|
+
function findEndDelimiter(nodePoints, startIndex, blockEndIndex) {
|
|
2841
|
+
var _a;
|
|
2842
|
+
for (let i = startIndex; i < blockEndIndex; ++i) {
|
|
2843
|
+
if (((_a = nodePoints[i]) == null ? void 0 : _a.codePoint) === import_character9.AsciiCodePoint.CLOSE_ANGLE) {
|
|
2844
|
+
return i;
|
|
2845
|
+
}
|
|
2846
|
+
}
|
|
2847
|
+
return -1;
|
|
2848
|
+
}
|
|
2849
|
+
function processSingleDelimiter(delimiter) {
|
|
2850
|
+
const token = {
|
|
2851
|
+
nodeType: SlackDateType,
|
|
2852
|
+
startIndex: delimiter.startIndex,
|
|
2853
|
+
endIndex: delimiter.endIndex,
|
|
2854
|
+
thickness: delimiter.thickness
|
|
2855
|
+
};
|
|
2856
|
+
return [token];
|
|
2857
|
+
}
|
|
2858
|
+
};
|
|
2859
|
+
|
|
2860
|
+
// src/utils/markdown_parser/tokenizers/slack_date/parse.ts
|
|
2861
|
+
var import_character10 = require("@yozora/character");
|
|
2862
|
+
var parse5 = function(api) {
|
|
2863
|
+
return {
|
|
2864
|
+
parse: (tokens) => tokens.map((token) => {
|
|
2865
|
+
const nodePoints = api.getNodePoints();
|
|
2866
|
+
const fullString = (0, import_character10.calcStringFromNodePoints)(nodePoints, token.startIndex, token.endIndex);
|
|
2867
|
+
const datePattern = /<!date\^(\d+)\^([^\^]*)\^?([^\|]*)\|([^>]*)>/;
|
|
2868
|
+
const match6 = datePattern.exec(fullString);
|
|
2869
|
+
let value = {
|
|
2870
|
+
timestamp: "",
|
|
2871
|
+
tokenString: "",
|
|
2872
|
+
optionalLink: "",
|
|
2873
|
+
fallbackText: ""
|
|
2874
|
+
};
|
|
2875
|
+
if (match6) {
|
|
2876
|
+
value = {
|
|
2877
|
+
timestamp: match6[1],
|
|
2878
|
+
tokenString: match6[2],
|
|
2879
|
+
optionalLink: match6[3],
|
|
2880
|
+
fallbackText: match6[4]
|
|
2881
|
+
};
|
|
2882
|
+
}
|
|
2883
|
+
const node = api.shouldReservePosition ? { type: SlackDateType, position: api.calcPosition(token), value } : { type: SlackDateType, value };
|
|
2884
|
+
return node;
|
|
2885
|
+
})
|
|
2886
|
+
};
|
|
2887
|
+
};
|
|
2888
|
+
|
|
2889
|
+
// src/utils/markdown_parser/tokenizers/slack_date/tokenizer.ts
|
|
2890
|
+
var SlackDateTokenizer = class extends import_core_tokenizer8.BaseInlineTokenizer {
|
|
2891
|
+
constructor(props = {}) {
|
|
2892
|
+
super({
|
|
2893
|
+
name: SlackDateType,
|
|
2894
|
+
priority: props.priority || import_core_tokenizer8.TokenizerPriority.ATOMIC
|
|
2895
|
+
});
|
|
2896
|
+
this.match = match5;
|
|
2897
|
+
this.parse = parse5;
|
|
2898
|
+
}
|
|
2899
|
+
};
|
|
2900
|
+
|
|
2651
2901
|
// src/utils/markdown_parser/parser.tsx
|
|
2652
|
-
var
|
|
2653
|
-
var parser = new import_parser.default().unmountTokenizer("@yozora/tokenizer-list").useTokenizer(new SlackUserMentionTokenizer()).useTokenizer(new SlackChannelMentionTokenizer()).useTokenizer(new SlackUserGroupMentionTokenizer()).useTokenizer(new SlackBroadcastTokenizer());
|
|
2902
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
2903
|
+
var parser = new import_parser.default().unmountTokenizer("@yozora/tokenizer-list").useTokenizer(new SlackUserMentionTokenizer()).useTokenizer(new SlackChannelMentionTokenizer()).useTokenizer(new SlackUserGroupMentionTokenizer()).useTokenizer(new SlackBroadcastTokenizer()).useTokenizer(new SlackDateTokenizer());
|
|
2654
2904
|
var markdown_parser = (markdown, options) => {
|
|
2655
2905
|
if (!markdown)
|
|
2656
2906
|
return null;
|
|
@@ -2660,20 +2910,20 @@ var markdown_parser = (markdown, options) => {
|
|
|
2660
2910
|
`);
|
|
2661
2911
|
text_string = text_string.replace(new RegExp("(?<!\\*)\\*(?!\\*)([^*]+)\\*(?!\\*)", "g"), "**$1**");
|
|
2662
2912
|
text_string = text_string.replace(new RegExp("(?<!~)~(?!~)([^~]+)~(?!~)", "g"), "~~$1~~");
|
|
2663
|
-
text_string = text_string.replace(/<([^|>]+)\|([^>]+)>/g, "[$2]($1)");
|
|
2913
|
+
text_string = text_string.replace(/<(?!(?:!date))([^|>]+)\|([^>]+)>/g, "[$2]($1)");
|
|
2664
2914
|
text_string = text_string.replace(/\n\n/g, "[[DOUBLE_LINE_BREAK]]");
|
|
2665
2915
|
text_string = text_string.replace(/<!here>/g, "@here");
|
|
2666
2916
|
text_string = text_string.replace(/<!everyone>/g, "@everyone");
|
|
2667
2917
|
text_string = text_string.replace(/<!channel>/g, "@channel");
|
|
2668
2918
|
const parsed_data = parser.parse(text_string);
|
|
2669
2919
|
const elements = parsed_data.children;
|
|
2670
|
-
return /* @__PURE__ */ (0,
|
|
2920
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { children: elements.map((element, i) => {
|
|
2671
2921
|
if (element.type === "paragraph")
|
|
2672
|
-
return /* @__PURE__ */ (0,
|
|
2922
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Paragraph, { element }, i);
|
|
2673
2923
|
if (element.type === "blockquote")
|
|
2674
|
-
return /* @__PURE__ */ (0,
|
|
2924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Blockquote, { element }, i);
|
|
2675
2925
|
if (element.type === "code")
|
|
2676
|
-
return /* @__PURE__ */ (0,
|
|
2926
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(Code, { element }, i);
|
|
2677
2927
|
return null;
|
|
2678
2928
|
}) });
|
|
2679
2929
|
};
|
|
@@ -2728,21 +2978,21 @@ var is_accessory_stacked = (element) => {
|
|
|
2728
2978
|
};
|
|
2729
2979
|
|
|
2730
2980
|
// src/header.tsx
|
|
2731
|
-
var
|
|
2981
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2732
2982
|
var Header = (props) => {
|
|
2733
2983
|
const { name, time } = props;
|
|
2734
|
-
return /* @__PURE__ */ (0,
|
|
2735
|
-
/* @__PURE__ */ (0,
|
|
2736
|
-
/* @__PURE__ */ (0,
|
|
2737
|
-
/* @__PURE__ */ (0,
|
|
2984
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "flex gap-[5px] items-center w-full slack_blocks_to_jsx--header", children: [
|
|
2985
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { className: "font-black text-[15px]", children: name }),
|
|
2986
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "h-[14px] w-[27px] leading-[12.5px] py-[1px] px-[3px] uppercase text-[10px] text-black-primary/[0.7] bg-black-primary/[0.13] font-semibold rounded-[2px] text-center", children: "APP" }),
|
|
2987
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "text-xs text-black-secondary uppercase leading-[17.6px]", children: dateToTime(time) })
|
|
2738
2988
|
] });
|
|
2739
2989
|
};
|
|
2740
2990
|
|
|
2741
2991
|
// src/components/elements/image_element.tsx
|
|
2742
|
-
var
|
|
2992
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2743
2993
|
var ImageElement = (props) => {
|
|
2744
2994
|
const { alt_text, image_url } = props.data;
|
|
2745
|
-
return /* @__PURE__ */ (0,
|
|
2995
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
2746
2996
|
"img",
|
|
2747
2997
|
{
|
|
2748
2998
|
src: image_url,
|
|
@@ -2753,7 +3003,7 @@ var ImageElement = (props) => {
|
|
|
2753
3003
|
};
|
|
2754
3004
|
|
|
2755
3005
|
// src/components/composition_objects/text_object.tsx
|
|
2756
|
-
var
|
|
3006
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2757
3007
|
var TextObject = (props) => {
|
|
2758
3008
|
const { type, text, emoji, verbatim = false } = props.data;
|
|
2759
3009
|
const { className = "" } = props;
|
|
@@ -2761,15 +3011,15 @@ var TextObject = (props) => {
|
|
|
2761
3011
|
let emoji_parsed = type == "mrkdwn" ? hooks.emoji ? hooks.emoji(text) : parseEmojis(text) : emoji === false ? text : hooks.emoji ? hooks.emoji(text) : parseEmojis(text);
|
|
2762
3012
|
emoji_parsed = emoji_parsed.replace(/>/g, "> ").replace(/</g, "<");
|
|
2763
3013
|
if (type === "plain_text")
|
|
2764
|
-
return /* @__PURE__ */ (0,
|
|
2765
|
-
return /* @__PURE__ */ (0,
|
|
3014
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className, children: markdown_parser(emoji_parsed, { markdown: false, users, channels, hooks }) });
|
|
3015
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className, children: markdown_parser(emoji_parsed, { markdown: true, users, channels, hooks }) });
|
|
2766
3016
|
};
|
|
2767
3017
|
|
|
2768
3018
|
// src/components/elements/button_element.tsx
|
|
2769
|
-
var
|
|
3019
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2770
3020
|
var ButtonElement = (props) => {
|
|
2771
3021
|
const { text, action_id, url, style, accessibility_label } = props.data;
|
|
2772
|
-
return /* @__PURE__ */ (0,
|
|
3022
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2773
3023
|
"button",
|
|
2774
3024
|
{
|
|
2775
3025
|
type: "button",
|
|
@@ -2781,14 +3031,14 @@ var ButtonElement = (props) => {
|
|
|
2781
3031
|
window.open(url, "_blank");
|
|
2782
3032
|
}
|
|
2783
3033
|
},
|
|
2784
|
-
children: /* @__PURE__ */ (0,
|
|
3034
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(TextObject, { data: text })
|
|
2785
3035
|
}
|
|
2786
3036
|
);
|
|
2787
3037
|
};
|
|
2788
3038
|
|
|
2789
3039
|
// src/components/elements/static_select_element.tsx
|
|
2790
3040
|
var import_react = require("react");
|
|
2791
|
-
var
|
|
3041
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2792
3042
|
var StaticSelectElement = (props) => {
|
|
2793
3043
|
const {
|
|
2794
3044
|
action_id,
|
|
@@ -2823,20 +3073,20 @@ var StaticSelectElement = (props) => {
|
|
|
2823
3073
|
const results = option.text.text.toLowerCase().includes(search.toLowerCase());
|
|
2824
3074
|
return results;
|
|
2825
3075
|
}, []);
|
|
2826
|
-
return /* @__PURE__ */ (0,
|
|
3076
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2827
3077
|
"div",
|
|
2828
3078
|
{
|
|
2829
3079
|
id: action_id,
|
|
2830
3080
|
className: "py-1 px-2 h-7 min-h-[28px] relative flex items-center justify-between rounded text-small w-[190px] border border-black-primary.3",
|
|
2831
3081
|
tabIndex: 0,
|
|
2832
3082
|
children: [
|
|
2833
|
-
visible && /* @__PURE__ */ (0,
|
|
3083
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2834
3084
|
"div",
|
|
2835
3085
|
{
|
|
2836
3086
|
className: "absolute top-[24px] -left-3 bg-white-secondary border border-gray-primary rounded-[6px] shadow-custom_shadow-1 w-[322px] max-w-[322px] max-h-[240px] overflow-auto py-3 z-20",
|
|
2837
3087
|
id: "static_select_popup",
|
|
2838
|
-
children: /* @__PURE__ */ (0,
|
|
2839
|
-
return /* @__PURE__ */ (0,
|
|
3088
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex flex-col", children: filteredOptions.map((option, i) => {
|
|
3089
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2840
3090
|
"div",
|
|
2841
3091
|
{
|
|
2842
3092
|
className: "h-7 px-6 flex items-center select-none cursor-pointer hover:bg-blue-primary hover:text-white-primary",
|
|
@@ -2845,14 +3095,14 @@ var StaticSelectElement = (props) => {
|
|
|
2845
3095
|
setVisible(false);
|
|
2846
3096
|
setSelected(option.value);
|
|
2847
3097
|
},
|
|
2848
|
-
children: /* @__PURE__ */ (0,
|
|
3098
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TextObject, { data: option.text })
|
|
2849
3099
|
},
|
|
2850
3100
|
i
|
|
2851
3101
|
);
|
|
2852
3102
|
}) })
|
|
2853
3103
|
}
|
|
2854
3104
|
),
|
|
2855
|
-
/* @__PURE__ */ (0,
|
|
3105
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2856
3106
|
"input",
|
|
2857
3107
|
{
|
|
2858
3108
|
type: "text",
|
|
@@ -2863,7 +3113,7 @@ var StaticSelectElement = (props) => {
|
|
|
2863
3113
|
"aria-label": "Select an item"
|
|
2864
3114
|
}
|
|
2865
3115
|
),
|
|
2866
|
-
!search && /* @__PURE__ */ (0,
|
|
3116
|
+
!search && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "absolute w-full h-full pointer-events-none flex items-center text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2867
3117
|
TextObject,
|
|
2868
3118
|
{
|
|
2869
3119
|
data: placeholder != null ? placeholder : {
|
|
@@ -2872,7 +3122,7 @@ var StaticSelectElement = (props) => {
|
|
|
2872
3122
|
}
|
|
2873
3123
|
}
|
|
2874
3124
|
) }),
|
|
2875
|
-
/* @__PURE__ */ (0,
|
|
3125
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2876
3126
|
"button",
|
|
2877
3127
|
{
|
|
2878
3128
|
type: "button",
|
|
@@ -2881,7 +3131,7 @@ var StaticSelectElement = (props) => {
|
|
|
2881
3131
|
onClick: () => {
|
|
2882
3132
|
setVisible((prev) => !prev);
|
|
2883
3133
|
},
|
|
2884
|
-
children: /* @__PURE__ */ (0,
|
|
3134
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2885
3135
|
"svg",
|
|
2886
3136
|
{
|
|
2887
3137
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2890,7 +3140,7 @@ var StaticSelectElement = (props) => {
|
|
|
2890
3140
|
strokeWidth: "3",
|
|
2891
3141
|
stroke: "currentColor",
|
|
2892
3142
|
className: "w-3 h-3",
|
|
2893
|
-
children: /* @__PURE__ */ (0,
|
|
3143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
|
|
2894
3144
|
}
|
|
2895
3145
|
)
|
|
2896
3146
|
}
|
|
@@ -2902,7 +3152,7 @@ var StaticSelectElement = (props) => {
|
|
|
2902
3152
|
|
|
2903
3153
|
// src/components/elements/checkboxes_element.tsx
|
|
2904
3154
|
var import_react2 = require("react");
|
|
2905
|
-
var
|
|
3155
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2906
3156
|
var CheckboxesElement = (props) => {
|
|
2907
3157
|
const { action_id, options, focus_on_load, initial_options } = props.data;
|
|
2908
3158
|
const [selected, setSelected] = (0, import_react2.useState)(
|
|
@@ -2916,15 +3166,15 @@ var CheckboxesElement = (props) => {
|
|
|
2916
3166
|
input_ref.current.focus();
|
|
2917
3167
|
}
|
|
2918
3168
|
}, [focus_on_load]);
|
|
2919
|
-
return /* @__PURE__ */ (0,
|
|
3169
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { id: action_id, className: "my-1 flex w-full slack_blocks_to_jsx__checkboxes_element", children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("fieldset", { className: "flex flex-col gap-2", children: options.map((option, i) => {
|
|
2920
3170
|
const { text, value, description } = option;
|
|
2921
|
-
return /* @__PURE__ */ (0,
|
|
3171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2922
3172
|
"label",
|
|
2923
3173
|
{
|
|
2924
3174
|
className: "flex cursor-pointer items-baseline gap-3 select-none",
|
|
2925
3175
|
htmlFor: `checkboxes-${action_id}-value-${value}-${i}`,
|
|
2926
3176
|
children: [
|
|
2927
|
-
/* @__PURE__ */ (0,
|
|
3177
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2928
3178
|
"input",
|
|
2929
3179
|
{
|
|
2930
3180
|
type: "checkbox",
|
|
@@ -2940,9 +3190,9 @@ var CheckboxesElement = (props) => {
|
|
|
2940
3190
|
}
|
|
2941
3191
|
}
|
|
2942
3192
|
) }),
|
|
2943
|
-
/* @__PURE__ */ (0,
|
|
2944
|
-
/* @__PURE__ */ (0,
|
|
2945
|
-
description && /* @__PURE__ */ (0,
|
|
3193
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { children: [
|
|
3194
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TextObject, { data: text }),
|
|
3195
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(TextObject, { className: "text-black-secondary", data: description })
|
|
2946
3196
|
] })
|
|
2947
3197
|
]
|
|
2948
3198
|
}
|
|
@@ -2952,7 +3202,7 @@ var CheckboxesElement = (props) => {
|
|
|
2952
3202
|
|
|
2953
3203
|
// src/components/elements/plain_text_input.tsx
|
|
2954
3204
|
var import_react3 = require("react");
|
|
2955
|
-
var
|
|
3205
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2956
3206
|
var PlaintTextInput = (props) => {
|
|
2957
3207
|
const {
|
|
2958
3208
|
action_id,
|
|
@@ -2980,15 +3230,15 @@ var PlaintTextInput = (props) => {
|
|
|
2980
3230
|
document.removeEventListener("mousedown", handleClickOutside);
|
|
2981
3231
|
};
|
|
2982
3232
|
}, []);
|
|
2983
|
-
return /* @__PURE__ */ (0,
|
|
3233
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2984
3234
|
"div",
|
|
2985
3235
|
{
|
|
2986
3236
|
id: action_id,
|
|
2987
3237
|
className: "relative text-small w-full slack_blocks_to_jsx__plain_text_input_element",
|
|
2988
3238
|
tabIndex: 0,
|
|
2989
3239
|
children: [
|
|
2990
|
-
!value && placeholder && /* @__PURE__ */ (0,
|
|
2991
|
-
!value && !placeholder && /* @__PURE__ */ (0,
|
|
3240
|
+
!value && placeholder && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "absolute left-2 top-2 text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(TextObject, { data: placeholder }) }),
|
|
3241
|
+
!value && !placeholder && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "absolute left-2 top-2 text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2992
3242
|
TextObject,
|
|
2993
3243
|
{
|
|
2994
3244
|
data: {
|
|
@@ -2997,7 +3247,7 @@ var PlaintTextInput = (props) => {
|
|
|
2997
3247
|
}
|
|
2998
3248
|
}
|
|
2999
3249
|
) }),
|
|
3000
|
-
/* @__PURE__ */ (0,
|
|
3250
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3001
3251
|
"textarea",
|
|
3002
3252
|
{
|
|
3003
3253
|
value,
|
|
@@ -3020,7 +3270,7 @@ var PlaintTextInput = (props) => {
|
|
|
3020
3270
|
|
|
3021
3271
|
// src/components/elements/users_select_element.tsx
|
|
3022
3272
|
var import_react4 = require("react");
|
|
3023
|
-
var
|
|
3273
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3024
3274
|
var UsersSelectElement = (props) => {
|
|
3025
3275
|
const { action_id, focus_on_load, placeholder, type, confirm, initial_user, people } = props.data;
|
|
3026
3276
|
const [visible, setVisible] = (0, import_react4.useState)(focus_on_load || false);
|
|
@@ -3045,20 +3295,20 @@ var UsersSelectElement = (props) => {
|
|
|
3045
3295
|
const name = person.name.toLowerCase();
|
|
3046
3296
|
return name.includes(search_query);
|
|
3047
3297
|
}, []);
|
|
3048
|
-
return /* @__PURE__ */ (0,
|
|
3298
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3049
3299
|
"div",
|
|
3050
3300
|
{
|
|
3051
3301
|
id: action_id,
|
|
3052
3302
|
className: "py-1 px-2 h-7 min-h-[28px] relative flex items-center justify-between rounded text-small w-[190px] border border-black-primary.3 slack_blocks_to_jsx__users_select_element",
|
|
3053
3303
|
tabIndex: 0,
|
|
3054
3304
|
children: [
|
|
3055
|
-
visible && /* @__PURE__ */ (0,
|
|
3305
|
+
visible && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3056
3306
|
"div",
|
|
3057
3307
|
{
|
|
3058
3308
|
className: "absolute top-[24px] -left-3 bg-white-secondary border border-gray-primary rounded-[6px] shadow-custom_shadow-1 w-[322px] max-w-[322px] max-h-[240px] overflow-auto py-3 z-20",
|
|
3059
3309
|
id: "static_select_popup",
|
|
3060
|
-
children: /* @__PURE__ */ (0,
|
|
3061
|
-
return /* @__PURE__ */ (0,
|
|
3310
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "flex flex-col", children: filteredOptions.map((option, i) => {
|
|
3311
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3062
3312
|
"button",
|
|
3063
3313
|
{
|
|
3064
3314
|
className: "h-7 px-6 flex group items-center gap-2 select-none cursor-pointer hover:bg-blue-primary hover:text-white-primary",
|
|
@@ -3069,7 +3319,7 @@ var UsersSelectElement = (props) => {
|
|
|
3069
3319
|
setSelected(option.id);
|
|
3070
3320
|
},
|
|
3071
3321
|
children: [
|
|
3072
|
-
option.image && /* @__PURE__ */ (0,
|
|
3322
|
+
option.image && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3073
3323
|
"img",
|
|
3074
3324
|
{
|
|
3075
3325
|
src: option.image,
|
|
@@ -3077,8 +3327,8 @@ var UsersSelectElement = (props) => {
|
|
|
3077
3327
|
className: "w-5 h-5 rounded-md overflow-hidden"
|
|
3078
3328
|
}
|
|
3079
3329
|
),
|
|
3080
|
-
!option.image && /* @__PURE__ */ (0,
|
|
3081
|
-
/* @__PURE__ */ (0,
|
|
3330
|
+
!option.image && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-5 h-5 rounded-md overflow-hidden bg-gray-300 text-black-primary font-semibold flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: option.name[0] || "" }) }),
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3082
3332
|
TextObject,
|
|
3083
3333
|
{
|
|
3084
3334
|
data: {
|
|
@@ -3087,17 +3337,17 @@ var UsersSelectElement = (props) => {
|
|
|
3087
3337
|
}
|
|
3088
3338
|
}
|
|
3089
3339
|
),
|
|
3090
|
-
/* @__PURE__ */ (0,
|
|
3091
|
-
option.online && /* @__PURE__ */ (0,
|
|
3340
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "relative", children: [
|
|
3341
|
+
option.online && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3092
3342
|
"div",
|
|
3093
3343
|
{
|
|
3094
3344
|
className: `bg-green-secondary w-[9px] h-[9px] rounded-full shrink-0`
|
|
3095
3345
|
}
|
|
3096
3346
|
),
|
|
3097
|
-
!option.online && /* @__PURE__ */ (0,
|
|
3098
|
-
option.sleeping && /* @__PURE__ */ (0,
|
|
3347
|
+
!option.online && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-[9px] h-[9px] rounded-full border-[1.5px] shrink-0 border-black-secondary group-hover:border-white-primary" }),
|
|
3348
|
+
option.sleeping && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute -top-[5px] -right-[5px] h-[10px] w-[10px] rounded-full bg-white-secondary flex justify-center z-[10] text-[8px] leading-[8px] font-semibold group-hover:bg-blue-primary", children: "z" })
|
|
3099
3349
|
] }),
|
|
3100
|
-
/* @__PURE__ */ (0,
|
|
3350
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "text-black-primary group-hover:text-white-primary", children: option.name })
|
|
3101
3351
|
]
|
|
3102
3352
|
},
|
|
3103
3353
|
i
|
|
@@ -3105,7 +3355,7 @@ var UsersSelectElement = (props) => {
|
|
|
3105
3355
|
}) })
|
|
3106
3356
|
}
|
|
3107
3357
|
),
|
|
3108
|
-
/* @__PURE__ */ (0,
|
|
3358
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3109
3359
|
"input",
|
|
3110
3360
|
{
|
|
3111
3361
|
type: "text",
|
|
@@ -3117,7 +3367,7 @@ var UsersSelectElement = (props) => {
|
|
|
3117
3367
|
"aria-label": "Select an item"
|
|
3118
3368
|
}
|
|
3119
3369
|
),
|
|
3120
|
-
!search && /* @__PURE__ */ (0,
|
|
3370
|
+
!search && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "absolute w-full h-full pointer-events-none flex items-center text-black-primary.3", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3121
3371
|
TextObject,
|
|
3122
3372
|
{
|
|
3123
3373
|
data: placeholder != null ? placeholder : {
|
|
@@ -3126,7 +3376,7 @@ var UsersSelectElement = (props) => {
|
|
|
3126
3376
|
}
|
|
3127
3377
|
}
|
|
3128
3378
|
) }),
|
|
3129
|
-
/* @__PURE__ */ (0,
|
|
3379
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3130
3380
|
"button",
|
|
3131
3381
|
{
|
|
3132
3382
|
type: "button",
|
|
@@ -3135,7 +3385,7 @@ var UsersSelectElement = (props) => {
|
|
|
3135
3385
|
onClick: () => {
|
|
3136
3386
|
setVisible((prev) => !prev);
|
|
3137
3387
|
},
|
|
3138
|
-
children: /* @__PURE__ */ (0,
|
|
3388
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3139
3389
|
"svg",
|
|
3140
3390
|
{
|
|
3141
3391
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3144,7 +3394,7 @@ var UsersSelectElement = (props) => {
|
|
|
3144
3394
|
strokeWidth: "3",
|
|
3145
3395
|
stroke: "currentColor",
|
|
3146
3396
|
className: "w-3 h-3",
|
|
3147
|
-
children: /* @__PURE__ */ (0,
|
|
3397
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" })
|
|
3148
3398
|
}
|
|
3149
3399
|
)
|
|
3150
3400
|
}
|
|
@@ -3155,52 +3405,52 @@ var UsersSelectElement = (props) => {
|
|
|
3155
3405
|
};
|
|
3156
3406
|
|
|
3157
3407
|
// src/components/blocks/actions.tsx
|
|
3158
|
-
var
|
|
3408
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3159
3409
|
var Actions = (props) => {
|
|
3160
3410
|
const { elements, block_id } = props.data;
|
|
3161
|
-
return /* @__PURE__ */ (0,
|
|
3411
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3162
3412
|
"div",
|
|
3163
3413
|
{
|
|
3164
3414
|
id: block_id,
|
|
3165
3415
|
className: "mb-2 text-primary flex w-full text-black-primary items-center slack_blocks_to_jsx__actions",
|
|
3166
|
-
children: /* @__PURE__ */ (0,
|
|
3416
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "flex flex-wrap", children: elements.map((element, i) => {
|
|
3167
3417
|
if (element.type === "button") {
|
|
3168
|
-
return /* @__PURE__ */ (0,
|
|
3418
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mt-2 mr-2", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ButtonElement, { data: element }) }, i);
|
|
3169
3419
|
}
|
|
3170
3420
|
if (element.type === "static_select") {
|
|
3171
|
-
return /* @__PURE__ */ (0,
|
|
3421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mt-2 mr-2", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(StaticSelectElement, { data: element }) }, i);
|
|
3172
3422
|
}
|
|
3173
|
-
return /* @__PURE__ */ (0,
|
|
3423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mt-2 mr-2" }, i);
|
|
3174
3424
|
}) })
|
|
3175
3425
|
}
|
|
3176
3426
|
);
|
|
3177
3427
|
};
|
|
3178
3428
|
|
|
3179
3429
|
// src/components/blocks/context.tsx
|
|
3180
|
-
var
|
|
3430
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
3181
3431
|
var Context = (props) => {
|
|
3182
3432
|
const { elements, block_id } = props.data;
|
|
3183
|
-
return /* @__PURE__ */ (0,
|
|
3433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3184
3434
|
"div",
|
|
3185
3435
|
{
|
|
3186
3436
|
id: block_id,
|
|
3187
3437
|
className: "my-1 text-primary flex w-full text-black-primary flex-wrap items-center overflow-hidden slack_blocks_to_jsx__context",
|
|
3188
3438
|
children: elements.slice(0, 10).map((element, i) => {
|
|
3189
3439
|
if (element.type !== "image") {
|
|
3190
|
-
return /* @__PURE__ */ (0,
|
|
3440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { className: "text-black-secondary text-small pr-3 flex items-center", children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(TextObject, { data: element }) }, i);
|
|
3191
3441
|
}
|
|
3192
|
-
return /* @__PURE__ */ (0,
|
|
3442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ImageElement, { data: element }) }, i);
|
|
3193
3443
|
})
|
|
3194
3444
|
}
|
|
3195
3445
|
);
|
|
3196
3446
|
};
|
|
3197
3447
|
|
|
3198
3448
|
// src/components/blocks/divider.tsx
|
|
3199
|
-
var
|
|
3449
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
3200
3450
|
var Divider = (props) => {
|
|
3201
3451
|
const { data } = props;
|
|
3202
3452
|
const { block_id } = data;
|
|
3203
|
-
return /* @__PURE__ */ (0,
|
|
3453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
3204
3454
|
"div",
|
|
3205
3455
|
{
|
|
3206
3456
|
id: block_id,
|
|
@@ -3216,31 +3466,31 @@ var File = (props) => {
|
|
|
3216
3466
|
};
|
|
3217
3467
|
|
|
3218
3468
|
// src/components/blocks/header.tsx
|
|
3219
|
-
var
|
|
3469
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3220
3470
|
var Header2 = (props) => {
|
|
3221
3471
|
const { text, block_id } = props.data;
|
|
3222
|
-
return /* @__PURE__ */ (0,
|
|
3472
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { id: block_id, className: "mt-1 slack_blocks_to_jsx__header", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h3", { className: "text-header font-bold slack_blocks_to_jsx__header_heading", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TextObject, { data: text }) }) });
|
|
3223
3473
|
};
|
|
3224
3474
|
|
|
3225
3475
|
// src/components/blocks/image.tsx
|
|
3226
3476
|
var import_react5 = require("react");
|
|
3227
|
-
var
|
|
3477
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3228
3478
|
var Image = (props) => {
|
|
3229
3479
|
const { block_id, alt_text, image_url, image_bytes, image_height, image_width } = props.data;
|
|
3230
3480
|
const [showImage, setShowImage] = (0, import_react5.useState)(true);
|
|
3231
|
-
return /* @__PURE__ */ (0,
|
|
3232
|
-
/* @__PURE__ */ (0,
|
|
3233
|
-
/* @__PURE__ */ (0,
|
|
3481
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { id: block_id, className: "my-2 flex flex-col gap-2 slack_blocks_to_jsx__image", children: [
|
|
3482
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "text-black-secondary text-small flex gap-1 items-center", children: [
|
|
3483
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("span", { children: [
|
|
3234
3484
|
alt_text,
|
|
3235
3485
|
image_bytes && ` (${Math.round(image_bytes / 1e3)} kB)`
|
|
3236
3486
|
] }),
|
|
3237
|
-
/* @__PURE__ */ (0,
|
|
3487
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3238
3488
|
"button",
|
|
3239
3489
|
{
|
|
3240
3490
|
type: "button",
|
|
3241
3491
|
className: "w-[15px] h-[15px]",
|
|
3242
3492
|
onClick: () => setShowImage((prev) => !prev),
|
|
3243
|
-
children: /* @__PURE__ */ (0,
|
|
3493
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3244
3494
|
"svg",
|
|
3245
3495
|
{
|
|
3246
3496
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3256,7 +3506,7 @@ var Image = (props) => {
|
|
|
3256
3506
|
style: {
|
|
3257
3507
|
transform: showImage ? "rotate(0deg)" : "rotate(-90deg)"
|
|
3258
3508
|
},
|
|
3259
|
-
children: /* @__PURE__ */ (0,
|
|
3509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3260
3510
|
"path",
|
|
3261
3511
|
{
|
|
3262
3512
|
fill: "currentColor",
|
|
@@ -3269,7 +3519,7 @@ var Image = (props) => {
|
|
|
3269
3519
|
}
|
|
3270
3520
|
)
|
|
3271
3521
|
] }),
|
|
3272
|
-
showImage && /* @__PURE__ */ (0,
|
|
3522
|
+
showImage && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "rounded-md overflow-hidden relative max-w-max", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3273
3523
|
"img",
|
|
3274
3524
|
{
|
|
3275
3525
|
src: image_url,
|
|
@@ -3284,17 +3534,17 @@ var Image = (props) => {
|
|
|
3284
3534
|
};
|
|
3285
3535
|
|
|
3286
3536
|
// src/components/blocks/input.tsx
|
|
3287
|
-
var
|
|
3537
|
+
var import_jsx_runtime29 = require("react/jsx-runtime");
|
|
3288
3538
|
var Input = (props) => {
|
|
3289
3539
|
const { element: given_element, label, block_id, hint, optional, type } = props.data;
|
|
3290
3540
|
const element = given_element ? getElementComponent(given_element) : null;
|
|
3291
|
-
return /* @__PURE__ */ (0,
|
|
3541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3292
3542
|
"div",
|
|
3293
3543
|
{
|
|
3294
3544
|
id: block_id,
|
|
3295
3545
|
className: `mt-2 mb-1 text-primary slack_blocks_to_jsx__input flex w-full text-black-primary`,
|
|
3296
|
-
children: /* @__PURE__ */ (0,
|
|
3297
|
-
/* @__PURE__ */ (0,
|
|
3546
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "grow", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-2", children: [
|
|
3547
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3298
3548
|
TextObject,
|
|
3299
3549
|
{
|
|
3300
3550
|
data: {
|
|
@@ -3305,11 +3555,11 @@ var Input = (props) => {
|
|
|
3305
3555
|
}
|
|
3306
3556
|
}
|
|
3307
3557
|
),
|
|
3308
|
-
/* @__PURE__ */ (0,
|
|
3309
|
-
/* @__PURE__ */ (0,
|
|
3310
|
-
(hint || given_element.type === "plain_text_input") && /* @__PURE__ */ (0,
|
|
3311
|
-
hint && /* @__PURE__ */ (0,
|
|
3312
|
-
given_element.type === "plain_text_input" && /* @__PURE__ */ (0,
|
|
3558
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "mb-1 flex flex-col gap-1", children: [
|
|
3559
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "relative shrink-0", children: element }),
|
|
3560
|
+
(hint || given_element.type === "plain_text_input") && /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "text-black-secondary text-small flex gap-1", children: [
|
|
3561
|
+
hint && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "inline", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TextObject, { data: hint }) }),
|
|
3562
|
+
given_element.type === "plain_text_input" && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("p", { children: "\u21B5 Please 'enter' to submit" })
|
|
3313
3563
|
] })
|
|
3314
3564
|
] })
|
|
3315
3565
|
] }) })
|
|
@@ -3318,27 +3568,27 @@ var Input = (props) => {
|
|
|
3318
3568
|
};
|
|
3319
3569
|
|
|
3320
3570
|
// src/components/blocks/rich_text/rich_text_list_wrapper.tsx
|
|
3321
|
-
var
|
|
3571
|
+
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
3322
3572
|
var RichTextListWrapper = (props) => {
|
|
3323
3573
|
const _a = props, { element, children } = _a, rest = __objRest(_a, ["element", "children"]);
|
|
3324
3574
|
if (element.style === "bullet") {
|
|
3325
|
-
return /* @__PURE__ */ (0,
|
|
3575
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ul", __spreadProps(__spreadValues({}, rest), { children }));
|
|
3326
3576
|
}
|
|
3327
|
-
return /* @__PURE__ */ (0,
|
|
3577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("ol", __spreadProps(__spreadValues({}, rest), { children }));
|
|
3328
3578
|
};
|
|
3329
3579
|
|
|
3330
3580
|
// src/components/blocks/rich_text/rich_text_section_broadcast.tsx
|
|
3331
|
-
var
|
|
3581
|
+
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
3332
3582
|
var RichTextSectionBroadcast = (props) => {
|
|
3333
3583
|
const { range, style } = props;
|
|
3334
3584
|
const { hooks } = useGlobalData();
|
|
3335
3585
|
if (range === "channel" && hooks.atChannel)
|
|
3336
|
-
return /* @__PURE__ */ (0,
|
|
3586
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: hooks.atChannel() });
|
|
3337
3587
|
if (range === "everyone" && hooks.atEveryone)
|
|
3338
|
-
return /* @__PURE__ */ (0,
|
|
3588
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: hooks.atEveryone() });
|
|
3339
3589
|
if (range === "here" && hooks.atHere)
|
|
3340
|
-
return /* @__PURE__ */ (0,
|
|
3341
|
-
return /* @__PURE__ */ (0,
|
|
3590
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, { children: hooks.atHere() });
|
|
3591
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
|
|
3342
3592
|
"span",
|
|
3343
3593
|
{
|
|
3344
3594
|
className: `
|
|
@@ -3357,15 +3607,15 @@ var RichTextSectionBroadcast = (props) => {
|
|
|
3357
3607
|
};
|
|
3358
3608
|
|
|
3359
3609
|
// src/components/blocks/rich_text/rich_text_section_channel.tsx
|
|
3360
|
-
var
|
|
3610
|
+
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
3361
3611
|
var RichTextSectionChannel = (props) => {
|
|
3362
3612
|
const { channel_id, style } = props;
|
|
3363
3613
|
const { channels, hooks } = useGlobalData();
|
|
3364
3614
|
const channel = channels.find((u) => u.id === channel_id || u.name === channel_id);
|
|
3365
3615
|
const label = (channel == null ? void 0 : channel.name) || channel_id;
|
|
3366
3616
|
if (hooks.channel)
|
|
3367
|
-
return /* @__PURE__ */ (0,
|
|
3368
|
-
return /* @__PURE__ */ (0,
|
|
3617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(import_jsx_runtime32.Fragment, { children: hooks.channel(channel || { id: channel_id, name: label }) });
|
|
3618
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
|
|
3369
3619
|
"span",
|
|
3370
3620
|
{
|
|
3371
3621
|
"data-channel-id": (channel == null ? void 0 : channel.id) || channel_id,
|
|
@@ -3385,23 +3635,23 @@ var RichTextSectionChannel = (props) => {
|
|
|
3385
3635
|
};
|
|
3386
3636
|
|
|
3387
3637
|
// src/components/blocks/rich_text/rich_text_section_emoji.tsx
|
|
3388
|
-
var
|
|
3638
|
+
var import_jsx_runtime33 = require("react/jsx-runtime");
|
|
3389
3639
|
var RichTextSectionEmoji = (props) => {
|
|
3390
3640
|
const { name } = props;
|
|
3391
3641
|
const { hooks } = useGlobalData();
|
|
3392
|
-
return /* @__PURE__ */ (0,
|
|
3642
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("span", { className: "slack_blocks_to_jsx__rich_text_section_element_emoji", children: hooks.emoji ? hooks.emoji(name) : parseEmojis(`:${name}:`) });
|
|
3393
3643
|
};
|
|
3394
3644
|
|
|
3395
3645
|
// src/components/blocks/rich_text/rich_text_section_user.tsx
|
|
3396
|
-
var
|
|
3646
|
+
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
3397
3647
|
var RichTextSectionUser = (props) => {
|
|
3398
3648
|
const { user_id, style } = props;
|
|
3399
3649
|
const { users, hooks } = useGlobalData();
|
|
3400
3650
|
const user = users.find((u) => u.id === user_id || u.name === user_id);
|
|
3401
3651
|
const label = (user == null ? void 0 : user.name) || user_id;
|
|
3402
3652
|
if (hooks.user)
|
|
3403
|
-
return /* @__PURE__ */ (0,
|
|
3404
|
-
return /* @__PURE__ */ (0,
|
|
3653
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(import_jsx_runtime34.Fragment, { children: hooks.user(user || { id: user_id, name: label }) });
|
|
3654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
3405
3655
|
"span",
|
|
3406
3656
|
{
|
|
3407
3657
|
"data-user-id": (user == null ? void 0 : user.id) || user_id,
|
|
@@ -3421,15 +3671,15 @@ var RichTextSectionUser = (props) => {
|
|
|
3421
3671
|
};
|
|
3422
3672
|
|
|
3423
3673
|
// src/components/blocks/rich_text/rich_text_section_user_group.tsx
|
|
3424
|
-
var
|
|
3674
|
+
var import_jsx_runtime35 = require("react/jsx-runtime");
|
|
3425
3675
|
var RichTextSectionUserGroup = (props) => {
|
|
3426
3676
|
const { usergroup_id, style } = props;
|
|
3427
3677
|
const { user_groups, hooks } = useGlobalData();
|
|
3428
3678
|
const group = user_groups.find((u) => u.id === usergroup_id || u.name === usergroup_id);
|
|
3429
3679
|
const label = (group == null ? void 0 : group.name) || usergroup_id;
|
|
3430
3680
|
if (hooks.usergroup)
|
|
3431
|
-
return /* @__PURE__ */ (0,
|
|
3432
|
-
return /* @__PURE__ */ (0,
|
|
3681
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(import_jsx_runtime35.Fragment, { children: hooks.usergroup(group || { id: usergroup_id, name: label }) });
|
|
3682
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
|
|
3433
3683
|
"span",
|
|
3434
3684
|
{
|
|
3435
3685
|
"data-usergroup-id": (group == null ? void 0 : group.id) || usergroup_id,
|
|
@@ -3449,22 +3699,22 @@ var RichTextSectionUserGroup = (props) => {
|
|
|
3449
3699
|
};
|
|
3450
3700
|
|
|
3451
3701
|
// src/components/blocks/rich_text/rich_text_section.tsx
|
|
3452
|
-
var
|
|
3702
|
+
var import_jsx_runtime36 = require("react/jsx-runtime");
|
|
3453
3703
|
var RichTextSectionElement = (props) => {
|
|
3454
3704
|
const { element } = props;
|
|
3455
3705
|
if (element.type === "user")
|
|
3456
|
-
return /* @__PURE__ */ (0,
|
|
3706
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RichTextSectionUser, __spreadValues({}, element));
|
|
3457
3707
|
if (element.type === "channel")
|
|
3458
|
-
return /* @__PURE__ */ (0,
|
|
3708
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RichTextSectionChannel, __spreadValues({}, element));
|
|
3459
3709
|
if (element.type === "broadcast")
|
|
3460
|
-
return /* @__PURE__ */ (0,
|
|
3710
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RichTextSectionBroadcast, __spreadValues({}, element));
|
|
3461
3711
|
if (element.type === "emoji")
|
|
3462
|
-
return /* @__PURE__ */ (0,
|
|
3712
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RichTextSectionEmoji, __spreadValues({}, element));
|
|
3463
3713
|
if (element.type === "usergroup")
|
|
3464
|
-
return /* @__PURE__ */ (0,
|
|
3714
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(RichTextSectionUserGroup, __spreadValues({}, element));
|
|
3465
3715
|
if (element.type === "text") {
|
|
3466
3716
|
const { text, style } = element;
|
|
3467
|
-
return /* @__PURE__ */ (0,
|
|
3717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3468
3718
|
"span",
|
|
3469
3719
|
{
|
|
3470
3720
|
className: `
|
|
@@ -3480,7 +3730,7 @@ var RichTextSectionElement = (props) => {
|
|
|
3480
3730
|
}
|
|
3481
3731
|
if (element.type === "link") {
|
|
3482
3732
|
const { url, style, text } = element;
|
|
3483
|
-
return /* @__PURE__ */ (0,
|
|
3733
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3484
3734
|
"a",
|
|
3485
3735
|
{
|
|
3486
3736
|
target: "_blank",
|
|
@@ -3498,25 +3748,54 @@ var RichTextSectionElement = (props) => {
|
|
|
3498
3748
|
}
|
|
3499
3749
|
);
|
|
3500
3750
|
}
|
|
3751
|
+
if (element.type === "date") {
|
|
3752
|
+
const { timestamp, format, style } = element;
|
|
3753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3754
|
+
"span",
|
|
3755
|
+
{
|
|
3756
|
+
className: `
|
|
3757
|
+
slack_blocks_to_jsx__rich_text_section_element_date
|
|
3758
|
+
${(style == null ? void 0 : style.italic) ? "italic" : ""}
|
|
3759
|
+
${(style == null ? void 0 : style.strike) ? "line-through" : ""}
|
|
3760
|
+
${(style == null ? void 0 : style.code) ? "slack_inline_code" : ""}
|
|
3761
|
+
${(style == null ? void 0 : style.bold) ? "font-medium" : ""}
|
|
3762
|
+
`,
|
|
3763
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3764
|
+
SlackDate,
|
|
3765
|
+
{
|
|
3766
|
+
element: {
|
|
3767
|
+
type: "slack_date",
|
|
3768
|
+
value: {
|
|
3769
|
+
fallbackText: "",
|
|
3770
|
+
optionalLink: "",
|
|
3771
|
+
timestamp: timestamp.toString(),
|
|
3772
|
+
tokenString: format
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3775
|
+
}
|
|
3776
|
+
)
|
|
3777
|
+
}
|
|
3778
|
+
);
|
|
3779
|
+
}
|
|
3501
3780
|
return null;
|
|
3502
3781
|
};
|
|
3503
3782
|
|
|
3504
3783
|
// src/components/blocks/rich_text/rich_text.tsx
|
|
3505
|
-
var
|
|
3784
|
+
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
3506
3785
|
var RichText = (props) => {
|
|
3507
3786
|
const { elements, block_id } = props.data;
|
|
3508
|
-
return /* @__PURE__ */ (0,
|
|
3509
|
-
return /* @__PURE__ */ (0,
|
|
3787
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { id: block_id, className: "slack_blocks_to_jsx__rich_text", children: elements.map((element, i) => {
|
|
3788
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Element, { element }, `${element.type}__${i}`);
|
|
3510
3789
|
}) });
|
|
3511
3790
|
};
|
|
3512
3791
|
var Element = (props) => {
|
|
3513
3792
|
const { element } = props;
|
|
3514
3793
|
if (element.type === "rich_text_list") {
|
|
3515
3794
|
const { elements, style, border = 0, indent, offset } = element;
|
|
3516
|
-
return /* @__PURE__ */ (0,
|
|
3517
|
-
border === 1 && /* @__PURE__ */ (0,
|
|
3518
|
-
/* @__PURE__ */ (0,
|
|
3519
|
-
return /* @__PURE__ */ (0,
|
|
3795
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "flex gap-2 slack_blocks_to_jsx__rich_text_list_element", children: [
|
|
3796
|
+
border === 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
|
|
3797
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(RichTextListWrapper, { element, className: `list-none`, children: elements.map((el, i) => {
|
|
3798
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
3520
3799
|
"li",
|
|
3521
3800
|
{
|
|
3522
3801
|
className: "flex",
|
|
@@ -3524,22 +3803,22 @@ var Element = (props) => {
|
|
|
3524
3803
|
marginLeft: indent ? indent > 5 ? 0 : indent * 28 + 6 + 28 : 0
|
|
3525
3804
|
},
|
|
3526
3805
|
children: [
|
|
3527
|
-
style === "ordered" && /* @__PURE__ */ (0,
|
|
3806
|
+
style === "ordered" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "w-[22px] h-[22px] shrink-0 flex items-center justify-center", children: [
|
|
3528
3807
|
i + 1,
|
|
3529
3808
|
"."
|
|
3530
3809
|
] }),
|
|
3531
|
-
style === "bullet" && /* @__PURE__ */ (0,
|
|
3532
|
-
(indent === void 0 || indent === 0 || indent === 3 || indent === 6) && /* @__PURE__ */ (0,
|
|
3533
|
-
(indent === 1 || indent === 4 || indent === 7) && /* @__PURE__ */ (0,
|
|
3534
|
-
(indent === 2 || indent === 5 || indent === 8) && /* @__PURE__ */ (0,
|
|
3810
|
+
style === "bullet" && /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "w-[22px] h-[22px] shrink-0 flex items-center justify-center", children: [
|
|
3811
|
+
(indent === void 0 || indent === 0 || indent === 3 || indent === 6) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "w-1.5 h-1.5 rounded-full bg-current" }),
|
|
3812
|
+
(indent === 1 || indent === 4 || indent === 7) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "w-1.5 h-1.5 rounded-full border border-current" }),
|
|
3813
|
+
(indent === 2 || indent === 5 || indent === 8) && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "w-1.5 h-1.5 rounded-[1.5px] bg-current" })
|
|
3535
3814
|
] }),
|
|
3536
|
-
/* @__PURE__ */ (0,
|
|
3815
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3537
3816
|
"div",
|
|
3538
3817
|
{
|
|
3539
3818
|
style: {
|
|
3540
3819
|
marginLeft: 6
|
|
3541
3820
|
},
|
|
3542
|
-
children: /* @__PURE__ */ (0,
|
|
3821
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Element, { element: el }, `${element.type}__${i}`)
|
|
3543
3822
|
}
|
|
3544
3823
|
)
|
|
3545
3824
|
]
|
|
@@ -3551,9 +3830,9 @@ var Element = (props) => {
|
|
|
3551
3830
|
}
|
|
3552
3831
|
if (element.type === "rich_text_preformatted") {
|
|
3553
3832
|
const { elements, border } = element;
|
|
3554
|
-
return /* @__PURE__ */ (0,
|
|
3555
|
-
border === 1 && /* @__PURE__ */ (0,
|
|
3556
|
-
/* @__PURE__ */ (0,
|
|
3833
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("code", { className: "flex gap-2 w-full slack_blocks_to_jsx__rich_text_preformatted_element", children: [
|
|
3834
|
+
border === 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
|
|
3835
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
3557
3836
|
"pre",
|
|
3558
3837
|
{
|
|
3559
3838
|
className: "p-2 rounded my-1 whitespace-pre-wrap bg-gray-secondary text-xs leading-[1.50001] border grow",
|
|
@@ -3562,7 +3841,7 @@ var Element = (props) => {
|
|
|
3562
3841
|
wordBreak: "normal"
|
|
3563
3842
|
},
|
|
3564
3843
|
children: elements.map((el, i) => {
|
|
3565
|
-
return /* @__PURE__ */ (0,
|
|
3844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
|
|
3566
3845
|
})
|
|
3567
3846
|
}
|
|
3568
3847
|
)
|
|
@@ -3570,41 +3849,41 @@ var Element = (props) => {
|
|
|
3570
3849
|
}
|
|
3571
3850
|
if (element.type === "rich_text_quote") {
|
|
3572
3851
|
const { elements, border } = element;
|
|
3573
|
-
return /* @__PURE__ */ (0,
|
|
3574
|
-
border === 1 && /* @__PURE__ */ (0,
|
|
3852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("blockquote", { className: "flex gap-2 slack_blocks_to_jsx__rich_text_quote_element", children: [
|
|
3853
|
+
border === 1 && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "w-1 rounded bg-gray-primary self-stretch" }),
|
|
3575
3854
|
elements.map((el, i) => {
|
|
3576
|
-
return /* @__PURE__ */ (0,
|
|
3855
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
|
|
3577
3856
|
})
|
|
3578
3857
|
] });
|
|
3579
3858
|
}
|
|
3580
3859
|
if (element.type === "rich_text_section") {
|
|
3581
3860
|
const { elements } = element;
|
|
3582
|
-
return /* @__PURE__ */ (0,
|
|
3583
|
-
return /* @__PURE__ */ (0,
|
|
3861
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "inline-block slack_blocks_to_jsx__rich_text_section_element", children: elements.map((el, i) => {
|
|
3862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(RichTextSectionElement, { element: el }, `${el.type}__${i}`);
|
|
3584
3863
|
}) });
|
|
3585
3864
|
}
|
|
3586
3865
|
return null;
|
|
3587
3866
|
};
|
|
3588
3867
|
|
|
3589
3868
|
// src/components/blocks/section.tsx
|
|
3590
|
-
var
|
|
3869
|
+
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
3591
3870
|
var Section = (props) => {
|
|
3592
3871
|
const { accessory, fields, text, block_id } = props.data;
|
|
3593
3872
|
const element = accessory ? getElementComponent(accessory) : null;
|
|
3594
3873
|
const is_stacked = accessory ? is_accessory_stacked(accessory) : false;
|
|
3595
|
-
return /* @__PURE__ */ (0,
|
|
3874
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
|
|
3596
3875
|
"div",
|
|
3597
3876
|
{
|
|
3598
3877
|
id: block_id,
|
|
3599
3878
|
className: `mt-2 mb-1 text-primary slack_blocks_to_jsx__section flex w-full text-black-primary ${is_stacked ? "flex-col" : ""}`,
|
|
3600
3879
|
children: [
|
|
3601
|
-
/* @__PURE__ */ (0,
|
|
3602
|
-
text && /* @__PURE__ */ (0,
|
|
3603
|
-
fields && /* @__PURE__ */ (0,
|
|
3604
|
-
return /* @__PURE__ */ (0,
|
|
3880
|
+
/* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "grow", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "flex flex-col gap-3", children: [
|
|
3881
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TextObject, { data: text }),
|
|
3882
|
+
fields && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "grid grid-col-2 w-full", children: fields.map((field, i) => {
|
|
3883
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(TextObject, { data: field }, i);
|
|
3605
3884
|
}) })
|
|
3606
3885
|
] }) }),
|
|
3607
|
-
element && is_stacked ? element : /* @__PURE__ */ (0,
|
|
3886
|
+
element && is_stacked ? element : /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "ml-2 mb-1 relative shrink-0", children: element })
|
|
3608
3887
|
]
|
|
3609
3888
|
}
|
|
3610
3889
|
);
|
|
@@ -3612,13 +3891,9 @@ var Section = (props) => {
|
|
|
3612
3891
|
|
|
3613
3892
|
// src/components/blocks/video.tsx
|
|
3614
3893
|
var import_react6 = require("react");
|
|
3615
|
-
var
|
|
3894
|
+
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
3616
3895
|
var Video = (props) => {
|
|
3617
3896
|
const {
|
|
3618
|
-
// thumbnail_url,
|
|
3619
|
-
// provider_icon_url,
|
|
3620
|
-
// provider_name,
|
|
3621
|
-
//
|
|
3622
3897
|
alt_text,
|
|
3623
3898
|
title,
|
|
3624
3899
|
video_url,
|
|
@@ -3629,18 +3904,18 @@ var Video = (props) => {
|
|
|
3629
3904
|
iframeProps = {}
|
|
3630
3905
|
} = props.data;
|
|
3631
3906
|
const [showVideo, setShowVideo] = (0, import_react6.useState)(true);
|
|
3632
|
-
return /* @__PURE__ */ (0,
|
|
3633
|
-
author_name && /* @__PURE__ */ (0,
|
|
3634
|
-
description && /* @__PURE__ */ (0,
|
|
3635
|
-
/* @__PURE__ */ (0,
|
|
3636
|
-
title_url ? /* @__PURE__ */ (0,
|
|
3637
|
-
/* @__PURE__ */ (0,
|
|
3907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "py-2 slack_blocks_to_jsx__video", id: block_id, children: [
|
|
3908
|
+
author_name && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "slack_blocks_to_jsx__video_author", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("span", { className: "font-bold", children: author_name }) }),
|
|
3909
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "slack_blocks_to_jsx__video_description", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TextObject, { data: description }) }),
|
|
3910
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsxs)("div", { className: "flex flex-wrap items-center gap-1 slack_blocks_to_jsx__video_title", children: [
|
|
3911
|
+
title_url ? /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("a", { href: title_url, className: "text-blue-primary", target: "_blank", rel: "noreferrer", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TextObject, { data: title }) }) : /* @__PURE__ */ (0, import_jsx_runtime39.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(TextObject, { data: title }) }),
|
|
3912
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3638
3913
|
"button",
|
|
3639
3914
|
{
|
|
3640
3915
|
type: "button",
|
|
3641
3916
|
className: "w-[15px] h-[15px]",
|
|
3642
3917
|
onClick: () => setShowVideo((prev) => !prev),
|
|
3643
|
-
children: /* @__PURE__ */ (0,
|
|
3918
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3644
3919
|
"svg",
|
|
3645
3920
|
{
|
|
3646
3921
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3656,7 +3931,7 @@ var Video = (props) => {
|
|
|
3656
3931
|
style: {
|
|
3657
3932
|
transform: showVideo ? "rotate(0deg)" : "rotate(-90deg)"
|
|
3658
3933
|
},
|
|
3659
|
-
children: /* @__PURE__ */ (0,
|
|
3934
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3660
3935
|
"path",
|
|
3661
3936
|
{
|
|
3662
3937
|
fill: "currentColor",
|
|
@@ -3669,7 +3944,7 @@ var Video = (props) => {
|
|
|
3669
3944
|
}
|
|
3670
3945
|
)
|
|
3671
3946
|
] }),
|
|
3672
|
-
/* @__PURE__ */ (0,
|
|
3947
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)("div", { className: "slack_blocks_to_jsx__video_container max-w-max", children: showVideo && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
|
|
3673
3948
|
"iframe",
|
|
3674
3949
|
__spreadValues({
|
|
3675
3950
|
title: alt_text,
|
|
@@ -3681,41 +3956,41 @@ var Video = (props) => {
|
|
|
3681
3956
|
};
|
|
3682
3957
|
|
|
3683
3958
|
// src/components/index.tsx
|
|
3684
|
-
var
|
|
3959
|
+
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
3685
3960
|
var getBlockComponent = (block) => {
|
|
3686
3961
|
if (block.type === "divider")
|
|
3687
|
-
return /* @__PURE__ */ (0,
|
|
3962
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Divider, { data: block });
|
|
3688
3963
|
if (block.type === "section")
|
|
3689
|
-
return /* @__PURE__ */ (0,
|
|
3964
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Section, { data: block });
|
|
3690
3965
|
if (block.type === "image")
|
|
3691
|
-
return /* @__PURE__ */ (0,
|
|
3966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Image, { data: block });
|
|
3692
3967
|
if (block.type === "context")
|
|
3693
|
-
return /* @__PURE__ */ (0,
|
|
3968
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Context, { data: block });
|
|
3694
3969
|
if (block.type === "actions")
|
|
3695
|
-
return /* @__PURE__ */ (0,
|
|
3970
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Actions, { data: block });
|
|
3696
3971
|
if (block.type === "file")
|
|
3697
|
-
return /* @__PURE__ */ (0,
|
|
3972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(File, { data: block });
|
|
3698
3973
|
if (block.type === "header")
|
|
3699
|
-
return /* @__PURE__ */ (0,
|
|
3974
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Header2, { data: block });
|
|
3700
3975
|
if (block.type === "input")
|
|
3701
|
-
return /* @__PURE__ */ (0,
|
|
3976
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Input, { data: block });
|
|
3702
3977
|
if (block.type === "video")
|
|
3703
|
-
return /* @__PURE__ */ (0,
|
|
3978
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(Video, { data: block });
|
|
3704
3979
|
if (block.type === "rich_text")
|
|
3705
|
-
return /* @__PURE__ */ (0,
|
|
3980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(RichText, { data: block });
|
|
3706
3981
|
return null;
|
|
3707
3982
|
};
|
|
3708
3983
|
var getElementComponent = (element) => {
|
|
3709
3984
|
if (element.type === "button")
|
|
3710
|
-
return /* @__PURE__ */ (0,
|
|
3985
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ButtonElement, { data: element });
|
|
3711
3986
|
if (element.type === "checkboxes")
|
|
3712
|
-
return /* @__PURE__ */ (0,
|
|
3987
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CheckboxesElement, { data: element });
|
|
3713
3988
|
if (element.type === "image")
|
|
3714
|
-
return /* @__PURE__ */ (0,
|
|
3989
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ImageElement, { data: element });
|
|
3715
3990
|
if (element.type === "plain_text_input")
|
|
3716
|
-
return /* @__PURE__ */ (0,
|
|
3991
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(PlaintTextInput, { data: element });
|
|
3717
3992
|
if (element.type === "users_select")
|
|
3718
|
-
return /* @__PURE__ */ (0,
|
|
3993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(UsersSelectElement, { data: element });
|
|
3719
3994
|
if (element.type === "datepicker")
|
|
3720
3995
|
return null;
|
|
3721
3996
|
if (element.type === "datetimepicker")
|
|
@@ -3754,15 +4029,15 @@ var getElementComponent = (element) => {
|
|
|
3754
4029
|
};
|
|
3755
4030
|
|
|
3756
4031
|
// src/block_wrapper.tsx
|
|
3757
|
-
var
|
|
4032
|
+
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
3758
4033
|
var BlockWrapper = (props) => {
|
|
3759
4034
|
const { children } = props;
|
|
3760
|
-
return /* @__PURE__ */ (0,
|
|
4035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "text-base slack_blocks_to_jsx--block_wrapper break-words font-normal", children });
|
|
3761
4036
|
};
|
|
3762
4037
|
|
|
3763
4038
|
// src/message.tsx
|
|
3764
4039
|
var import_react7 = require("react");
|
|
3765
|
-
var
|
|
4040
|
+
var import_jsx_runtime42 = require("react/jsx-runtime");
|
|
3766
4041
|
var Message = (props) => {
|
|
3767
4042
|
const {
|
|
3768
4043
|
blocks,
|
|
@@ -3789,7 +4064,7 @@ var Message = (props) => {
|
|
|
3789
4064
|
setHooks(hooks);
|
|
3790
4065
|
}, [data, hooks]);
|
|
3791
4066
|
if (withoutWrapper) {
|
|
3792
|
-
return /* @__PURE__ */ (0,
|
|
4067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3793
4068
|
"div",
|
|
3794
4069
|
{
|
|
3795
4070
|
id: "slack_blocks_to_jsx",
|
|
@@ -3799,18 +4074,18 @@ var Message = (props) => {
|
|
|
3799
4074
|
const element = getBlockComponent(block);
|
|
3800
4075
|
if (!element)
|
|
3801
4076
|
return null;
|
|
3802
|
-
return /* @__PURE__ */ (0,
|
|
4077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BlockWrapper, { children: element }, i);
|
|
3803
4078
|
})
|
|
3804
4079
|
}
|
|
3805
4080
|
);
|
|
3806
4081
|
}
|
|
3807
|
-
return /* @__PURE__ */ (0,
|
|
4082
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { id: "slack_blocks_to_jsx", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
|
|
3808
4083
|
"section",
|
|
3809
4084
|
{
|
|
3810
4085
|
className: `flex gap-2 w-full max-w-[600px] slack_blocks_to_jsx relative ${unstyled ? "styles_disabled" : "styles_enabled"} ${className}`,
|
|
3811
4086
|
style,
|
|
3812
4087
|
children: [
|
|
3813
|
-
showBlockKitDebug && /* @__PURE__ */ (0,
|
|
4088
|
+
showBlockKitDebug && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
3814
4089
|
"a",
|
|
3815
4090
|
{
|
|
3816
4091
|
target: "_blank",
|
|
@@ -3822,14 +4097,14 @@ var Message = (props) => {
|
|
|
3822
4097
|
children: "Open in Slack Block Kit Builder"
|
|
3823
4098
|
}
|
|
3824
4099
|
),
|
|
3825
|
-
/* @__PURE__ */ (0,
|
|
3826
|
-
/* @__PURE__ */ (0,
|
|
3827
|
-
/* @__PURE__ */ (0,
|
|
3828
|
-
/* @__PURE__ */ (0,
|
|
4100
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("img", { src: logo, className: "w-9 h-9", alt: name }) }),
|
|
4101
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "flex flex-col w-full", children: [
|
|
4102
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(Header, { name, time }),
|
|
4103
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "slack_blocks_to_jsx--blocks", children: blocks.map((block, i) => {
|
|
3829
4104
|
const element = getBlockComponent(block);
|
|
3830
4105
|
if (!element)
|
|
3831
4106
|
return null;
|
|
3832
|
-
return /* @__PURE__ */ (0,
|
|
4107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(BlockWrapper, { children: element }, i);
|
|
3833
4108
|
}) })
|
|
3834
4109
|
] })
|
|
3835
4110
|
]
|