@emblemvault/hustle-react 1.5.0 → 1.5.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.
package/dist/index.cjs CHANGED
@@ -4136,6 +4136,8 @@ function HustleChat({
4136
4136
  className = "",
4137
4137
  placeholder = "Type a message...",
4138
4138
  showSettings = false,
4139
+ settingsPanelOpen: controlledSettingsPanelOpen,
4140
+ onSettingsPanelOpenChange,
4139
4141
  showDebug = false,
4140
4142
  hideHeader = false,
4141
4143
  initialSystemPrompt = "",
@@ -4175,7 +4177,17 @@ function HustleChat({
4175
4177
  const [isStreaming, setIsStreaming] = react.useState(false);
4176
4178
  const [attachments, setAttachments] = react.useState([]);
4177
4179
  const [currentToolCalls, setCurrentToolCalls] = react.useState([]);
4178
- const [showSettingsPanel, setShowSettingsPanel] = react.useState(false);
4180
+ const [internalShowSettingsPanel, setInternalShowSettingsPanel] = react.useState(false);
4181
+ const isSettingsControlled = controlledSettingsPanelOpen !== void 0;
4182
+ const showSettingsPanel = isSettingsControlled ? controlledSettingsPanelOpen : internalShowSettingsPanel;
4183
+ const setShowSettingsPanel = (open) => {
4184
+ const newValue = typeof open === "function" ? open(showSettingsPanel) : open;
4185
+ if (isSettingsControlled) {
4186
+ onSettingsPanelOpenChange?.(newValue);
4187
+ } else {
4188
+ setInternalShowSettingsPanel(newValue);
4189
+ }
4190
+ };
4179
4191
  const [speechToTextEnabled, setSpeechToTextEnabled] = react.useState(() => {
4180
4192
  if (typeof window !== "undefined") {
4181
4193
  const stored = localStorage.getItem(`hustle-stt-enabled-${instanceId}`);
@@ -5048,6 +5060,12 @@ function CloseIcon() {
5048
5060
  /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
5049
5061
  ] });
5050
5062
  }
5063
+ function SettingsIcon2() {
5064
+ return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
5065
+ /* @__PURE__ */ jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "3" }),
5066
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z" })
5067
+ ] });
5068
+ }
5051
5069
  function ExpandIcon() {
5052
5070
  return /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
5053
5071
  /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "15 3 21 3 21 9" }),
@@ -5096,6 +5114,8 @@ function HustleChatWidget({
5096
5114
  const [isHovered, setIsHovered] = react.useState(false);
5097
5115
  const [closeHovered, setCloseHovered] = react.useState(false);
5098
5116
  const [mounted, setMounted] = react.useState(false);
5117
+ const [settingsOpen, setSettingsOpen] = react.useState(false);
5118
+ const { showSettings, ...restChatProps } = chatProps;
5099
5119
  react.useEffect(() => {
5100
5120
  setMounted(true);
5101
5121
  if (storageKey && typeof window !== "undefined") {
@@ -5205,6 +5225,18 @@ function HustleChatWidget({
5205
5225
  ] })
5206
5226
  ] }),
5207
5227
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: tokens.spacing.xs }, children: [
5228
+ showSettings && /* @__PURE__ */ jsxRuntime.jsx(
5229
+ "button",
5230
+ {
5231
+ onClick: () => setSettingsOpen(!settingsOpen),
5232
+ style: {
5233
+ ...widgetStyles.closeBtn,
5234
+ ...settingsOpen ? { background: tokens.colors.bgSecondary } : {}
5235
+ },
5236
+ title: "Settings",
5237
+ children: /* @__PURE__ */ jsxRuntime.jsx(SettingsIcon2, {})
5238
+ }
5239
+ ),
5208
5240
  size === "sideDock" && /* @__PURE__ */ jsxRuntime.jsx(
5209
5241
  "button",
5210
5242
  {
@@ -5239,7 +5271,15 @@ function HustleChatWidget({
5239
5271
  ]
5240
5272
  }
5241
5273
  ),
5242
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: /* @__PURE__ */ jsxRuntime.jsx(HustleChatInner, { ...chatProps }) })
5274
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: /* @__PURE__ */ jsxRuntime.jsx(
5275
+ HustleChatInner,
5276
+ {
5277
+ ...restChatProps,
5278
+ showSettings,
5279
+ settingsPanelOpen: settingsOpen,
5280
+ onSettingsPanelOpenChange: setSettingsOpen
5281
+ }
5282
+ ) })
5243
5283
  ]
5244
5284
  }
5245
5285
  ),