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.
@@ -20390,6 +20390,7 @@ __export(src_exports, {
20390
20390
  useActionHandler: () => useActionHandler,
20391
20391
  useActiveThread: () => useActiveThread,
20392
20392
  useAttachmentManagerState: () => useAttachmentManagerState,
20393
+ useAudioController: () => useAudioController,
20393
20394
  useCanCreatePoll: () => useCanCreatePoll,
20394
20395
  useChannelActionContext: () => useChannelActionContext,
20395
20396
  useChannelDeletedListener: () => useChannelDeletedListener,
@@ -43357,12 +43358,13 @@ var PollHeader = () => {
43357
43358
  const { enforce_unique_vote, is_closed, max_votes_allowed, name: name2, options } = useStateStore(poll.state, pollStateSelector);
43358
43359
  const selectionInstructions = (0, import_react122.useMemo)(() => {
43359
43360
  if (is_closed) return t("Vote ended");
43360
- if (enforce_unique_vote) return t("Select one");
43361
+ if (enforce_unique_vote || options.length === 1) return t("Select one");
43361
43362
  if (max_votes_allowed)
43362
43363
  return t("Select up to {{count}}", {
43363
43364
  count: max_votes_allowed > options.length ? options.length : max_votes_allowed
43364
43365
  });
43365
- return t("Select one or more");
43366
+ if (options.length > 1) return t("Select one or more");
43367
+ return "";
43366
43368
  }, [is_closed, enforce_unique_vote, max_votes_allowed, options.length, t]);
43367
43369
  if (!name2) return;
43368
43370
  return /* @__PURE__ */ import_react122.default.createElement("div", { className: "str-chat__poll-header" }, /* @__PURE__ */ import_react122.default.createElement("div", { className: "str-chat__poll-title" }, name2), /* @__PURE__ */ import_react122.default.createElement("div", { className: "str-chat__poll-subtitle" }, selectionInstructions));
@@ -43442,36 +43444,46 @@ var FormDialog = ({
43442
43444
  await onSubmit(value);
43443
43445
  close();
43444
43446
  };
43445
- return /* @__PURE__ */ import_react124.default.createElement("div", { className: (0, import_clsx27.default)("str-chat__dialog str-chat__dialog--form", className) }, /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__body" }, title && /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__title" }, title), /* @__PURE__ */ import_react124.default.createElement("form", { autoComplete: "off" }, Object.entries(fields).map(([id, fieldConfig]) => /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__field", key: `dialog-field-${id}` }, fieldConfig.label && /* @__PURE__ */ import_react124.default.createElement(
43446
- "label",
43447
- {
43448
- className: (0, import_clsx27.default)(
43449
- `str-chat__dialog__title str-chat__dialog__title--${id}`
43450
- ),
43451
- htmlFor: id
43452
- },
43453
- fieldConfig.label
43454
- ), import_react124.default.createElement(fieldConfig.element, {
43455
- id,
43456
- ...fieldConfig.props,
43457
- onChange: handleChange,
43458
- value: value[id]
43459
- }), /* @__PURE__ */ import_react124.default.createElement(FieldError, { text: fieldErrors[id]?.message }))))), /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__controls" }, /* @__PURE__ */ import_react124.default.createElement(
43460
- "button",
43461
- {
43462
- className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
43463
- onClick: close
43464
- },
43465
- t("Cancel")
43466
- ), /* @__PURE__ */ import_react124.default.createElement(
43467
- "button",
43447
+ return /* @__PURE__ */ import_react124.default.createElement("div", { className: (0, import_clsx27.default)("str-chat__dialog str-chat__dialog--form", className) }, /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__body" }, title && /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__title" }, title), /* @__PURE__ */ import_react124.default.createElement(
43448
+ "form",
43468
43449
  {
43469
- className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--submit",
43470
- disabled: Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value),
43471
- onClick: handleSubmit,
43472
- type: "submit"
43450
+ autoComplete: "off",
43451
+ onSubmit: (e) => {
43452
+ e.preventDefault();
43453
+ handleSubmit();
43454
+ }
43473
43455
  },
43474
- t("Send")
43456
+ Object.entries(fields).map(([id, fieldConfig]) => /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__field", key: `dialog-field-${id}` }, fieldConfig.label && /* @__PURE__ */ import_react124.default.createElement(
43457
+ "label",
43458
+ {
43459
+ className: (0, import_clsx27.default)(
43460
+ `str-chat__dialog__title str-chat__dialog__title--${id}`
43461
+ ),
43462
+ htmlFor: id
43463
+ },
43464
+ fieldConfig.label
43465
+ ), import_react124.default.createElement(fieldConfig.element, {
43466
+ id,
43467
+ ...fieldConfig.props,
43468
+ onChange: handleChange,
43469
+ value: value[id]
43470
+ }), /* @__PURE__ */ import_react124.default.createElement(FieldError, { text: fieldErrors[id]?.message }))),
43471
+ /* @__PURE__ */ import_react124.default.createElement("div", { className: "str-chat__dialog__controls" }, /* @__PURE__ */ import_react124.default.createElement(
43472
+ "button",
43473
+ {
43474
+ className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
43475
+ onClick: close
43476
+ },
43477
+ t("Cancel")
43478
+ ), /* @__PURE__ */ import_react124.default.createElement(
43479
+ "button",
43480
+ {
43481
+ className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--submit",
43482
+ disabled: Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value),
43483
+ type: "submit"
43484
+ },
43485
+ t("Send")
43486
+ ))
43475
43487
  )));
43476
43488
  };
43477
43489
 
@@ -55861,7 +55873,7 @@ var useChat = ({
55861
55873
  };
55862
55874
  (0, import_react263.useEffect)(() => {
55863
55875
  if (!client) return;
55864
- const version = "13.0.1";
55876
+ const version = "13.0.2";
55865
55877
  const userAgent = client.getUserAgent();
55866
55878
  if (!userAgent.includes("stream-chat-react")) {
55867
55879
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);
@@ -56403,6 +56415,7 @@ var Window = import_react268.default.memo(UnMemoizedWindow);
56403
56415
  useActionHandler,
56404
56416
  useActiveThread,
56405
56417
  useAttachmentManagerState,
56418
+ useAudioController,
56406
56419
  useCanCreatePoll,
56407
56420
  useChannelActionContext,
56408
56421
  useChannelDeletedListener,