@select-org/post-components 0.2.1 → 1.0.1
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/chunk-JPYOLIZH.js +439 -0
- package/dist/chunk-JPYOLIZH.js.map +1 -0
- package/dist/index.d.ts +321 -0
- package/dist/index.js +2932 -0
- package/dist/index.js.map +1 -0
- package/dist/resolver.d.ts +93 -0
- package/dist/resolver.js +9 -0
- package/dist/resolver.js.map +1 -0
- package/dist/types.d.ts +269 -0
- package/dist/types.js +1 -0
- package/dist/types.js.map +1 -0
- package/package.json +5 -6
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { TipTapDocument, ItemData, LinkItemMetaData, PollItemData, MentionData, SectionItem, PollResult, MediaUploadStatus } from './types.js';
|
|
3
|
+
export { FormatMentionData, ImageInfo, PostAuthor, PostDataMetaData } from './types.js';
|
|
4
|
+
import { ResolvedTextContent, PrimaryContent, EmbedContent, TextItemContent, SectionItem as SectionItem$1 } from './resolver.js';
|
|
5
|
+
export { LinkContent, MediaContent, PollContent, ResolvePostContentMode, ResolvedPostContent, SectionsContent, hasMeaningfulHtml, resolvePostContent } from './resolver.js';
|
|
6
|
+
|
|
7
|
+
interface PostCardProps {
|
|
8
|
+
post: {
|
|
9
|
+
context_id: string;
|
|
10
|
+
body?: string;
|
|
11
|
+
htmlBody?: string;
|
|
12
|
+
jsonBody?: TipTapDocument | null;
|
|
13
|
+
textBody?: string;
|
|
14
|
+
items?: ItemData[] | LinkItemMetaData[] | PollItemData[];
|
|
15
|
+
mentionData?: MentionData[];
|
|
16
|
+
sections?: SectionItem[];
|
|
17
|
+
poll_result?: PollResult;
|
|
18
|
+
postedAt: string;
|
|
19
|
+
postType: string;
|
|
20
|
+
is_pending?: boolean;
|
|
21
|
+
isFeatured?: boolean;
|
|
22
|
+
};
|
|
23
|
+
author: {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
avatar: string;
|
|
27
|
+
avatarPlaceholder?: string;
|
|
28
|
+
};
|
|
29
|
+
authorHref: string;
|
|
30
|
+
group?: {
|
|
31
|
+
name: string;
|
|
32
|
+
avatar?: string;
|
|
33
|
+
};
|
|
34
|
+
groupHref?: string;
|
|
35
|
+
postHref?: string;
|
|
36
|
+
linkComponent?: React.ComponentType<{
|
|
37
|
+
href: string;
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
}>;
|
|
41
|
+
imageComponent?: React.ComponentType<{
|
|
42
|
+
src: string;
|
|
43
|
+
alt: string;
|
|
44
|
+
fill?: boolean;
|
|
45
|
+
placeholder?: 'blur' | 'empty';
|
|
46
|
+
blurDataURL?: string;
|
|
47
|
+
priority?: boolean;
|
|
48
|
+
className?: string;
|
|
49
|
+
}>;
|
|
50
|
+
isAdmin?: boolean;
|
|
51
|
+
isOwner?: boolean;
|
|
52
|
+
isPostPreview?: boolean;
|
|
53
|
+
onPostPress?: () => void;
|
|
54
|
+
onErasePress?: () => void;
|
|
55
|
+
onCancelPost?: () => void;
|
|
56
|
+
onVotePress?: (item: ItemData) => void;
|
|
57
|
+
onCardPress?: () => void;
|
|
58
|
+
renderActionsMenu?: () => React.ReactNode;
|
|
59
|
+
renderReactionTrigger?: (props: {
|
|
60
|
+
onOpen: () => void;
|
|
61
|
+
}) => React.ReactNode;
|
|
62
|
+
renderReactionModal?: (props: {
|
|
63
|
+
isOpen: boolean;
|
|
64
|
+
onClose: () => void;
|
|
65
|
+
onSend: (emoji: string) => void;
|
|
66
|
+
}) => React.ReactNode;
|
|
67
|
+
onNavigate?: (href: string, isInternal: boolean) => void;
|
|
68
|
+
supportDeepviewDomain?: string;
|
|
69
|
+
labels?: {
|
|
70
|
+
cancelPost?: string;
|
|
71
|
+
sending?: string;
|
|
72
|
+
uploadingRemaining?: string;
|
|
73
|
+
uploadingDone?: string;
|
|
74
|
+
};
|
|
75
|
+
mode?: 'feed' | 'detail' | 'inbox' | 'draft';
|
|
76
|
+
commentCount?: number;
|
|
77
|
+
unreadCommentCount?: number;
|
|
78
|
+
isSnoozed?: boolean;
|
|
79
|
+
onSnoozeToggle?: () => void;
|
|
80
|
+
mediaItemStatuses?: Record<string, MediaUploadStatus>;
|
|
81
|
+
showFooterLink?: boolean;
|
|
82
|
+
footerLinkLabel?: string;
|
|
83
|
+
footerLinkHref?: string;
|
|
84
|
+
className?: string;
|
|
85
|
+
}
|
|
86
|
+
declare const PostCard: React.FC<PostCardProps>;
|
|
87
|
+
|
|
88
|
+
interface PostHeaderProps {
|
|
89
|
+
author: {
|
|
90
|
+
id: string;
|
|
91
|
+
name: string;
|
|
92
|
+
avatar: string;
|
|
93
|
+
avatarPlaceholder?: string;
|
|
94
|
+
};
|
|
95
|
+
authorHref: string;
|
|
96
|
+
group?: {
|
|
97
|
+
name: string;
|
|
98
|
+
avatar?: string;
|
|
99
|
+
};
|
|
100
|
+
groupHref?: string;
|
|
101
|
+
postedAt: string;
|
|
102
|
+
postType: string;
|
|
103
|
+
isFeatured?: boolean;
|
|
104
|
+
isPostPreview?: boolean;
|
|
105
|
+
isAdmin?: boolean;
|
|
106
|
+
isOwner?: boolean;
|
|
107
|
+
onErasePress?: () => void;
|
|
108
|
+
onCancelPost?: () => void;
|
|
109
|
+
renderActionsMenu?: () => React.ReactNode;
|
|
110
|
+
linkComponent?: React.ComponentType<{
|
|
111
|
+
href: string;
|
|
112
|
+
children: React.ReactNode;
|
|
113
|
+
className?: string;
|
|
114
|
+
}>;
|
|
115
|
+
imageComponent?: React.ComponentType<{
|
|
116
|
+
src: string;
|
|
117
|
+
alt: string;
|
|
118
|
+
fill?: boolean;
|
|
119
|
+
placeholder?: 'blur' | 'empty';
|
|
120
|
+
blurDataURL?: string;
|
|
121
|
+
priority?: boolean;
|
|
122
|
+
className?: string;
|
|
123
|
+
}>;
|
|
124
|
+
labels?: {
|
|
125
|
+
cancelPost?: string;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
declare const PostHeader: React.FC<PostHeaderProps>;
|
|
129
|
+
|
|
130
|
+
interface Props$a {
|
|
131
|
+
textContent: ResolvedTextContent;
|
|
132
|
+
showFull?: boolean;
|
|
133
|
+
isPostDetail: boolean;
|
|
134
|
+
isRichContent?: boolean;
|
|
135
|
+
hideEmailDescription?: boolean;
|
|
136
|
+
isEmailPost?: boolean;
|
|
137
|
+
onNavigate?: (href: string, isInternal: boolean) => void;
|
|
138
|
+
supportDeepviewDomain?: string;
|
|
139
|
+
}
|
|
140
|
+
declare const PostBody: React.FC<Props$a>;
|
|
141
|
+
|
|
142
|
+
interface PostFooterProps {
|
|
143
|
+
postHref?: string;
|
|
144
|
+
commentCount?: number;
|
|
145
|
+
unreadCommentCount?: number;
|
|
146
|
+
showFooterLink?: boolean;
|
|
147
|
+
footerLinkLabel?: string;
|
|
148
|
+
footerLinkHref?: string;
|
|
149
|
+
isSnoozed?: boolean;
|
|
150
|
+
onSnoozeToggle?: () => void;
|
|
151
|
+
renderReactionTrigger?: (props: {
|
|
152
|
+
onOpen: () => void;
|
|
153
|
+
}) => React.ReactNode;
|
|
154
|
+
renderReactionModal?: (props: {
|
|
155
|
+
isOpen: boolean;
|
|
156
|
+
onClose: () => void;
|
|
157
|
+
onSend: (emoji: string) => void;
|
|
158
|
+
}) => React.ReactNode;
|
|
159
|
+
}
|
|
160
|
+
declare const PostFooter: React.FC<PostFooterProps>;
|
|
161
|
+
|
|
162
|
+
interface Props$9 {
|
|
163
|
+
primaryContent: PrimaryContent;
|
|
164
|
+
isPostDetail: boolean;
|
|
165
|
+
onCardPress: () => void;
|
|
166
|
+
onVotePress: (item: PollItemData) => void;
|
|
167
|
+
isPostOwner?: boolean;
|
|
168
|
+
parentId?: string;
|
|
169
|
+
isCommentScope?: boolean;
|
|
170
|
+
imageComponent?: React.ComponentType<{
|
|
171
|
+
src: string;
|
|
172
|
+
alt: string;
|
|
173
|
+
className?: string;
|
|
174
|
+
}>;
|
|
175
|
+
mediaItemStatuses?: Record<string, MediaUploadStatus>;
|
|
176
|
+
}
|
|
177
|
+
declare const PostItemsView: React.FC<Props$9>;
|
|
178
|
+
|
|
179
|
+
interface Props$8 {
|
|
180
|
+
embed: EmbedContent;
|
|
181
|
+
}
|
|
182
|
+
declare const PostEmbedView: React.FC<Props$8>;
|
|
183
|
+
|
|
184
|
+
declare const PostEmail: React.FC<{
|
|
185
|
+
html: string;
|
|
186
|
+
}>;
|
|
187
|
+
|
|
188
|
+
interface Props$7 {
|
|
189
|
+
items: PollItemData[];
|
|
190
|
+
voteResult: PollResult | null;
|
|
191
|
+
onVotePress: (item: PollItemData) => void;
|
|
192
|
+
onCardPress: () => void;
|
|
193
|
+
isPostDetail: boolean;
|
|
194
|
+
isInboxCard?: boolean;
|
|
195
|
+
isPostOwner?: boolean;
|
|
196
|
+
}
|
|
197
|
+
declare const PostPollView: React.FC<Props$7>;
|
|
198
|
+
|
|
199
|
+
interface Props$6 {
|
|
200
|
+
textItems: TextItemContent['items'];
|
|
201
|
+
showFullText: boolean;
|
|
202
|
+
isPostDetail: boolean;
|
|
203
|
+
}
|
|
204
|
+
declare const PostTextItem: React.FC<Props$6>;
|
|
205
|
+
|
|
206
|
+
interface Props$5 {
|
|
207
|
+
sections: SectionItem$1[];
|
|
208
|
+
isPostDetail: boolean;
|
|
209
|
+
onCardPress: () => void;
|
|
210
|
+
}
|
|
211
|
+
declare const PostSectionsView: React.FC<Props$5>;
|
|
212
|
+
|
|
213
|
+
interface Props$4 {
|
|
214
|
+
sourceInfo?: {
|
|
215
|
+
avatar: string;
|
|
216
|
+
username: string;
|
|
217
|
+
url: string;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
declare const PostSectionSourceInfoView: React.FC<Props$4>;
|
|
221
|
+
|
|
222
|
+
interface Props$3 {
|
|
223
|
+
fontColor?: string;
|
|
224
|
+
sections: SectionItem$1[];
|
|
225
|
+
onCardPress?: () => void;
|
|
226
|
+
}
|
|
227
|
+
declare const PostSectionsSummaryView: React.FC<Props$3>;
|
|
228
|
+
|
|
229
|
+
interface PostLinkItemProps {
|
|
230
|
+
linkItems: LinkItemMetaData[];
|
|
231
|
+
imageComponent?: React.ComponentType<{
|
|
232
|
+
src: string;
|
|
233
|
+
alt: string;
|
|
234
|
+
className?: string;
|
|
235
|
+
}>;
|
|
236
|
+
onCloseClick?: () => void;
|
|
237
|
+
type?: 'preview' | 'display';
|
|
238
|
+
supportDeepviewDomain?: string;
|
|
239
|
+
}
|
|
240
|
+
declare const PostLinkItem: React.FC<PostLinkItemProps>;
|
|
241
|
+
|
|
242
|
+
interface PostMediaLayoutProps {
|
|
243
|
+
items: ItemData[];
|
|
244
|
+
parentId?: string;
|
|
245
|
+
isPostDetail?: boolean;
|
|
246
|
+
onCardPress?: () => void;
|
|
247
|
+
mediaItemStatuses?: Record<string, MediaUploadStatus>;
|
|
248
|
+
}
|
|
249
|
+
declare const PostMediaLayoutCore: React.FC<PostMediaLayoutProps>;
|
|
250
|
+
|
|
251
|
+
interface Props$2 {
|
|
252
|
+
status?: MediaUploadStatus;
|
|
253
|
+
/** Tile width in px. Status text is hidden when < 100. */
|
|
254
|
+
tileWidth?: number;
|
|
255
|
+
}
|
|
256
|
+
declare const MediaUploadStatusOverlay: React.FC<Props$2>;
|
|
257
|
+
|
|
258
|
+
interface Props$1 {
|
|
259
|
+
statuses?: Record<string, MediaUploadStatus>;
|
|
260
|
+
labels?: {
|
|
261
|
+
/** Template with `{count}` replaced by the remaining in-flight number. */
|
|
262
|
+
uploadingRemaining?: string;
|
|
263
|
+
/** Shown when nothing is in flight but failures remain. */
|
|
264
|
+
uploadingDone?: string;
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
declare const PostUploadStrip: React.FC<Props$1>;
|
|
268
|
+
|
|
269
|
+
/*!
|
|
270
|
+
* React Native Autolink
|
|
271
|
+
*
|
|
272
|
+
* Copyright 2016-2018 Josh Swan
|
|
273
|
+
* Released under the MIT license
|
|
274
|
+
* https://github.com/joshswan/react-native-autolink/blob/master/LICENSE
|
|
275
|
+
*
|
|
276
|
+
* Simplified and improved by Dean, to support mention list.
|
|
277
|
+
* Ported to design-system post-components: routing and config dependencies removed.
|
|
278
|
+
*/
|
|
279
|
+
|
|
280
|
+
type TruncateOptions = {
|
|
281
|
+
truncate?: number;
|
|
282
|
+
truncateChars?: string;
|
|
283
|
+
truncateLocation?: 'smart' | 'end' | 'middle';
|
|
284
|
+
};
|
|
285
|
+
interface AutoLinkProps {
|
|
286
|
+
text: string;
|
|
287
|
+
mentionData?: MentionData[];
|
|
288
|
+
onNavigate?: (href: string, isInternal: boolean) => void;
|
|
289
|
+
supportDeepviewDomain?: string;
|
|
290
|
+
phone?: any;
|
|
291
|
+
email?: any;
|
|
292
|
+
stripPrefix?: boolean;
|
|
293
|
+
style?: React.CSSProperties;
|
|
294
|
+
mentionClassName?: string;
|
|
295
|
+
className?: string;
|
|
296
|
+
}
|
|
297
|
+
declare const AutoLink: {
|
|
298
|
+
({ text: textProp, mentionData, onNavigate, supportDeepviewDomain, phone, email, stripPrefix, style, mentionClassName: mentionClassNameProp, className, }: AutoLinkProps): React.JSX.Element | null;
|
|
299
|
+
truncate: (text: string, { truncate: len, truncateChars, truncateLocation }?: TruncateOptions) => string;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
interface ReactionModalProps {
|
|
303
|
+
isOpen: boolean;
|
|
304
|
+
close: () => void;
|
|
305
|
+
sendReaction: (emoji: string) => void;
|
|
306
|
+
onAnalyticsEvent?: (event: string, data?: Record<string, unknown>) => void;
|
|
307
|
+
}
|
|
308
|
+
declare const ReactionModal: ({ isOpen, close, sendReaction, onAnalyticsEvent }: ReactionModalProps) => React.JSX.Element | null;
|
|
309
|
+
|
|
310
|
+
interface Props {
|
|
311
|
+
backgroundColor?: string;
|
|
312
|
+
onYesPress: (e?: React.MouseEvent) => void;
|
|
313
|
+
onNoPress: (e?: React.MouseEvent) => void;
|
|
314
|
+
fontColor?: string;
|
|
315
|
+
itemType?: string;
|
|
316
|
+
isOpen: boolean;
|
|
317
|
+
handleClose: () => void;
|
|
318
|
+
}
|
|
319
|
+
declare const EraseConfirmModal: React.FC<Props>;
|
|
320
|
+
|
|
321
|
+
export { AutoLink, EmbedContent, EraseConfirmModal, ItemData, LinkItemMetaData, MediaUploadStatus, MediaUploadStatusOverlay, MentionData, PollItemData, PollResult, PostBody, PostCard, type PostCardProps, PostEmail, PostEmbedView, PostFooter, PostHeader, type PostHeaderProps, PostItemsView, PostLinkItem, PostMediaLayoutCore, PostPollView, PostSectionSourceInfoView, PostSectionsSummaryView, PostSectionsView, PostTextItem, PostUploadStrip, PrimaryContent, ReactionModal, ResolvedTextContent, SectionItem, TextItemContent, TipTapDocument };
|