@postrun/react 2.5.0 → 2.6.0

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 CHANGED
@@ -10,8 +10,8 @@ var pLimit = require('p-limit');
10
10
  var pRetry = require('p-retry');
11
11
  var axios = require('axios');
12
12
  var reactTweet = require('react-tweet');
13
- var fi = require('react-icons/fi');
14
13
  var jsxRuntime = require('react/jsx-runtime');
14
+ var fi = require('react-icons/fi');
15
15
  var twitterText = require('twitter-text');
16
16
  var lu = require('react-icons/lu');
17
17
  var useEmblaCarousel = require('embla-carousel-react');
@@ -1040,6 +1040,37 @@ function useResolvedMedia(media, altFallbacks, altSignature) {
1040
1040
  [signature, altSignature, objectUrls]
1041
1041
  );
1042
1042
  }
1043
+ function XPoll({ poll }) {
1044
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapStyle, children: [
1045
+ poll.options.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: optionStyle, children: option }, `${option}-${i}`)),
1046
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: footerStyle, children: [
1047
+ "0 votes \xB7 ",
1048
+ js.xPollDurationLabel(poll.duration_minutes)
1049
+ ] })
1050
+ ] });
1051
+ }
1052
+ var BLUE = "var(--tweet-color-blue-primary, #1d9bf0)";
1053
+ var MUTED = "var(--tweet-color-gray-secondary, #536471)";
1054
+ var wrapStyle = {
1055
+ display: "flex",
1056
+ flexDirection: "column",
1057
+ gap: 8,
1058
+ marginTop: 12
1059
+ };
1060
+ var optionStyle = {
1061
+ border: `1px solid ${BLUE}`,
1062
+ color: BLUE,
1063
+ borderRadius: 999,
1064
+ padding: "8px 16px",
1065
+ textAlign: "center",
1066
+ fontSize: 15,
1067
+ fontWeight: 700
1068
+ };
1069
+ var footerStyle = {
1070
+ fontSize: 13,
1071
+ color: MUTED,
1072
+ marginTop: 2
1073
+ };
1043
1074
  var ROW = {
1044
1075
  display: "flex",
1045
1076
  justifyContent: "space-between",
@@ -1280,6 +1311,7 @@ function XPostPreviewImpl({
1280
1311
  tweet.in_reply_to_screen_name ? /* @__PURE__ */ jsxRuntime.jsx(reactTweet.TweetInReplyTo, { tweet }) : null,
1281
1312
  /* @__PURE__ */ jsxRuntime.jsx(reactTweet.TweetBody, { tweet }),
1282
1313
  tweet.mediaDetails?.length ? /* @__PURE__ */ jsxRuntime.jsx(reactTweet.TweetMedia, { tweet, components }) : null,
1314
+ variant.settings?.poll ? /* @__PURE__ */ jsxRuntime.jsx(XPoll, { poll: variant.settings.poll }) : null,
1283
1315
  tweet.quoted_tweet ? /* @__PURE__ */ jsxRuntime.jsx(reactTweet.QuotedTweet, { tweet: tweet.quoted_tweet }) : null,
1284
1316
  showActions ? /* @__PURE__ */ jsxRuntime.jsx(XPreviewActions, {}) : null
1285
1317
  ] })
@@ -1651,16 +1683,16 @@ function Media({ media }) {
1651
1683
  return /* @__PURE__ */ jsxRuntime.jsx(ImageMosaic, { media: images });
1652
1684
  }
1653
1685
  function Poll({ poll }) {
1654
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapStyle, children: [
1686
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapStyle2, children: [
1655
1687
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: questionStyle, children: poll.question }),
1656
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: optionsStyle, children: poll.options.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: optionStyle, children: option }, `${option}-${i}`)) }),
1657
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: footerStyle, children: [
1688
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: optionsStyle, children: poll.options.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx("div", { style: optionStyle2, children: option }, `${option}-${i}`)) }),
1689
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: footerStyle2, children: [
1658
1690
  "0 votes \u2022 ",
1659
1691
  js.linkedinPollDurationLabel(poll.duration)
1660
1692
  ] })
1661
1693
  ] });
1662
1694
  }
1663
- var wrapStyle = {
1695
+ var wrapStyle2 = {
1664
1696
  border: `1px solid ${varRef(LI_VAR.border)}`,
1665
1697
  borderRadius: 8,
1666
1698
  padding: 12,
@@ -1679,7 +1711,7 @@ var optionsStyle = {
1679
1711
  flexDirection: "column",
1680
1712
  gap: 8
1681
1713
  };
1682
- var optionStyle = {
1714
+ var optionStyle2 = {
1683
1715
  border: `1px solid ${varRef(LI_VAR.accent)}`,
1684
1716
  borderRadius: 999,
1685
1717
  padding: "8px 16px",
@@ -1688,7 +1720,7 @@ var optionStyle = {
1688
1720
  fontWeight: 600,
1689
1721
  color: varRef(LI_VAR.accent)
1690
1722
  };
1691
- var footerStyle = {
1723
+ var footerStyle2 = {
1692
1724
  fontSize: 12,
1693
1725
  color: varRef(LI_VAR.muted)
1694
1726
  };
@@ -1876,7 +1908,7 @@ function Caption({ body }) {
1876
1908
  setOverflowing(el.scrollHeight > el.clientHeight + 1);
1877
1909
  }, [body, expanded]);
1878
1910
  const parts = body.split(TOKEN);
1879
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapStyle2, children: [
1911
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: wrapStyle3, children: [
1880
1912
  /* @__PURE__ */ jsxRuntime.jsx("div", { ref, style: expanded ? expandedTextStyle : clampedTextStyle, children: parts.map(
1881
1913
  (part, i) => IS_TOKEN.test(part) ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: LINK_COLOR }, children: part }, i) : /* @__PURE__ */ jsxRuntime.jsx("span", { children: part }, i)
1882
1914
  ) }),
@@ -1893,7 +1925,7 @@ function Caption({ body }) {
1893
1925
  ) : null
1894
1926
  ] });
1895
1927
  }
1896
- var wrapStyle2 = {
1928
+ var wrapStyle3 = {
1897
1929
  fontSize: 14,
1898
1930
  lineHeight: 1.35
1899
1931
  };
@@ -2348,7 +2380,7 @@ function useIsDark2(theme) {
2348
2380
  }
2349
2381
  return theme === "dark";
2350
2382
  }
2351
- var MUTED = varRef2(TT_VAR.muted);
2383
+ var MUTED2 = varRef2(TT_VAR.muted);
2352
2384
  var BORDER = varRef2(TT_VAR.border);
2353
2385
  var ACCENT = varRef2(TT_VAR.accent);
2354
2386
  var SWITCH_OFF = varRef2(TT_VAR.switchOff);
@@ -2362,7 +2394,7 @@ function Row({
2362
2394
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: rowStyle, children: [
2363
2395
  /* @__PURE__ */ jsxRuntime.jsxs("label", { htmlFor, style: { display: "flex", flexDirection: "column", gap: 2 }, children: [
2364
2396
  /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 14 }, children: label }),
2365
- sublabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: MUTED }, children: sublabel }) : null
2397
+ sublabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { style: { fontSize: 12, color: MUTED2 }, children: sublabel }) : null
2366
2398
  ] }),
2367
2399
  control
2368
2400
  ] });
@@ -2470,7 +2502,7 @@ var hintStyle = {
2470
2502
  var noticeStyle = {
2471
2503
  margin: 0,
2472
2504
  fontSize: 12,
2473
- color: MUTED,
2505
+ color: MUTED2,
2474
2506
  lineHeight: 1.4
2475
2507
  };
2476
2508
  var checkRowStyle = {
@@ -2479,7 +2511,7 @@ var checkRowStyle = {
2479
2511
  gap: 10,
2480
2512
  cursor: "pointer"
2481
2513
  };
2482
- var TOKENS = { MUTED, BORDER, ACCENT};
2514
+ var TOKENS = { MUTED: MUTED2, BORDER, ACCENT};
2483
2515
  function AudienceSelect({
2484
2516
  creatorInfo,
2485
2517
  value,
@@ -2536,7 +2568,7 @@ function TikTokCaptionField({
2536
2568
  const max = js.captionMaxFor(postType);
2537
2569
  const count = value.length;
2538
2570
  const over = count > max;
2539
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...wrapStyle3, ...style }, children: [
2571
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className, style: { ...wrapStyle4, ...style }, children: [
2540
2572
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: labelRowStyle, children: [
2541
2573
  /* @__PURE__ */ jsxRuntime.jsx("label", { htmlFor: id, style: labelStyle, children: "Caption" }),
2542
2574
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2570,7 +2602,7 @@ function TikTokCaptionField({
2570
2602
  )
2571
2603
  ] });
2572
2604
  }
2573
- var wrapStyle3 = {
2605
+ var wrapStyle4 = {
2574
2606
  display: "flex",
2575
2607
  flexDirection: "column",
2576
2608
  gap: 6,
@@ -2851,6 +2883,7 @@ exports.TikTokCaptionField = TikTokCaptionField;
2851
2883
  exports.TikTokPostPreview = TikTokPostPreview;
2852
2884
  exports.TikTokPublishPanel = TikTokPublishPanel;
2853
2885
  exports.UploadError = UploadError;
2886
+ exports.XPoll = XPoll;
2854
2887
  exports.XPostPreview = XPostPreview;
2855
2888
  exports.connectionKeys = connectionKeys;
2856
2889
  exports.mediaKeys = mediaKeys;