stream-chat-react 13.0.1 → 13.0.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/dist/components/Attachment/index.d.ts +1 -0
- package/dist/components/Attachment/index.js +1 -0
- package/dist/components/Chat/hooks/useChat.js +1 -1
- package/dist/components/Dialog/FormDialog.js +16 -12
- package/dist/components/Poll/PollHeader.js +4 -2
- package/dist/index.browser.cjs +43 -31
- package/dist/index.browser.cjs.map +2 -2
- package/dist/index.node.cjs +44 -31
- package/dist/index.node.cjs.map +2 -2
- package/package.json +1 -1
|
@@ -24,7 +24,7 @@ export const useChat = ({ client, defaultLanguage = 'en', i18nInstance, initialN
|
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (!client)
|
|
26
26
|
return;
|
|
27
|
-
const version = "13.0.
|
|
27
|
+
const version = "13.0.2";
|
|
28
28
|
const userAgent = client.getUserAgent();
|
|
29
29
|
if (!userAgent.includes('stream-chat-react')) {
|
|
30
30
|
// result looks like: 'stream-chat-react-2.3.2-stream-chat-javascript-client-browser-2.2.2'
|
|
@@ -57,16 +57,20 @@ export const FormDialog = ({ className, close, fields, onSubmit, shouldDisableSu
|
|
|
57
57
|
return (React.createElement("div", { className: clsx('str-chat__dialog str-chat__dialog--form', className) },
|
|
58
58
|
React.createElement("div", { className: 'str-chat__dialog__body' },
|
|
59
59
|
title && React.createElement("div", { className: 'str-chat__dialog__title' }, title),
|
|
60
|
-
React.createElement("form", { autoComplete: 'off'
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
60
|
+
React.createElement("form", { autoComplete: 'off', onSubmit: (e) => {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
handleSubmit();
|
|
63
|
+
} },
|
|
64
|
+
Object.entries(fields).map(([id, fieldConfig]) => (React.createElement("div", { className: 'str-chat__dialog__field', key: `dialog-field-${id}` },
|
|
65
|
+
fieldConfig.label && (React.createElement("label", { className: clsx(`str-chat__dialog__title str-chat__dialog__title--${id}`), htmlFor: id }, fieldConfig.label)),
|
|
66
|
+
React.createElement(fieldConfig.element, {
|
|
67
|
+
id,
|
|
68
|
+
...fieldConfig.props,
|
|
69
|
+
onChange: handleChange,
|
|
70
|
+
value: value[id],
|
|
71
|
+
}),
|
|
72
|
+
React.createElement(FieldError, { text: fieldErrors[id]?.message })))),
|
|
73
|
+
React.createElement("div", { className: 'str-chat__dialog__controls' },
|
|
74
|
+
React.createElement("button", { className: 'str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel', onClick: close }, t('Cancel')),
|
|
75
|
+
React.createElement("button", { className: 'str-chat__dialog__controls-button str-chat__dialog__controls-button--submit', disabled: Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value), type: 'submit' }, t('Send')))))));
|
|
72
76
|
};
|
|
@@ -15,13 +15,15 @@ export const PollHeader = () => {
|
|
|
15
15
|
const selectionInstructions = useMemo(() => {
|
|
16
16
|
if (is_closed)
|
|
17
17
|
return t('Vote ended');
|
|
18
|
-
if (enforce_unique_vote)
|
|
18
|
+
if (enforce_unique_vote || options.length === 1)
|
|
19
19
|
return t('Select one');
|
|
20
20
|
if (max_votes_allowed)
|
|
21
21
|
return t('Select up to {{count}}', {
|
|
22
22
|
count: max_votes_allowed > options.length ? options.length : max_votes_allowed,
|
|
23
23
|
});
|
|
24
|
-
|
|
24
|
+
if (options.length > 1)
|
|
25
|
+
return t('Select one or more');
|
|
26
|
+
return '';
|
|
25
27
|
}, [is_closed, enforce_unique_vote, max_votes_allowed, options.length, t]);
|
|
26
28
|
if (!name)
|
|
27
29
|
return;
|
package/dist/index.browser.cjs
CHANGED
|
@@ -17583,6 +17583,7 @@ __export(src_exports, {
|
|
|
17583
17583
|
useActionHandler: () => useActionHandler,
|
|
17584
17584
|
useActiveThread: () => useActiveThread,
|
|
17585
17585
|
useAttachmentManagerState: () => useAttachmentManagerState,
|
|
17586
|
+
useAudioController: () => useAudioController,
|
|
17586
17587
|
useCanCreatePoll: () => useCanCreatePoll,
|
|
17587
17588
|
useChannelActionContext: () => useChannelActionContext,
|
|
17588
17589
|
useChannelDeletedListener: () => useChannelDeletedListener,
|
|
@@ -38680,12 +38681,13 @@ var PollHeader = () => {
|
|
|
38680
38681
|
const { enforce_unique_vote, is_closed, max_votes_allowed, name: name2, options } = useStateStore(poll.state, pollStateSelector);
|
|
38681
38682
|
const selectionInstructions = (0, import_react123.useMemo)(() => {
|
|
38682
38683
|
if (is_closed) return t("Vote ended");
|
|
38683
|
-
if (enforce_unique_vote) return t("Select one");
|
|
38684
|
+
if (enforce_unique_vote || options.length === 1) return t("Select one");
|
|
38684
38685
|
if (max_votes_allowed)
|
|
38685
38686
|
return t("Select up to {{count}}", {
|
|
38686
38687
|
count: max_votes_allowed > options.length ? options.length : max_votes_allowed
|
|
38687
38688
|
});
|
|
38688
|
-
return t("Select one or more");
|
|
38689
|
+
if (options.length > 1) return t("Select one or more");
|
|
38690
|
+
return "";
|
|
38689
38691
|
}, [is_closed, enforce_unique_vote, max_votes_allowed, options.length, t]);
|
|
38690
38692
|
if (!name2) return;
|
|
38691
38693
|
return /* @__PURE__ */ import_react123.default.createElement("div", { className: "str-chat__poll-header" }, /* @__PURE__ */ import_react123.default.createElement("div", { className: "str-chat__poll-title" }, name2), /* @__PURE__ */ import_react123.default.createElement("div", { className: "str-chat__poll-subtitle" }, selectionInstructions));
|
|
@@ -38765,36 +38767,46 @@ var FormDialog = ({
|
|
|
38765
38767
|
await onSubmit(value);
|
|
38766
38768
|
close();
|
|
38767
38769
|
};
|
|
38768
|
-
return /* @__PURE__ */ import_react125.default.createElement("div", { className: (0, import_clsx27.default)("str-chat__dialog str-chat__dialog--form", className) }, /* @__PURE__ */ import_react125.default.createElement("div", { className: "str-chat__dialog__body" }, title && /* @__PURE__ */ import_react125.default.createElement("div", { className: "str-chat__dialog__title" }, title), /* @__PURE__ */ import_react125.default.createElement(
|
|
38769
|
-
"
|
|
38770
|
-
{
|
|
38771
|
-
className: (0, import_clsx27.default)(
|
|
38772
|
-
`str-chat__dialog__title str-chat__dialog__title--${id}`
|
|
38773
|
-
),
|
|
38774
|
-
htmlFor: id
|
|
38775
|
-
},
|
|
38776
|
-
fieldConfig.label
|
|
38777
|
-
), import_react125.default.createElement(fieldConfig.element, {
|
|
38778
|
-
id,
|
|
38779
|
-
...fieldConfig.props,
|
|
38780
|
-
onChange: handleChange,
|
|
38781
|
-
value: value[id]
|
|
38782
|
-
}), /* @__PURE__ */ import_react125.default.createElement(FieldError, { text: fieldErrors[id]?.message }))))), /* @__PURE__ */ import_react125.default.createElement("div", { className: "str-chat__dialog__controls" }, /* @__PURE__ */ import_react125.default.createElement(
|
|
38783
|
-
"button",
|
|
38784
|
-
{
|
|
38785
|
-
className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
|
|
38786
|
-
onClick: close
|
|
38787
|
-
},
|
|
38788
|
-
t("Cancel")
|
|
38789
|
-
), /* @__PURE__ */ import_react125.default.createElement(
|
|
38790
|
-
"button",
|
|
38770
|
+
return /* @__PURE__ */ import_react125.default.createElement("div", { className: (0, import_clsx27.default)("str-chat__dialog str-chat__dialog--form", className) }, /* @__PURE__ */ import_react125.default.createElement("div", { className: "str-chat__dialog__body" }, title && /* @__PURE__ */ import_react125.default.createElement("div", { className: "str-chat__dialog__title" }, title), /* @__PURE__ */ import_react125.default.createElement(
|
|
38771
|
+
"form",
|
|
38791
38772
|
{
|
|
38792
|
-
|
|
38793
|
-
|
|
38794
|
-
|
|
38795
|
-
|
|
38773
|
+
autoComplete: "off",
|
|
38774
|
+
onSubmit: (e) => {
|
|
38775
|
+
e.preventDefault();
|
|
38776
|
+
handleSubmit();
|
|
38777
|
+
}
|
|
38796
38778
|
},
|
|
38797
|
-
|
|
38779
|
+
Object.entries(fields).map(([id, fieldConfig]) => /* @__PURE__ */ import_react125.default.createElement("div", { className: "str-chat__dialog__field", key: `dialog-field-${id}` }, fieldConfig.label && /* @__PURE__ */ import_react125.default.createElement(
|
|
38780
|
+
"label",
|
|
38781
|
+
{
|
|
38782
|
+
className: (0, import_clsx27.default)(
|
|
38783
|
+
`str-chat__dialog__title str-chat__dialog__title--${id}`
|
|
38784
|
+
),
|
|
38785
|
+
htmlFor: id
|
|
38786
|
+
},
|
|
38787
|
+
fieldConfig.label
|
|
38788
|
+
), import_react125.default.createElement(fieldConfig.element, {
|
|
38789
|
+
id,
|
|
38790
|
+
...fieldConfig.props,
|
|
38791
|
+
onChange: handleChange,
|
|
38792
|
+
value: value[id]
|
|
38793
|
+
}), /* @__PURE__ */ import_react125.default.createElement(FieldError, { text: fieldErrors[id]?.message }))),
|
|
38794
|
+
/* @__PURE__ */ import_react125.default.createElement("div", { className: "str-chat__dialog__controls" }, /* @__PURE__ */ import_react125.default.createElement(
|
|
38795
|
+
"button",
|
|
38796
|
+
{
|
|
38797
|
+
className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
|
|
38798
|
+
onClick: close
|
|
38799
|
+
},
|
|
38800
|
+
t("Cancel")
|
|
38801
|
+
), /* @__PURE__ */ import_react125.default.createElement(
|
|
38802
|
+
"button",
|
|
38803
|
+
{
|
|
38804
|
+
className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--submit",
|
|
38805
|
+
disabled: Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value),
|
|
38806
|
+
type: "submit"
|
|
38807
|
+
},
|
|
38808
|
+
t("Send")
|
|
38809
|
+
))
|
|
38798
38810
|
)));
|
|
38799
38811
|
};
|
|
38800
38812
|
|
|
@@ -51184,7 +51196,7 @@ var useChat = ({
|
|
|
51184
51196
|
};
|
|
51185
51197
|
(0, import_react264.useEffect)(() => {
|
|
51186
51198
|
if (!client) return;
|
|
51187
|
-
const version = "13.0.
|
|
51199
|
+
const version = "13.0.2";
|
|
51188
51200
|
const userAgent = client.getUserAgent();
|
|
51189
51201
|
if (!userAgent.includes("stream-chat-react")) {
|
|
51190
51202
|
client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
|