hive-react-kit 0.9.0 → 0.9.2
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 +3 -2
- package/dist/build.css +31 -0
- package/dist/components/HiveDetailPost.d.ts +20 -1
- package/dist/components/inlineComments/InlineCommentItem.d.ts +8 -1
- package/dist/components/inlineComments/InlineCommentSection.d.ts +8 -1
- package/dist/components/user/PollListItem.d.ts +37 -0
- package/dist/components/user/UserDetailProfile.d.ts +14 -1
- package/dist/components/user/UserGrowth.d.ts +9 -0
- package/dist/index.cjs.js +117 -117
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +9500 -8734
- package/dist/services/userService.d.ts +121 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -158,7 +158,8 @@ import { UserDetailProfile } from 'hive-react-kit';
|
|
|
158
158
|
| `onUserClick` | `(username: string) => void` | Called when a user avatar/name is clicked (followers, following, etc.) |
|
|
159
159
|
| `onPostClick` | `(author: string, permlink: string, title: string) => void` | Called when a blog/post/reward row is clicked |
|
|
160
160
|
| `onSnapClick` | `(author: string, permlink: string) => void` | Called when a snap item is clicked |
|
|
161
|
-
| `onPollClick` | `(author: string, permlink: string, question: string) => void` | Called when a poll
|
|
161
|
+
| `onPollClick` | `(author: string, permlink: string, question: string) => void` | Called when a poll card body is clicked. Choices and the action bar do **not** trigger this — they have their own handlers |
|
|
162
|
+
| `onVotePoll` | `(author, permlink, choiceNums: number[]) => void \| boolean \| Promise<void \| boolean>` | Called when a user submits a vote on a poll **inline from the polls tab**. `choiceNums` is an array of 1-based choice numbers. Return `false` to cancel — per-card vote state will not be updated. When omitted, choices render read-only with vote bars |
|
|
162
163
|
| `onActivityPermlink` | `(author: string, permlink: string) => void` | Called when an activity permlink is clicked |
|
|
163
164
|
| `onActivitySelect` | `(activity: any) => void` | Called when an activity item is selected |
|
|
164
165
|
| `onShare` | `(username: string) => void` | Called when the share button is clicked |
|
|
@@ -172,7 +173,7 @@ The `tabShown` prop accepts an array of these values:
|
|
|
172
173
|
| `"blogs"` | Blogs | User's blog posts (reblogs included) |
|
|
173
174
|
| `"posts"` | Posts | User's original posts |
|
|
174
175
|
| `"snaps"` | Snaps | User's snaps from PeakD |
|
|
175
|
-
| `"polls"` | Polls | User's polls from HiveHub |
|
|
176
|
+
| `"polls"` | Polls | User's polls from HiveHub. Each card renders the choices inline with vote bars and a **Submit Vote** flow when `onVotePoll` is provided |
|
|
176
177
|
| `"comments"` | Comments | User's comments |
|
|
177
178
|
| `"replies"` | Replies | Replies to the user |
|
|
178
179
|
| `"activities"` | Activities | User's activity history |
|
package/dist/build.css
CHANGED
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
--color-emerald-400: oklch(76.5% 0.177 163.223);
|
|
44
44
|
--color-emerald-500: oklch(69.6% 0.17 162.48);
|
|
45
45
|
--color-emerald-900: oklch(37.8% 0.077 168.94);
|
|
46
|
+
--color-sky-300: oklch(82.8% 0.111 230.318);
|
|
46
47
|
--color-sky-400: oklch(74.6% 0.16 232.661);
|
|
47
48
|
--color-sky-500: oklch(68.5% 0.169 237.323);
|
|
48
49
|
--color-blue-100: oklch(93.2% 0.032 255.585);
|
|
@@ -123,6 +124,7 @@
|
|
|
123
124
|
--tracking-widest: 0.1em;
|
|
124
125
|
--leading-tight: 1.25;
|
|
125
126
|
--leading-relaxed: 1.625;
|
|
127
|
+
--radius-sm: 0.25rem;
|
|
126
128
|
--radius-md: 0.375rem;
|
|
127
129
|
--radius-lg: 0.5rem;
|
|
128
130
|
--radius-xl: 0.75rem;
|
|
@@ -335,6 +337,9 @@
|
|
|
335
337
|
.top-0 {
|
|
336
338
|
top: calc(var(--spacing) * 0);
|
|
337
339
|
}
|
|
340
|
+
.top-1 {
|
|
341
|
+
top: calc(var(--spacing) * 1);
|
|
342
|
+
}
|
|
338
343
|
.top-1\/2 {
|
|
339
344
|
top: calc(1 / 2 * 100%);
|
|
340
345
|
}
|
|
@@ -467,6 +472,9 @@
|
|
|
467
472
|
.m-2 {
|
|
468
473
|
margin: calc(var(--spacing) * 2);
|
|
469
474
|
}
|
|
475
|
+
.-mx-2 {
|
|
476
|
+
margin-inline: calc(var(--spacing) * -2);
|
|
477
|
+
}
|
|
470
478
|
.mx-1 {
|
|
471
479
|
margin-inline: calc(var(--spacing) * 1);
|
|
472
480
|
}
|
|
@@ -530,6 +538,9 @@
|
|
|
530
538
|
.mr-4 {
|
|
531
539
|
margin-right: calc(var(--spacing) * 4);
|
|
532
540
|
}
|
|
541
|
+
.mb-0\.5 {
|
|
542
|
+
margin-bottom: calc(var(--spacing) * 0.5);
|
|
543
|
+
}
|
|
533
544
|
.mb-1 {
|
|
534
545
|
margin-bottom: calc(var(--spacing) * 1);
|
|
535
546
|
}
|
|
@@ -705,6 +716,9 @@
|
|
|
705
716
|
.h-52 {
|
|
706
717
|
height: calc(var(--spacing) * 52);
|
|
707
718
|
}
|
|
719
|
+
.h-56 {
|
|
720
|
+
height: calc(var(--spacing) * 56);
|
|
721
|
+
}
|
|
708
722
|
.h-\[56px\] {
|
|
709
723
|
height: 56px;
|
|
710
724
|
}
|
|
@@ -1219,6 +1233,9 @@
|
|
|
1219
1233
|
.rounded-md {
|
|
1220
1234
|
border-radius: var(--radius-md);
|
|
1221
1235
|
}
|
|
1236
|
+
.rounded-sm {
|
|
1237
|
+
border-radius: var(--radius-sm);
|
|
1238
|
+
}
|
|
1222
1239
|
.rounded-xl {
|
|
1223
1240
|
border-radius: var(--radius-xl);
|
|
1224
1241
|
}
|
|
@@ -2279,6 +2296,9 @@
|
|
|
2279
2296
|
.text-rose-400 {
|
|
2280
2297
|
color: var(--color-rose-400);
|
|
2281
2298
|
}
|
|
2299
|
+
.text-sky-300 {
|
|
2300
|
+
color: var(--color-sky-300);
|
|
2301
|
+
}
|
|
2282
2302
|
.text-sky-400 {
|
|
2283
2303
|
color: var(--color-sky-400);
|
|
2284
2304
|
}
|
|
@@ -2560,6 +2580,12 @@
|
|
|
2560
2580
|
border-bottom-left-radius: var(--radius-lg);
|
|
2561
2581
|
}
|
|
2562
2582
|
}
|
|
2583
|
+
.last\:border-0 {
|
|
2584
|
+
&:last-child {
|
|
2585
|
+
border-style: var(--tw-border-style);
|
|
2586
|
+
border-width: 0px;
|
|
2587
|
+
}
|
|
2588
|
+
}
|
|
2563
2589
|
.hover\:-translate-y-1 {
|
|
2564
2590
|
&:hover {
|
|
2565
2591
|
@media (hover: hover) {
|
|
@@ -3136,6 +3162,11 @@
|
|
|
3136
3162
|
height: calc(var(--spacing) * 52);
|
|
3137
3163
|
}
|
|
3138
3164
|
}
|
|
3165
|
+
.sm\:h-56 {
|
|
3166
|
+
@media (width >= 40rem) {
|
|
3167
|
+
height: calc(var(--spacing) * 56);
|
|
3168
|
+
}
|
|
3169
|
+
}
|
|
3139
3170
|
.sm\:h-64 {
|
|
3140
3171
|
@media (width >= 40rem) {
|
|
3141
3172
|
height: calc(var(--spacing) * 64);
|
|
@@ -28,6 +28,25 @@ export interface HiveDetailPostProps {
|
|
|
28
28
|
* Typically wired to a user setting.
|
|
29
29
|
*/
|
|
30
30
|
defaultReward?: import('../utils/commentOptions').RewardOption;
|
|
31
|
+
/**
|
|
32
|
+
* Override the Hive content renderer's link-generating functions so the
|
|
33
|
+
* rendered `<a>` URLs route into your app instead of an external Hive
|
|
34
|
+
* frontend. The in-body click interceptor already recognises peakd /
|
|
35
|
+
* hive.blog / ecency / inleo URLs plus `#/@user` and `/@user` hash/
|
|
36
|
+
* root-relative hrefs, so any of those formats will be routed internally
|
|
37
|
+
* via `onUserClick` / `onNavigateToPost`. Applies to both the post body
|
|
38
|
+
* and inline comment bodies.
|
|
39
|
+
*/
|
|
40
|
+
renderOptions?: {
|
|
41
|
+
/** Replace user-mention URL (e.g. `(u) => '#/@' + u`). */
|
|
42
|
+
userLinkUrlFn?: (username: string) => string;
|
|
43
|
+
/** Replace hashtag URL (e.g. `(t) => '#/tag/' + t`). */
|
|
44
|
+
tagLinkUrlFn?: (tag: string) => string;
|
|
45
|
+
/** Replace the renderer's base URL used when `convertHiveUrls` is on. */
|
|
46
|
+
postBaseUrl?: string;
|
|
47
|
+
/** Replace the IPFS gateway prefix used for ipfs:// embeds. */
|
|
48
|
+
ipfsGateway?: string;
|
|
49
|
+
};
|
|
31
50
|
onClickCommentUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
|
|
32
51
|
onReblog?: () => void;
|
|
33
52
|
onShare?: () => void;
|
|
@@ -69,5 +88,5 @@ export interface HiveDetailPostProps {
|
|
|
69
88
|
/** Called when user clicks "View parent post" — navigate to the parent post. */
|
|
70
89
|
onNavigateToPost?: (author: string, permlink: string) => void;
|
|
71
90
|
}
|
|
72
|
-
export declare function HiveDetailPost({ author, permlink, currentUser, onUpvote, onSubmitComment, onClickCommentUpvote, onReblog, onShare, onTip, onReport, onShareComment, onTipComment, onReportComment, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, reportedAuthors, reportedPosts, hiveIconUrl, backgroundColor, onBack, onUserClick, onNavigateToPost, onVotePoll, showVoteButton, processBody, defaultReward, }: HiveDetailPostProps): import("react/jsx-runtime").JSX.Element;
|
|
91
|
+
export declare function HiveDetailPost({ author, permlink, currentUser, onUpvote, onSubmitComment, onClickCommentUpvote, onReblog, onShare, onTip, onReport, onShareComment, onTipComment, onReportComment, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, reportedAuthors, reportedPosts, hiveIconUrl, backgroundColor, onBack, onUserClick, onNavigateToPost, onVotePoll, showVoteButton, processBody, defaultReward, renderOptions, }: HiveDetailPostProps): import("react/jsx-runtime").JSX.Element;
|
|
73
92
|
export default HiveDetailPost;
|
|
@@ -29,6 +29,13 @@ interface InlineCommentItemProps {
|
|
|
29
29
|
onUserClick?: (username: string) => void;
|
|
30
30
|
/** Default reward routing seeded into every reply composer. */
|
|
31
31
|
defaultReward?: RewardOption;
|
|
32
|
+
/** Renderer URL overrides applied to the comment body. */
|
|
33
|
+
renderOptions?: {
|
|
34
|
+
userLinkUrlFn?: (username: string) => string;
|
|
35
|
+
tagLinkUrlFn?: (tag: string) => string;
|
|
36
|
+
postBaseUrl?: string;
|
|
37
|
+
ipfsGateway?: string;
|
|
38
|
+
};
|
|
32
39
|
}
|
|
33
|
-
export default function InlineCommentItem({ comment, allComments, onReply, onCancelReply, onCommentSubmit, activeReplyKey, currentUser, token, depth, onVotedRefresh, onClickCommentUpvote, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, hiveIconUrl, onShareComment, onTipComment, onReportComment, onNavigateToPost, onUserClick, defaultReward, }: InlineCommentItemProps): import("react/jsx-runtime").JSX.Element;
|
|
40
|
+
export default function InlineCommentItem({ comment, allComments, onReply, onCancelReply, onCommentSubmit, activeReplyKey, currentUser, token, depth, onVotedRefresh, onClickCommentUpvote, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, hiveIconUrl, onShareComment, onTipComment, onReportComment, onNavigateToPost, onUserClick, defaultReward, renderOptions, }: InlineCommentItemProps): import("react/jsx-runtime").JSX.Element;
|
|
34
41
|
export {};
|
|
@@ -15,6 +15,13 @@ interface InlineCommentSectionProps {
|
|
|
15
15
|
parentTags?: string[];
|
|
16
16
|
/** Default reward routing seeded into every reply composer in this section. */
|
|
17
17
|
defaultReward?: RewardOption;
|
|
18
|
+
/** Renderer URL overrides applied to every comment body in this section. */
|
|
19
|
+
renderOptions?: {
|
|
20
|
+
userLinkUrlFn?: (username: string) => string;
|
|
21
|
+
tagLinkUrlFn?: (tag: string) => string;
|
|
22
|
+
postBaseUrl?: string;
|
|
23
|
+
ipfsGateway?: string;
|
|
24
|
+
};
|
|
18
25
|
ecencyToken?: string;
|
|
19
26
|
threeSpeakApiKey?: string;
|
|
20
27
|
giphyApiKey?: string;
|
|
@@ -36,5 +43,5 @@ interface InlineCommentSectionProps {
|
|
|
36
43
|
/** Intercept intra-body Hive profile links in comment bodies. */
|
|
37
44
|
onUserClick?: (username: string) => void;
|
|
38
45
|
}
|
|
39
|
-
export default function InlineCommentSection({ author, permlink, currentUser, token, onSubmitComment, onClickCommentUpvote, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, reportedAuthors, reportedPosts, hiveIconUrl, onShareComment, onTipComment, onReportComment, onNavigateToPost, onUserClick, showVoteButton, alreadyVoted, parentTags, defaultReward, }: InlineCommentSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
export default function InlineCommentSection({ author, permlink, currentUser, token, onSubmitComment, onClickCommentUpvote, ecencyToken, threeSpeakApiKey, giphyApiKey, templateToken, templateApiBaseUrl, reportedAuthors, reportedPosts, hiveIconUrl, onShareComment, onTipComment, onReportComment, onNavigateToPost, onUserClick, showVoteButton, alreadyVoted, parentTags, defaultReward, renderOptions, }: InlineCommentSectionProps): import("react/jsx-runtime").JSX.Element;
|
|
40
47
|
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Poll } from "@/types/poll";
|
|
3
|
+
export interface PollListItemProps {
|
|
4
|
+
poll: Poll;
|
|
5
|
+
currentUsername?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Called when the user submits a poll vote from the inline voting UI.
|
|
8
|
+
* `choiceNums` is an array of 1-based choice numbers selected.
|
|
9
|
+
*
|
|
10
|
+
* Return `false` (or a Promise resolving to `false`) to indicate the
|
|
11
|
+
* operation was cancelled (e.g. keychain request denied) — the local
|
|
12
|
+
* vote state will NOT be updated.
|
|
13
|
+
*/
|
|
14
|
+
onVotePoll?: (author: string, permlink: string, choiceNums: number[]) => void | boolean | Promise<void | boolean>;
|
|
15
|
+
/** Card click — opens poll detail (clicks on choices/buttons don't bubble here) */
|
|
16
|
+
onPollClick?: (author: string, permlink: string, question: string) => void;
|
|
17
|
+
onUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
|
|
18
|
+
onSubmitComment?: (parentAuthor: string, parentPermlink: string, body: string) => void | Promise<void>;
|
|
19
|
+
onClickCommentUpvote?: (author: string, permlink: string, percent: number) => void | Promise<void>;
|
|
20
|
+
onReblog?: (author: string, permlink: string) => void;
|
|
21
|
+
onTip?: (author: string, permlink: string) => void;
|
|
22
|
+
onSharePost?: (author: string, permlink: string) => void;
|
|
23
|
+
onCommentClick?: (author: string, permlink: string) => void;
|
|
24
|
+
/**
|
|
25
|
+
* Called when the user clicks the report button on the action bar.
|
|
26
|
+
* The parent owns the report modal — this is purely a request to open it.
|
|
27
|
+
*/
|
|
28
|
+
onRequestReportPost?: (author: string, permlink: string) => void;
|
|
29
|
+
onUserClick?: (username: string) => void;
|
|
30
|
+
ecencyToken?: string;
|
|
31
|
+
threeSpeakApiKey?: string;
|
|
32
|
+
giphyApiKey?: string;
|
|
33
|
+
templateToken?: string;
|
|
34
|
+
templateApiBaseUrl?: string;
|
|
35
|
+
}
|
|
36
|
+
declare const PollListItem: React.FC<PollListItemProps>;
|
|
37
|
+
export default PollListItem;
|
|
@@ -39,6 +39,19 @@ export interface UserDetailProfileProps {
|
|
|
39
39
|
onReblog?: (author: string, permlink: string) => void;
|
|
40
40
|
onTip?: (author: string, permlink: string) => void;
|
|
41
41
|
onReportPost?: (author: string, permlink: string, reason: string) => void | Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Called when the user submits a poll vote from the inline voting UI on the
|
|
44
|
+
* polls tab. `choiceNums` is an array of 1-based choice numbers selected
|
|
45
|
+
* (one entry for single-choice polls, one or more for multi-choice).
|
|
46
|
+
*
|
|
47
|
+
* Return `false` (or a Promise resolving to `false`) to indicate the
|
|
48
|
+
* operation was cancelled (e.g. keychain request denied) — the per-card
|
|
49
|
+
* vote state will not be updated.
|
|
50
|
+
*
|
|
51
|
+
* When this callback is omitted, the polls tab still renders choices with
|
|
52
|
+
* vote bars but is read-only.
|
|
53
|
+
*/
|
|
54
|
+
onVotePoll?: (author: string, permlink: string, choiceNums: number[]) => void | boolean | Promise<void | boolean>;
|
|
42
55
|
onUserClick?: (username: string) => void;
|
|
43
56
|
onPostClick?: (author: string, permlink: string, title: string) => void;
|
|
44
57
|
onSnapClick?: (author: string, permlink: string) => void;
|
|
@@ -54,6 +67,6 @@ export interface UserDetailProfileProps {
|
|
|
54
67
|
isFavourited?: boolean;
|
|
55
68
|
favouriteCount?: number;
|
|
56
69
|
}
|
|
57
|
-
type TabType = "blogs" | "posts" | "snaps" | "polls" | "comments" | "replies" | "activities" | "authorRewards" | "curationRewards" | "followers" | "following" | "wallet" | "votingPower" | "badges" | "witnessVotes";
|
|
70
|
+
type TabType = "blogs" | "posts" | "snaps" | "polls" | "comments" | "replies" | "activities" | "authorRewards" | "curationRewards" | "followers" | "following" | "wallet" | "votingPower" | "badges" | "witnessVotes" | "growth";
|
|
58
71
|
declare const UserDetailProfile: React.FC<UserDetailProfileProps>;
|
|
59
72
|
export default UserDetailProfile;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface UserGrowthProps {
|
|
3
|
+
username: string;
|
|
4
|
+
/** Default range when the tab opens. Can still be toggled by the user. */
|
|
5
|
+
defaultRange?: 7 | 30;
|
|
6
|
+
className?: string;
|
|
7
|
+
}
|
|
8
|
+
declare const UserGrowth: React.FC<UserGrowthProps>;
|
|
9
|
+
export default UserGrowth;
|