stream-chat-react 13.0.5 → 13.1.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.
Files changed (103) hide show
  1. package/dist/components/Channel/Channel.d.ts +1 -1
  2. package/dist/components/Channel/Channel.js +7 -0
  3. package/dist/components/ChannelList/hooks/useChannelListShape.js +3 -3
  4. package/dist/components/Chat/hooks/useChat.js +7 -3
  5. package/dist/components/Dialog/ButtonWithSubmenu.d.ts +11 -0
  6. package/dist/components/Dialog/ButtonWithSubmenu.js +88 -0
  7. package/dist/components/Dialog/index.d.ts +1 -0
  8. package/dist/components/Dialog/index.js +1 -0
  9. package/dist/components/Loading/LoadingErrorIndicator.js +1 -1
  10. package/dist/components/Message/Message.js +3 -2
  11. package/dist/components/Message/MessageIsThreadReplyInChannelButtonIndicator.d.ts +2 -0
  12. package/dist/components/Message/MessageIsThreadReplyInChannelButtonIndicator.js +63 -0
  13. package/dist/components/Message/MessageSimple.js +11 -4
  14. package/dist/components/Message/ReminderNotification.d.ts +6 -0
  15. package/dist/components/Message/ReminderNotification.js +30 -0
  16. package/dist/components/Message/hooks/index.d.ts +1 -0
  17. package/dist/components/Message/hooks/index.js +1 -0
  18. package/dist/components/Message/hooks/useMessageReminder.d.ts +1 -0
  19. package/dist/components/Message/hooks/useMessageReminder.js +11 -0
  20. package/dist/components/Message/index.d.ts +1 -0
  21. package/dist/components/Message/index.js +1 -0
  22. package/dist/components/Message/utils.d.ts +4 -2
  23. package/dist/components/Message/utils.js +11 -1
  24. package/dist/components/MessageActions/MessageActionsBox.js +12 -6
  25. package/dist/components/MessageActions/RemindMeSubmenu.d.ts +6 -0
  26. package/dist/components/MessageActions/RemindMeSubmenu.js +18 -0
  27. package/dist/components/MessageInput/MessageInputFlat.js +5 -3
  28. package/dist/components/MessageInput/SendToChannelCheckbox.d.ts +2 -0
  29. package/dist/components/MessageInput/SendToChannelCheckbox.js +20 -0
  30. package/dist/components/MessageList/MessageListNotifications.js +8 -3
  31. package/dist/components/MessageList/VirtualizedMessageListComponents.d.ts +1 -1
  32. package/dist/components/MessageList/VirtualizedMessageListComponents.js +4 -0
  33. package/dist/components/Notifications/hooks/index.d.ts +1 -0
  34. package/dist/components/Notifications/hooks/index.js +1 -0
  35. package/dist/components/Notifications/hooks/useNotifications.d.ts +2 -0
  36. package/dist/components/Notifications/hooks/useNotifications.js +10 -0
  37. package/dist/components/Notifications/index.d.ts +1 -0
  38. package/dist/components/Notifications/index.js +1 -0
  39. package/dist/components/TextareaComposer/TextareaComposer.js +4 -0
  40. package/dist/components/Thread/LegacyThreadContext.d.ts +8 -0
  41. package/dist/components/Thread/LegacyThreadContext.js +3 -0
  42. package/dist/components/Thread/Thread.d.ts +0 -4
  43. package/dist/components/Thread/Thread.js +2 -3
  44. package/dist/components/Thread/index.d.ts +1 -0
  45. package/dist/components/Thread/index.js +1 -0
  46. package/dist/components/index.d.ts +1 -0
  47. package/dist/components/index.js +1 -0
  48. package/dist/context/ComponentContext.d.ts +7 -1
  49. package/dist/css/v2/index.css +1 -1
  50. package/dist/css/v2/index.layout.css +1 -1
  51. package/dist/experimental/MessageActions/defaults.d.ts +1 -1
  52. package/dist/experimental/MessageActions/defaults.js +27 -4
  53. package/dist/experimental/index.browser.cjs +382 -169
  54. package/dist/experimental/index.browser.cjs.map +4 -4
  55. package/dist/experimental/index.node.cjs +382 -169
  56. package/dist/experimental/index.node.cjs.map +4 -4
  57. package/dist/i18n/Streami18n.d.ts +32 -3
  58. package/dist/i18n/Streami18n.js +34 -5
  59. package/dist/i18n/TranslationBuilder/TranslationBuilder.d.ts +35 -0
  60. package/dist/i18n/TranslationBuilder/TranslationBuilder.js +92 -0
  61. package/dist/i18n/TranslationBuilder/index.d.ts +2 -0
  62. package/dist/i18n/TranslationBuilder/index.js +2 -0
  63. package/dist/i18n/TranslationBuilder/notifications/NotificationTranslationTopic.d.ts +11 -0
  64. package/dist/i18n/TranslationBuilder/notifications/NotificationTranslationTopic.js +27 -0
  65. package/dist/i18n/TranslationBuilder/notifications/attachmentUpload.d.ts +4 -0
  66. package/dist/i18n/TranslationBuilder/notifications/attachmentUpload.js +32 -0
  67. package/dist/i18n/TranslationBuilder/notifications/index.d.ts +2 -0
  68. package/dist/i18n/TranslationBuilder/notifications/index.js +2 -0
  69. package/dist/i18n/TranslationBuilder/notifications/pollComposition.d.ts +3 -0
  70. package/dist/i18n/TranslationBuilder/notifications/pollComposition.js +9 -0
  71. package/dist/i18n/TranslationBuilder/notifications/types.d.ts +4 -0
  72. package/dist/i18n/TranslationBuilder/notifications/types.js +1 -0
  73. package/dist/i18n/de.json +23 -0
  74. package/dist/i18n/en.json +23 -0
  75. package/dist/i18n/es.json +23 -0
  76. package/dist/i18n/fr.json +23 -0
  77. package/dist/i18n/hi.json +23 -0
  78. package/dist/i18n/index.d.ts +1 -0
  79. package/dist/i18n/index.js +1 -0
  80. package/dist/i18n/it.json +23 -0
  81. package/dist/i18n/ja.json +23 -0
  82. package/dist/i18n/ko.json +23 -0
  83. package/dist/i18n/nl.json +23 -0
  84. package/dist/i18n/pt.json +23 -0
  85. package/dist/i18n/ru.json +23 -0
  86. package/dist/i18n/tr.json +23 -0
  87. package/dist/i18n/types.d.ts +54 -0
  88. package/dist/i18n/utils.d.ts +1 -1
  89. package/dist/i18n/utils.js +8 -2
  90. package/dist/index.browser.cjs +3617 -2162
  91. package/dist/index.browser.cjs.map +4 -4
  92. package/dist/index.node.cjs +3674 -2156
  93. package/dist/index.node.cjs.map +4 -4
  94. package/dist/plugins/Emojis/index.browser.cjs +1 -2
  95. package/dist/plugins/Emojis/index.browser.cjs.map +3 -3
  96. package/dist/plugins/Emojis/index.node.cjs +1 -2
  97. package/dist/plugins/Emojis/index.node.cjs.map +3 -3
  98. package/dist/scss/v2/Message/Message-layout.scss +11 -1
  99. package/dist/scss/v2/Message/Message-theme.scss +31 -1
  100. package/dist/scss/v2/MessageActionsBox/MessageActionsBox-theme.scss +8 -0
  101. package/dist/scss/v2/MessageInput/MessageInput-layout.scss +19 -0
  102. package/dist/scss/v2/MessageInput/MessageInput-theme.scss +11 -0
  103. package/package.json +6 -8
@@ -9,6 +9,59 @@ export type TimestampFormatterOptions = {
9
9
  calendarFormats?: Record<string, string>;
10
10
  format?: string;
11
11
  };
12
+ /**
13
+ * import dayjs from 'dayjs';
14
+ * import duration from 'dayjs/plugin/duration';
15
+ *
16
+ * dayjs.extend(duration);
17
+ *
18
+ * // Basic formatting
19
+ * dayjs.duration(1000).format('HH:mm:ss'); // "00:00:01"
20
+ * dayjs.duration(3661000).format('HH:mm:ss'); // "01:01:01"
21
+ *
22
+ * // Different format tokens
23
+ * dayjs.duration(3661000).format('D[d] H[h] m[m] s[s]'); // "0d 1h 1m 1s"
24
+ * dayjs.duration(3661000).format('D [days] H [hours] m [minutes] s [seconds]'); // "0 days 1 hours 1 minutes 1 seconds"
25
+ *
26
+ * // Zero padding
27
+ * dayjs.duration(1000).format('HH:mm:ss'); // "00:00:01"
28
+ * dayjs.duration(1000).format('H:m:s'); // "0:0:1"
29
+ *
30
+ * // Different units
31
+ * dayjs.duration(3661000).format('D'); // "0"
32
+ * dayjs.duration(3661000).format('H'); // "1"
33
+ * dayjs.duration(3661000).format('m'); // "1"
34
+ * dayjs.duration(3661000).format('s'); // "1"
35
+ *
36
+ * // Complex examples
37
+ * dayjs.duration(3661000).format('DD:HH:mm:ss'); // "00:01:01:01"
38
+ * dayjs.duration(3661000).format('D [days] HH:mm:ss'); // "0 days 01:01:01"
39
+ * dayjs.duration(3661000).format('H[h] m[m] s[s]'); // "1h 1m 1s"
40
+ *
41
+ * // Negative durations
42
+ * dayjs.duration(-3661000).format('HH:mm:ss'); // "-01:01:01"
43
+ *
44
+ * // Long durations
45
+ * dayjs.duration(86400000).format('D [days]'); // "1 days"
46
+ * dayjs.duration(2592000000).format('M [months]'); // "30 months"
47
+ *
48
+ *
49
+ * Format tokens:
50
+ * D - days
51
+ * H - hours
52
+ * m - minutes
53
+ * s - seconds
54
+ * S - milliseconds
55
+ * M - months
56
+ * Y - years
57
+ * You can also use:
58
+ * HH, mm, ss for zero-padded numbers
59
+ * [text] for literal text
60
+ */
61
+ export type DurationFormatterOptions = {
62
+ format?: string;
63
+ withSuffix?: boolean;
64
+ };
12
65
  export type TDateTimeParserInput = string | number | Date;
13
66
  export type TDateTimeParserOutput = string | number | Date | Dayjs.Dayjs | Moment;
14
67
  export type TDateTimeParser = (input?: TDateTimeParserInput) => TDateTimeParserOutput;
@@ -22,5 +75,6 @@ export type DateFormatterOptions = TimestampFormatterOptions & {
22
75
  };
23
76
  export type CustomFormatters = Record<string, FormatterFactory<any>>;
24
77
  export type PredefinedFormatters = {
78
+ durationFormatter: FormatterFactory<number>;
25
79
  timestampFormatter: FormatterFactory<string | Date>;
26
80
  };
@@ -9,6 +9,6 @@ export declare const isDayOrMoment: (output: TDateTimeParserOutput) => output is
9
9
  export declare const isDate: (output: unknown) => output is Date;
10
10
  export declare function getDateString({ calendar, calendarFormats, format, formatDate, messageCreatedAt, t, tDateTimeParser, timestampTranslationKey, }: DateFormatterOptions): string | number | null;
11
11
  export declare const predefinedFormatters: PredefinedFormatters;
12
- export declare const defaultTranslatorFunction: TFunction;
12
+ export declare const defaultTranslatorFunction: TFunction<"translation", undefined>;
13
13
  export declare const defaultDateTimeParser: (input?: TDateTimeParserInput) => Dayjs.Dayjs;
14
14
  export declare const isLanguageSupported: (language: string) => language is SupportedTranslations;
@@ -1,4 +1,4 @@
1
- import Dayjs from 'dayjs';
1
+ import Dayjs, { isDayjs } from 'dayjs';
2
2
  export const notValidDateWarning = 'MessageTimestamp was called without a message, or message has invalid created_at date.';
3
3
  export const noParsingFunctionWarning = 'MessageTimestamp was called but there is no datetime parsing function available';
4
4
  export const isNumberOrString = (output) => typeof output === 'string' || typeof output === 'number';
@@ -54,6 +54,12 @@ export function getDateString({ calendar, calendarFormats, format, formatDate, m
54
54
  return null;
55
55
  }
56
56
  export const predefinedFormatters = {
57
+ durationFormatter: (streamI18n) => (value, _, { format, withSuffix }) => {
58
+ if (format && isDayjs(streamI18n.DateTimeParser)) {
59
+ return streamI18n.DateTimeParser.duration(value).format(format);
60
+ }
61
+ return streamI18n.DateTimeParser.duration(value).humanize(!!withSuffix);
62
+ },
57
63
  timestampFormatter: (streamI18n) => (value, _, { calendarFormats, ...options }) => {
58
64
  let parsedCalendarFormats;
59
65
  try {
@@ -82,7 +88,7 @@ export const predefinedFormatters = {
82
88
  return result;
83
89
  },
84
90
  };
85
- export const defaultTranslatorFunction = (key) => key;
91
+ export const defaultTranslatorFunction = ((key) => key);
86
92
  export const defaultDateTimeParser = (input) => Dayjs(input);
87
93
  export const isLanguageSupported = (language) => {
88
94
  const translations = [