hive-react-kit 0.6.3 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -279,6 +279,19 @@ import { HiveDetailPost } from 'hive-react-kit';
279
279
  | `onShare` | `() => void` | Called when share is clicked. Falls back to Web Share API / clipboard |
280
280
  | `onTip` | `() => void` | Called when tip is clicked |
281
281
  | `onReport` | `() => void` | Called when report is clicked |
282
+ | `onVotePoll` | `(author: string, permlink: string, choiceNums: number[]) => void \| Promise<void>` | Called when user votes on a poll. `choiceNums` is an array of 1-based choice numbers |
283
+
284
+ **Poll Voting Behaviour**
285
+
286
+ When a post has `json_metadata.content_type === "poll"` the component renders a built-in poll widget:
287
+
288
+ | Scenario | Behaviour |
289
+ |----------|-----------|
290
+ | Single-choice poll (`max_choices_voted === 1`) | Clicking a choice immediately calls `onVotePoll` |
291
+ | Multi-choice poll (`max_choices_voted > 1`) | Checkboxes shown; selection capped at `max_choices_voted`; **Submit Vote** button appears once ≥ 1 option is selected |
292
+ | Poll ended | Choices shown read-only with vote percentages; voting UI hidden |
293
+ | Already voted (current session or via API) | Voted choices highlighted in green; "✓ Voted" shown in footer; voting UI hidden |
294
+ | `onVotePoll` not provided | Poll results rendered read-only regardless of poll status |
282
295
 
283
296
  **Comment Composer Tokens**
284
297
 
package/dist/build.css CHANGED
@@ -550,6 +550,9 @@
550
550
  .ml-2 {
551
551
  margin-left: calc(var(--spacing) * 2);
552
552
  }
553
+ .ml-3 {
554
+ margin-left: calc(var(--spacing) * 3);
555
+ }
553
556
  .ml-4 {
554
557
  margin-left: calc(var(--spacing) * 4);
555
558
  }
@@ -559,6 +562,9 @@
559
562
  .ml-8 {
560
563
  margin-left: calc(var(--spacing) * 8);
561
564
  }
565
+ .ml-9 {
566
+ margin-left: calc(var(--spacing) * 9);
567
+ }
562
568
  .ml-auto {
563
569
  margin-left: auto;
564
570
  }
@@ -853,6 +859,9 @@
853
859
  .max-w-7xl {
854
860
  max-width: var(--container-7xl);
855
861
  }
862
+ .max-w-\[250px\] {
863
+ max-width: 250px;
864
+ }
856
865
  .max-w-\[280px\] {
857
866
  max-width: 280px;
858
867
  }
@@ -1009,6 +1018,9 @@
1009
1018
  .gap-2 {
1010
1019
  gap: calc(var(--spacing) * 2);
1011
1020
  }
1021
+ .gap-2\.5 {
1022
+ gap: calc(var(--spacing) * 2.5);
1023
+ }
1012
1024
  .gap-3 {
1013
1025
  gap: calc(var(--spacing) * 3);
1014
1026
  }
@@ -1120,6 +1132,14 @@
1120
1132
  border-color: var(--color-gray-700);
1121
1133
  }
1122
1134
  }
1135
+ .divide-gray-800\/50 {
1136
+ :where(& > :not(:last-child)) {
1137
+ border-color: color-mix(in srgb, oklch(27.8% 0.033 256.848) 50%, transparent);
1138
+ @supports (color: color-mix(in lab, red, red)) {
1139
+ border-color: color-mix(in oklab, var(--color-gray-800) 50%, transparent);
1140
+ }
1141
+ }
1142
+ }
1123
1143
  .truncate {
1124
1144
  overflow: hidden;
1125
1145
  text-overflow: ellipsis;
@@ -1225,6 +1245,12 @@
1225
1245
  border-color: color-mix(in oklab, var(--color-blue-500) 30%, transparent);
1226
1246
  }
1227
1247
  }
1248
+ .border-blue-500\/60 {
1249
+ border-color: color-mix(in srgb, oklch(62.3% 0.214 259.815) 60%, transparent);
1250
+ @supports (color: color-mix(in lab, red, red)) {
1251
+ border-color: color-mix(in oklab, var(--color-blue-500) 60%, transparent);
1252
+ }
1253
+ }
1228
1254
  .border-blue-600 {
1229
1255
  border-color: var(--color-blue-600);
1230
1256
  }
@@ -1258,6 +1284,18 @@
1258
1284
  .border-gray-800 {
1259
1285
  border-color: var(--color-gray-800);
1260
1286
  }
1287
+ .border-green-600\/60 {
1288
+ border-color: color-mix(in srgb, oklch(62.7% 0.194 149.214) 60%, transparent);
1289
+ @supports (color: color-mix(in lab, red, red)) {
1290
+ border-color: color-mix(in oklab, var(--color-green-600) 60%, transparent);
1291
+ }
1292
+ }
1293
+ .border-green-800\/40 {
1294
+ border-color: color-mix(in srgb, oklch(44.8% 0.119 151.328) 40%, transparent);
1295
+ @supports (color: color-mix(in lab, red, red)) {
1296
+ border-color: color-mix(in oklab, var(--color-green-800) 40%, transparent);
1297
+ }
1298
+ }
1261
1299
  .border-red-200 {
1262
1300
  border-color: var(--color-red-200);
1263
1301
  }
@@ -1444,6 +1482,12 @@
1444
1482
  .bg-gray-700 {
1445
1483
  background-color: var(--color-gray-700);
1446
1484
  }
1485
+ .bg-gray-700\/50 {
1486
+ background-color: color-mix(in srgb, oklch(37.3% 0.034 259.733) 50%, transparent);
1487
+ @supports (color: color-mix(in lab, red, red)) {
1488
+ background-color: color-mix(in oklab, var(--color-gray-700) 50%, transparent);
1489
+ }
1490
+ }
1447
1491
  .bg-gray-700\/60 {
1448
1492
  background-color: color-mix(in srgb, oklch(37.3% 0.034 259.733) 60%, transparent);
1449
1493
  @supports (color: color-mix(in lab, red, red)) {
@@ -1459,6 +1503,12 @@
1459
1503
  background-color: color-mix(in oklab, var(--color-gray-800) 50%, transparent);
1460
1504
  }
1461
1505
  }
1506
+ .bg-gray-800\/60 {
1507
+ background-color: color-mix(in srgb, oklch(27.8% 0.033 256.848) 60%, transparent);
1508
+ @supports (color: color-mix(in lab, red, red)) {
1509
+ background-color: color-mix(in oklab, var(--color-gray-800) 60%, transparent);
1510
+ }
1511
+ }
1462
1512
  .bg-gray-800\/95 {
1463
1513
  background-color: color-mix(in srgb, oklch(27.8% 0.033 256.848) 95%, transparent);
1464
1514
  @supports (color: color-mix(in lab, red, red)) {
@@ -1504,6 +1554,24 @@
1504
1554
  .bg-green-600 {
1505
1555
  background-color: var(--color-green-600);
1506
1556
  }
1557
+ .bg-green-600\/20 {
1558
+ background-color: color-mix(in srgb, oklch(62.7% 0.194 149.214) 20%, transparent);
1559
+ @supports (color: color-mix(in lab, red, red)) {
1560
+ background-color: color-mix(in oklab, var(--color-green-600) 20%, transparent);
1561
+ }
1562
+ }
1563
+ .bg-green-900\/10 {
1564
+ background-color: color-mix(in srgb, oklch(39.3% 0.095 152.535) 10%, transparent);
1565
+ @supports (color: color-mix(in lab, red, red)) {
1566
+ background-color: color-mix(in oklab, var(--color-green-900) 10%, transparent);
1567
+ }
1568
+ }
1569
+ .bg-green-900\/50 {
1570
+ background-color: color-mix(in srgb, oklch(39.3% 0.095 152.535) 50%, transparent);
1571
+ @supports (color: color-mix(in lab, red, red)) {
1572
+ background-color: color-mix(in oklab, var(--color-green-900) 50%, transparent);
1573
+ }
1574
+ }
1507
1575
  .bg-indigo-600 {
1508
1576
  background-color: var(--color-indigo-600);
1509
1577
  }
@@ -2027,6 +2095,9 @@
2027
2095
  .text-gray-900 {
2028
2096
  color: var(--color-gray-900);
2029
2097
  }
2098
+ .text-green-300 {
2099
+ color: var(--color-green-300);
2100
+ }
2030
2101
  .text-green-400 {
2031
2102
  color: var(--color-green-400);
2032
2103
  }
@@ -2036,6 +2107,9 @@
2036
2107
  .text-green-600 {
2037
2108
  color: var(--color-green-600);
2038
2109
  }
2110
+ .text-green-700 {
2111
+ color: var(--color-green-700);
2112
+ }
2039
2113
  .text-green-800 {
2040
2114
  color: var(--color-green-800);
2041
2115
  }
@@ -2143,6 +2217,9 @@
2143
2217
  .opacity-30 {
2144
2218
  opacity: 30%;
2145
2219
  }
2220
+ .opacity-50 {
2221
+ opacity: 50%;
2222
+ }
2146
2223
  .opacity-100 {
2147
2224
  opacity: 100%;
2148
2225
  }
@@ -2464,6 +2541,16 @@
2464
2541
  }
2465
2542
  }
2466
2543
  }
2544
+ .hover\:bg-gray-700\/60 {
2545
+ &:hover {
2546
+ @media (hover: hover) {
2547
+ background-color: color-mix(in srgb, oklch(37.3% 0.034 259.733) 60%, transparent);
2548
+ @supports (color: color-mix(in lab, red, red)) {
2549
+ background-color: color-mix(in oklab, var(--color-gray-700) 60%, transparent);
2550
+ }
2551
+ }
2552
+ }
2553
+ }
2467
2554
  .hover\:bg-gray-800 {
2468
2555
  &:hover {
2469
2556
  @media (hover: hover) {
@@ -2673,6 +2760,13 @@
2673
2760
  }
2674
2761
  }
2675
2762
  }
2763
+ .hover\:opacity-90 {
2764
+ &:hover {
2765
+ @media (hover: hover) {
2766
+ opacity: 90%;
2767
+ }
2768
+ }
2769
+ }
2676
2770
  .hover\:opacity-100 {
2677
2771
  &:hover {
2678
2772
  @media (hover: hover) {
@@ -2775,6 +2869,11 @@
2775
2869
  background-color: var(--color-gray-700);
2776
2870
  }
2777
2871
  }
2872
+ .disabled\:text-gray-500 {
2873
+ &:disabled {
2874
+ color: var(--color-gray-500);
2875
+ }
2876
+ }
2778
2877
  .disabled\:opacity-50 {
2779
2878
  &:disabled {
2780
2879
  opacity: 50%;
@@ -3018,6 +3117,11 @@
3018
3117
  line-height: var(--tw-leading, var(--text-xs--line-height));
3019
3118
  }
3020
3119
  }
3120
+ .md\:ml-6 {
3121
+ @media (width >= 48rem) {
3122
+ margin-left: calc(var(--spacing) * 6);
3123
+ }
3124
+ }
3021
3125
  .md\:ml-7 {
3022
3126
  @media (width >= 48rem) {
3023
3127
  margin-left: calc(var(--spacing) * 7);
@@ -3164,6 +3268,11 @@
3164
3268
  padding: calc(var(--spacing) * 8);
3165
3269
  }
3166
3270
  }
3271
+ .md\:px-3 {
3272
+ @media (width >= 48rem) {
3273
+ padding-inline: calc(var(--spacing) * 3);
3274
+ }
3275
+ }
3167
3276
  .md\:px-6 {
3168
3277
  @media (width >= 48rem) {
3169
3278
  padding-inline: calc(var(--spacing) * 6);
@@ -3174,6 +3283,11 @@
3174
3283
  padding-block: calc(var(--spacing) * 6);
3175
3284
  }
3176
3285
  }
3286
+ .md\:pl-4 {
3287
+ @media (width >= 48rem) {
3288
+ padding-left: calc(var(--spacing) * 4);
3289
+ }
3290
+ }
3177
3291
  .md\:pl-6 {
3178
3292
  @media (width >= 48rem) {
3179
3293
  padding-left: calc(var(--spacing) * 6);
@@ -9,17 +9,33 @@ export interface HiveDetailPostProps {
9
9
  onShare?: () => void;
10
10
  onTip?: () => void;
11
11
  onReport?: () => void;
12
+ /**
13
+ * Called when the user submits a poll vote.
14
+ * @param author - post author
15
+ * @param permlink - post permlink
16
+ * @param choiceNums - 1-based choice numbers selected by the user
17
+ */
18
+ onVotePoll?: (author: string, permlink: string, choiceNums: number[]) => void | Promise<void>;
12
19
  ecencyToken?: string;
13
20
  threeSpeakApiKey?: string;
14
21
  giphyApiKey?: string;
15
22
  templateToken?: string;
16
23
  templateApiBaseUrl?: string;
24
+ /** Array of usernames whose comments should be hidden from the current user's view. */
25
+ reportedAuthors?: string[];
26
+ /** Array of {author, permlink} posts/comments to hide from the current user's view. */
27
+ reportedPosts?: {
28
+ author: string;
29
+ permlink: string;
30
+ }[];
17
31
  /** URL to a Hive logo icon shown next to the payout value. Defaults to "/images/hive_logo.png". */
18
32
  hiveIconUrl?: string;
19
33
  /** Background color for the component. Pass a single color string for a solid background, or an array of colors for a gradient (e.g. `["#0f172a", "#1e293b"]` or `["#1a1a2e", "#16213e", "#0f3460"]`). Defaults to gray-900. */
20
34
  backgroundColor?: string | string[];
21
35
  onBack?: () => void;
22
36
  onUserClick?: (username: string) => void;
37
+ /** Called when user clicks "View parent post" — navigate to the parent post. */
38
+ onNavigateToPost?: (author: string, permlink: string) => void;
23
39
  }
24
- export declare function HiveDetailPost({ author, permlink, currentUser, onUpvote, onSubmitComment, onClickCommentUpvote, onReblog, onShare, onTip, onReport, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, hiveIconUrl, backgroundColor, onBack, onUserClick, }: HiveDetailPostProps): import("react/jsx-runtime").JSX.Element;
40
+ export declare function HiveDetailPost({ author, permlink, currentUser, onUpvote, onSubmitComment, onClickCommentUpvote, onReblog, onShare, onTip, onReport, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, reportedAuthors, reportedPosts, hiveIconUrl, backgroundColor, onBack, onUserClick, onNavigateToPost, onVotePoll, }: HiveDetailPostProps): import("react/jsx-runtime").JSX.Element;
25
41
  export default HiveDetailPost;
@@ -40,6 +40,8 @@ export interface PostActionButtonProps {
40
40
  templateToken?: string;
41
41
  /** Custom template API endpoint */
42
42
  templateApiBaseUrl?: string;
43
+ /** When true, clicking the comment icon calls onComments instead of opening the CommentsModal popup */
44
+ disableCommentsModal?: boolean;
43
45
  }
44
- export declare function PostActionButton({ author, permlink, currentUser: currentUserProp, hiveValue, hiveIconUrl, payoutTooltip, initialVotes, initialCommentsCount, onUpvote, onSubmitComment, onComments, onReblog, onShare, onTip, onReport, onClickCommentUpvote, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, }: PostActionButtonProps): import("react/jsx-runtime").JSX.Element;
46
+ export declare function PostActionButton({ author, permlink, currentUser: currentUserProp, hiveValue, hiveIconUrl, payoutTooltip, initialVotes, initialCommentsCount, onUpvote, onSubmitComment, onComments, onReblog, onShare, onTip, onReport, onClickCommentUpvote, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, disableCommentsModal, }: PostActionButtonProps): import("react/jsx-runtime").JSX.Element;
45
47
  export default PostActionButton;
@@ -60,11 +60,13 @@ export interface PostComposerProps {
60
60
  bgColor?: string;
61
61
  /** Custom border color for the composer container (e.g. "#3a424a", "transparent") */
62
62
  borderColor?: string;
63
+ /** Disable auto-focus on mount (default false). Use when the composer is always visible and shouldn't steal scroll. */
64
+ disableAutoFocus?: boolean;
63
65
  }
64
66
  /** @deprecated Use PostComposerProps instead */
65
67
  export type AddCommentInputProps = PostComposerProps;
66
- declare const PostComposer: ({ onSubmit, onCancel, currentUser, placeholder, parentAuthor, parentPermlink, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, hideBold, hideItalic, hideLink, hideImage, hideAudio, hideVideo, hideEmoji, hideGif, hideCode, hideMention, hideTemplate, hidePreview, hidePoll, onPollChange, showCancel, submitLabel, title, defaultPreviewOn, value, onChange, disabled, hideSubmitArea, submitRef, hideUserHeader, bgColor, borderColor, }: PostComposerProps) => import("react/jsx-runtime").JSX.Element;
68
+ declare const PostComposer: ({ onSubmit, onCancel, currentUser, placeholder, parentAuthor, parentPermlink, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, hideBold, hideItalic, hideLink, hideImage, hideAudio, hideVideo, hideEmoji, hideGif, hideCode, hideMention, hideTemplate, hidePreview, hidePoll, onPollChange, showCancel, submitLabel, title, defaultPreviewOn, value, onChange, disabled, hideSubmitArea, submitRef, hideUserHeader, bgColor, borderColor, disableAutoFocus, }: PostComposerProps) => import("react/jsx-runtime").JSX.Element;
67
69
  /** @deprecated Use PostComposer instead */
68
- declare const AddCommentInput: ({ onSubmit, onCancel, currentUser, placeholder, parentAuthor, parentPermlink, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, hideBold, hideItalic, hideLink, hideImage, hideAudio, hideVideo, hideEmoji, hideGif, hideCode, hideMention, hideTemplate, hidePreview, hidePoll, onPollChange, showCancel, submitLabel, title, defaultPreviewOn, value, onChange, disabled, hideSubmitArea, submitRef, hideUserHeader, bgColor, borderColor, }: PostComposerProps) => import("react/jsx-runtime").JSX.Element;
70
+ declare const AddCommentInput: ({ onSubmit, onCancel, currentUser, placeholder, parentAuthor, parentPermlink, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, hideBold, hideItalic, hideLink, hideImage, hideAudio, hideVideo, hideEmoji, hideGif, hideCode, hideMention, hideTemplate, hidePreview, hidePoll, onPollChange, showCancel, submitLabel, title, defaultPreviewOn, value, onChange, disabled, hideSubmitArea, submitRef, hideUserHeader, bgColor, borderColor, disableAutoFocus, }: PostComposerProps) => import("react/jsx-runtime").JSX.Element;
69
71
  export { PostComposer };
70
72
  export default AddCommentInput;
@@ -0,0 +1,23 @@
1
+ import { Discussion } from '@/types/comment';
2
+ interface InlineCommentItemProps {
3
+ comment: Discussion;
4
+ allComments: Discussion[];
5
+ onReply: (author: string, permlink: string) => void;
6
+ onCancelReply: () => void;
7
+ onCommentSubmit: (parentAuthor: string, parentPermlink: string, body: string) => Promise<void>;
8
+ /** "author/permlink" key of the comment currently being replied to (null = none) */
9
+ activeReplyKey: string | null;
10
+ currentUser?: string;
11
+ token?: string;
12
+ depth?: number;
13
+ onVotedRefresh?: () => void;
14
+ onClickCommentUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
15
+ /** Composer props passed through */
16
+ ecencyToken?: string;
17
+ threeSpeakApiKey?: string;
18
+ giphyApiKey?: string;
19
+ templateToken?: string;
20
+ templateApiBaseUrl?: string;
21
+ }
22
+ export default function InlineCommentItem({ comment, allComments, onReply, onCancelReply, onCommentSubmit, activeReplyKey, currentUser, token, depth, onVotedRefresh, onClickCommentUpvote, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, }: InlineCommentItemProps): import("react/jsx-runtime").JSX.Element;
23
+ export {};
@@ -0,0 +1,22 @@
1
+ interface InlineCommentSectionProps {
2
+ author: string;
3
+ permlink: string;
4
+ currentUser?: string;
5
+ token?: string;
6
+ onSubmitComment?: (parentAuthor: string, parentPermlink: string, body: string) => void | Promise<void>;
7
+ onClickCommentUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
8
+ ecencyToken?: string;
9
+ threeSpeakApiKey?: string;
10
+ giphyApiKey?: string;
11
+ templateToken?: string;
12
+ templateApiBaseUrl?: string;
13
+ /** Usernames whose comments should be hidden for the current logged-in user. */
14
+ reportedAuthors?: string[];
15
+ /** Specific posts/comments to hide for the current logged-in user. */
16
+ reportedPosts?: {
17
+ author: string;
18
+ permlink: string;
19
+ }[];
20
+ }
21
+ export default function InlineCommentSection({ author, permlink, currentUser, token, onSubmitComment, onClickCommentUpvote, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, reportedAuthors, reportedPosts, }: InlineCommentSectionProps): import("react/jsx-runtime").JSX.Element;
22
+ export {};