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.
@@ -45570,12 +45570,13 @@ var PollHeader = () => {
45570
45570
  const { enforce_unique_vote, is_closed, max_votes_allowed, name: name2, options } = useStateStore(poll.state, pollStateSelector);
45571
45571
  const selectionInstructions = (0, import_react148.useMemo)(() => {
45572
45572
  if (is_closed) return t2("Vote ended");
45573
- if (enforce_unique_vote) return t2("Select one");
45573
+ if (enforce_unique_vote || options.length === 1) return t2("Select one");
45574
45574
  if (max_votes_allowed)
45575
45575
  return t2("Select up to {{count}}", {
45576
45576
  count: max_votes_allowed > options.length ? options.length : max_votes_allowed
45577
45577
  });
45578
- return t2("Select one or more");
45578
+ if (options.length > 1) return t2("Select one or more");
45579
+ return "";
45579
45580
  }, [is_closed, enforce_unique_vote, max_votes_allowed, options.length, t2]);
45580
45581
  if (!name2) return;
45581
45582
  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));
@@ -45655,36 +45656,46 @@ var FormDialog = ({
45655
45656
  await onSubmit(value);
45656
45657
  close();
45657
45658
  };
45658
- 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(
45659
- "label",
45660
- {
45661
- className: (0, import_clsx36.default)(
45662
- `str-chat__dialog__title str-chat__dialog__title--${id}`
45663
- ),
45664
- htmlFor: id
45665
- },
45666
- fieldConfig.label
45667
- ), import_react150.default.createElement(fieldConfig.element, {
45668
- id,
45669
- ...fieldConfig.props,
45670
- onChange: handleChange,
45671
- value: value[id]
45672
- }), /* @__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(
45673
- "button",
45674
- {
45675
- className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
45676
- onClick: close
45677
- },
45678
- t2("Cancel")
45679
- ), /* @__PURE__ */ import_react150.default.createElement(
45680
- "button",
45659
+ 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(
45660
+ "form",
45681
45661
  {
45682
- className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--submit",
45683
- disabled: Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value),
45684
- onClick: handleSubmit,
45685
- type: "submit"
45662
+ autoComplete: "off",
45663
+ onSubmit: (e2) => {
45664
+ e2.preventDefault();
45665
+ handleSubmit();
45666
+ }
45686
45667
  },
45687
- t2("Send")
45668
+ 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(
45669
+ "label",
45670
+ {
45671
+ className: (0, import_clsx36.default)(
45672
+ `str-chat__dialog__title str-chat__dialog__title--${id}`
45673
+ ),
45674
+ htmlFor: id
45675
+ },
45676
+ fieldConfig.label
45677
+ ), import_react150.default.createElement(fieldConfig.element, {
45678
+ id,
45679
+ ...fieldConfig.props,
45680
+ onChange: handleChange,
45681
+ value: value[id]
45682
+ }), /* @__PURE__ */ import_react150.default.createElement(FieldError, { text: fieldErrors[id]?.message }))),
45683
+ /* @__PURE__ */ import_react150.default.createElement("div", { className: "str-chat__dialog__controls" }, /* @__PURE__ */ import_react150.default.createElement(
45684
+ "button",
45685
+ {
45686
+ className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--cancel",
45687
+ onClick: close
45688
+ },
45689
+ t2("Cancel")
45690
+ ), /* @__PURE__ */ import_react150.default.createElement(
45691
+ "button",
45692
+ {
45693
+ className: "str-chat__dialog__controls-button str-chat__dialog__controls-button--submit",
45694
+ disabled: Object.keys(fieldErrors).length > 0 || shouldDisableSubmitButton?.(value),
45695
+ type: "submit"
45696
+ },
45697
+ t2("Send")
45698
+ ))
45688
45699
  )));
45689
45700
  };
45690
45701
 
@@ -53116,7 +53127,7 @@ var useChat = ({
53116
53127
  };
53117
53128
  (0, import_react263.useEffect)(() => {
53118
53129
  if (!client) return;
53119
- const version = "12.15.4";
53130
+ const version = "12.15.6";
53120
53131
  const userAgent = client.getUserAgent();
53121
53132
  if (!userAgent.includes("stream-chat-react")) {
53122
53133
  client.setUserAgent(`stream-chat-react-${version}-${userAgent}`);