@select-org/post-components 1.0.1 → 2.1.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.d.ts CHANGED
@@ -47,9 +47,28 @@ interface PostCardProps {
47
47
  priority?: boolean;
48
48
  className?: string;
49
49
  }>;
50
+ /** Author's role in the group — drives the owner crown / admin shield badge. */
50
51
  isAdmin?: boolean;
52
+ /** Author's role in the group — drives the owner crown / admin shield badge. */
51
53
  isOwner?: boolean;
54
+ /**
55
+ * Whether the *viewer* is the post's author. Lets the author preview their own
56
+ * poll results before voting. Distinct from `isOwner` (which is the author's
57
+ * group role, for the badge) — pass it explicitly. When omitted, the author
58
+ * preview is simply off (the author sees results after voting, like anyone).
59
+ */
60
+ isPostOwner?: boolean;
52
61
  isPostPreview?: boolean;
62
+ isPrivate?: boolean;
63
+ membersCount?: number;
64
+ crossPostGroup?: {
65
+ name: string;
66
+ href?: string;
67
+ };
68
+ locale?: string;
69
+ translate?: (key: string, params?: {
70
+ count?: number;
71
+ }) => string;
53
72
  onPostPress?: () => void;
54
73
  onErasePress?: () => void;
55
74
  onCancelPost?: () => void;
@@ -65,7 +84,7 @@ interface PostCardProps {
65
84
  onSend: (emoji: string) => void;
66
85
  }) => React.ReactNode;
67
86
  onNavigate?: (href: string, isInternal: boolean) => void;
68
- supportDeepviewDomain?: string;
87
+ supportDeepviewDomain?: string | string[];
69
88
  labels?: {
70
89
  cancelPost?: string;
71
90
  sending?: string;
@@ -100,8 +119,19 @@ interface PostHeaderProps {
100
119
  groupHref?: string;
101
120
  postedAt: string;
102
121
  postType: string;
122
+ isPrivate?: boolean;
123
+ membersCount?: number;
124
+ crossPostGroup?: {
125
+ name: string;
126
+ href?: string;
127
+ };
128
+ locale?: string;
129
+ translate?: (key: string, params?: {
130
+ count?: number;
131
+ }) => string;
103
132
  isFeatured?: boolean;
104
133
  isPostPreview?: boolean;
134
+ isPostDetail?: boolean;
105
135
  isAdmin?: boolean;
106
136
  isOwner?: boolean;
107
137
  onErasePress?: () => void;
@@ -135,7 +165,7 @@ interface Props$a {
135
165
  hideEmailDescription?: boolean;
136
166
  isEmailPost?: boolean;
137
167
  onNavigate?: (href: string, isInternal: boolean) => void;
138
- supportDeepviewDomain?: string;
168
+ supportDeepviewDomain?: string | string[];
139
169
  }
140
170
  declare const PostBody: React.FC<Props$a>;
141
171
 
@@ -148,6 +178,17 @@ interface PostFooterProps {
148
178
  footerLinkHref?: string;
149
179
  isSnoozed?: boolean;
150
180
  onSnoozeToggle?: () => void;
181
+ /**
182
+ * Custom link renderer (e.g. Next.js `<Link>`) for the comment and footer
183
+ * links. Falls back to a native `<a>`. Passing this is important inside SPAs:
184
+ * a native `<a>` triggers a full-page reload, whereas the consumer's router
185
+ * link performs a soft client-side navigation.
186
+ */
187
+ linkComponent?: React.ComponentType<{
188
+ href: string;
189
+ children: React.ReactNode;
190
+ className?: string;
191
+ }>;
151
192
  renderReactionTrigger?: (props: {
152
193
  onOpen: () => void;
153
194
  }) => React.ReactNode;
@@ -173,6 +214,8 @@ interface Props$9 {
173
214
  className?: string;
174
215
  }>;
175
216
  mediaItemStatuses?: Record<string, MediaUploadStatus>;
217
+ onNavigate?: (href: string, isInternal: boolean) => void;
218
+ supportDeepviewDomain?: string | string[];
176
219
  }
177
220
  declare const PostItemsView: React.FC<Props$9>;
178
221
 
@@ -200,6 +243,8 @@ interface Props$6 {
200
243
  textItems: TextItemContent['items'];
201
244
  showFullText: boolean;
202
245
  isPostDetail: boolean;
246
+ onNavigate?: (href: string, isInternal: boolean) => void;
247
+ supportDeepviewDomain?: string | string[];
203
248
  }
204
249
  declare const PostTextItem: React.FC<Props$6>;
205
250
 
@@ -207,6 +252,17 @@ interface Props$5 {
207
252
  sections: SectionItem$1[];
208
253
  isPostDetail: boolean;
209
254
  onCardPress: () => void;
255
+ onNavigate?: (href: string, isInternal: boolean) => void;
256
+ supportDeepviewDomain?: string | string[];
257
+ imageComponent?: React.ComponentType<{
258
+ src: string;
259
+ alt: string;
260
+ fill?: boolean;
261
+ placeholder?: 'blur' | 'empty';
262
+ blurDataURL?: string;
263
+ priority?: boolean;
264
+ className?: string;
265
+ }>;
210
266
  }
211
267
  declare const PostSectionsView: React.FC<Props$5>;
212
268
 
@@ -216,6 +272,15 @@ interface Props$4 {
216
272
  username: string;
217
273
  url: string;
218
274
  };
275
+ imageComponent?: React.ComponentType<{
276
+ src: string;
277
+ alt: string;
278
+ fill?: boolean;
279
+ placeholder?: 'blur' | 'empty';
280
+ blurDataURL?: string;
281
+ priority?: boolean;
282
+ className?: string;
283
+ }>;
219
284
  }
220
285
  declare const PostSectionSourceInfoView: React.FC<Props$4>;
221
286
 
@@ -235,7 +300,7 @@ interface PostLinkItemProps {
235
300
  }>;
236
301
  onCloseClick?: () => void;
237
302
  type?: 'preview' | 'display';
238
- supportDeepviewDomain?: string;
303
+ supportDeepviewDomain?: string | string[];
239
304
  }
240
305
  declare const PostLinkItem: React.FC<PostLinkItemProps>;
241
306
 
@@ -286,7 +351,7 @@ interface AutoLinkProps {
286
351
  text: string;
287
352
  mentionData?: MentionData[];
288
353
  onNavigate?: (href: string, isInternal: boolean) => void;
289
- supportDeepviewDomain?: string;
354
+ supportDeepviewDomain?: string | string[];
290
355
  phone?: any;
291
356
  email?: any;
292
357
  stripPrefix?: boolean;
@@ -299,6 +364,25 @@ declare const AutoLink: {
299
364
  truncate: (text: string, { truncate: len, truncateChars, truncateLocation }?: TruncateOptions) => string;
300
365
  };
301
366
 
367
+ interface PostTypeHintContext {
368
+ isInGroup?: boolean;
369
+ isOwner?: boolean;
370
+ isPrivate?: boolean;
371
+ membersCount?: number;
372
+ /** Mirrors the web client's `isMetaDesc` branch (SEO/meta-description copy). */
373
+ isMetaDesc?: boolean;
374
+ }
375
+ interface PostTypeHint {
376
+ key: string;
377
+ params?: {
378
+ count?: number;
379
+ };
380
+ }
381
+ declare function getPostTypeHint(postType: string, ctx?: PostTypeHintContext): PostTypeHint;
382
+ declare const POST_TYPE_HINT_DEFAULTS: Record<string, (p?: {
383
+ count?: number;
384
+ }) => string>;
385
+
302
386
  interface ReactionModalProps {
303
387
  isOpen: boolean;
304
388
  close: () => void;
@@ -318,4 +402,4 @@ interface Props {
318
402
  }
319
403
  declare const EraseConfirmModal: React.FC<Props>;
320
404
 
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 };
405
+ export { AutoLink, EmbedContent, EraseConfirmModal, ItemData, LinkItemMetaData, MediaUploadStatus, MediaUploadStatusOverlay, MentionData, POST_TYPE_HINT_DEFAULTS, PollItemData, PollResult, PostBody, PostCard, type PostCardProps, PostEmail, PostEmbedView, PostFooter, PostHeader, type PostHeaderProps, PostItemsView, PostLinkItem, PostMediaLayoutCore, PostPollView, PostSectionSourceInfoView, PostSectionsSummaryView, PostSectionsView, PostTextItem, type PostTypeHint, type PostTypeHintContext, PostUploadStrip, PrimaryContent, ReactionModal, ResolvedTextContent, SectionItem, TextItemContent, TipTapDocument, getPostTypeHint };