stream-chat-react 12.15.4 → 12.15.6

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.
@@ -50250,12 +50250,13 @@ var PollHeader = () => {
50250
50250
  const { enforce_unique_vote, is_closed, max_votes_allowed, name: name2, options } = useStateStore(poll.state, pollStateSelector);
50251
50251
  const selectionInstructions = (0, import_react148.useMemo)(() => {
50252
50252
  if (is_closed) return t2("Vote ended");
50253
- if (enforce_unique_vote) return t2("Select one");
50253
+ if (enforce_unique_vote || options.length === 1) return t2("Select one");
50254
50254
  if (max_votes_allowed)
50255
50255
  return t2("Select up to {{count}}", {
50256
50256
  count: max_votes_allowed > options.length ? options.length : max_votes_allowed
50257
50257
  });
50258
- return t2("Select one or more");
50258
+ if (options.length > 1) return t2("Select one or more");
50259
+ return "";
50259
50260
  }, [is_closed, enforce_unique_vote, max_votes_allowed, options.length, t2]);
50260
50261
  if (!name2) return;
50261
50262
  return /* @__PURE__ */ import_react148.default.createElement("div", { className: "str-chat__poll-header" }, /* @__PURE__ */ import_react148.default.createElement("div", { className: "str-chat__poll-title" }, name2), /* @__PURE__ */ import_react148.default.createElement("div", { className: "str-chat__poll-subtitle" }, selectionInstructions));
@@ -50335,36 +50336,46 @@ var FormDialog = ({
50335
50336
  await onSubmit(value);
50336
50337
  close();
50337
50338
  };
50338
- return /* @__PURE__ */ import_react150.default.createElement("div", { className: (0, import_clsx36.default)("str-chat__dialog str-chat__dialog--form", className) }, /* @__PURE__ */ import_react150.default.createElement("div", { className: "str-chat__dialog__body" }, title && /* @__PURE__ */ import_react150.default.createElement("div", { className: "str-chat__dialog__title" }, title), /* @__PURE__ */ import_react150.default.createElement("form", { autoComplete: "off" }, Object.entries(fields).map(([id, fieldConfig]) => /* @__PURE__ */ import_react150.default.createElement("div", { className: "str-chat__dialog__field", key: `dialog-field-${id}` }, fieldConfig.label && /* @__PURE__ */ import_react150.default.createElement(
50339
- "label",
50340
- {
50341
- className: (0, import_clsx36.default)(
50342
- `str-chat__dialog__title str-chat__dialog__title--${id}`
50343
- ),
50344
- htmlFor: id
50345
- },
50346
- fieldConfig.label
50347
- ), import_react150.default.createElement(fieldConfig.element, {
50348
- id,
50349
- ...fieldConfig.props,
50350
- onChange: handleChange,
50351
- value: value[id]
50352
- }), /* @__PURE__ */ import_react150.default.createElement(FieldError, { text: fieldErrors[id]?.message }))))), /* @__PURE__ */ import_react150.default.createElement("div", { className: "str-chat__dialog__controls" }, /* @__PURE__ */ import_react150.default.createElement(
50353
- "button",
50354
- {
50355
- className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
50356
- onClick: close
50357
- },
50358
- t2("Cancel")
50359
- ), /* @__PURE__ */ import_react150.default.createElement(
50360
- "button",
50339
+ return /* @__PURE__ */ import_react150.default.createElement("div", { className: (0, import_clsx36.default)("str-chat__dialog str-chat__dialog--form", className) }, /* @__PURE__ */ import_react150.default.createElement("div", { className: "str-chat__dialog__body" }, title && /* @__PURE__ */ import_react150.default.createElement("div", { className: "str-chat__dialog__title" }, title), /* @__PURE__ */ import_react150.default.createElement(
50340
+ "form",
50361
50341
  {
50362
- className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--submit",
50363
- disabled: Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value),
50364
- onClick: handleSubmit,
50365
- type: "submit"
50342
+ autoComplete: "off",
50343
+ onSubmit: (e2) => {
50344
+ e2.preventDefault();
50345
+ handleSubmit();
50346
+ }
50366
50347
  },
50367
- t2("Send")
50348
+ Object.entries(fields).map(([id, fieldConfig]) => /* @__PURE__ */ import_react150.default.createElement("div", { className: "str-chat__dialog__field", key: `dialog-field-${id}` }, fieldConfig.label && /* @__PURE__ */ import_react150.default.createElement(
50349
+ "label",
50350
+ {
50351
+ className: (0, import_clsx36.default)(
50352
+ `str-chat__dialog__title str-chat__dialog__title--${id}`
50353
+ ),
50354
+ htmlFor: id
50355
+ },
50356
+ fieldConfig.label
50357
+ ), import_react150.default.createElement(fieldConfig.element, {
50358
+ id,
50359
+ ...fieldConfig.props,
50360
+ onChange: handleChange,
50361
+ value: value[id]
50362
+ }), /* @__PURE__ */ import_react150.default.createElement(FieldError, { text: fieldErrors[id]?.message }))),
50363
+ /* @__PURE__ */ import_react150.default.createElement("div", { className: "str-chat__dialog__controls" }, /* @__PURE__ */ import_react150.default.createElement(
50364
+ "button",
50365
+ {
50366
+ className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
50367
+ onClick: close
50368
+ },
50369
+ t2("Cancel")
50370
+ ), /* @__PURE__ */ import_react150.default.createElement(
50371
+ "button",
50372
+ {
50373
+ className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--submit",
50374
+ disabled: Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value),
50375
+ type: "submit"
50376
+ },
50377
+ t2("Send")
50378
+ ))
50368
50379
  )));
50369
50380
  };
50370
50381
 
@@ -57796,7 +57807,7 @@ var useChat = ({
57796
57807
  };
57797
57808
  (0, import_react262.useEffect)(() => {
57798
57809
  if (!client) return;
57799
- const version = "12.15.4";
57810
+ const version = "12.15.6";
57800
57811
  const userAgent = client.getUserAgent();
57801
57812
  if (!userAgent.includes("stream-chat-react")) {
57802
57813
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);