@trops/dash-core 0.1.758 → 0.1.759

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.js CHANGED
@@ -57953,56 +57953,30 @@ var ICONS = {
57953
57953
  "widget-draft": "pen-to-square"
57954
57954
  };
57955
57955
 
57956
- /** One row: icon, title, then status · age underneath — left-aligned. */
57956
+ /**
57957
+ * One row (dash-react ListRow — design guide "List rows"): icon, title, then
57958
+ * status · age underneath; Remove (×) shows on hover, outside the row button.
57959
+ */
57957
57960
  var RecentRow = function RecentRow(_ref) {
57958
57961
  var row = _ref.row,
57959
57962
  onOpen = _ref.onOpen,
57960
57963
  onRemove = _ref.onRemove;
57961
- var _useConfigTokens = useConfigTokens(),
57962
- muted = _useConfigTokens.muted,
57963
- strong = _useConfigTokens.strong;
57964
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
57965
- className: "flex flex-row items-center gap-2",
57966
- "data-testid": "recent-row",
57967
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
57968
- className: "flex-1 min-w-0",
57969
- children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
57970
- size: "sm",
57971
- block: true,
57972
- onClick: function onClick() {
57973
- return onOpen(row);
57974
- },
57975
- children: /*#__PURE__*/jsxRuntime.jsxs("span", {
57976
- className: "flex flex-row items-start gap-2 w-full text-left"
57977
- // Buttons don't wrap or left-align their text; a row must.
57978
- ,
57979
- style: {
57980
- whiteSpace: "normal",
57981
- minWidth: 0
57982
- },
57983
- "aria-label": recentLine(row),
57984
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
57985
- icon: ICONS[row.kind] || "pen-to-square",
57986
- className: "h-3.5 w-3.5 mt-0.5 flex-shrink-0"
57987
- }), /*#__PURE__*/jsxRuntime.jsxs("span", {
57988
- className: "flex flex-col min-w-0",
57989
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
57990
- className: "truncate ".concat(strong),
57991
- children: row.title
57992
- }), /*#__PURE__*/jsxRuntime.jsxs("span", {
57993
- className: "text-xs ".concat(muted),
57994
- children: [row.status, " \xB7 ", draftAge(row.updatedAt)]
57995
- })]
57996
- })]
57997
- })
57998
- })
57999
- }), onRemove && row.kind !== "widget-draft" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
57964
+ return /*#__PURE__*/jsxRuntime.jsx(DashReact.ListRow, {
57965
+ testId: "recent-row",
57966
+ icon: ICONS[row.kind] || "pen-to-square",
57967
+ title: row.title,
57968
+ meta: "".concat(row.status, " \xB7 ").concat(draftAge(row.updatedAt)),
57969
+ ariaLabel: recentLine(row),
57970
+ onClick: function onClick() {
57971
+ return onOpen(row);
57972
+ },
57973
+ trailing: onRemove && row.kind !== "widget-draft" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
58000
57974
  icon: "xmark",
58001
57975
  ariaLabel: "Remove ".concat(row.title, " from Recent"),
58002
57976
  onClick: function onClick() {
58003
57977
  return onRemove(row);
58004
57978
  }
58005
- }) : null]
57979
+ }) : null
58006
57980
  });
58007
57981
  };
58008
57982
 
@@ -58752,7 +58726,10 @@ var AskStep = function AskStep(_ref) {
58752
58726
  return send(reply);
58753
58727
  },
58754
58728
  busy: busy,
58755
- placeholder: busy ? "The Planner is looking…" : "Ask a follow-up…",
58729
+ placeholder: busy ? "The Planner is looking…" : "Ask a follow-up…"
58730
+ // Same word as the dock's first question (one label per action).
58731
+ ,
58732
+ sendLabel: "Ask",
58756
58733
  className: "flex-shrink-0"
58757
58734
  })]
58758
58735
  });
@@ -58778,8 +58755,6 @@ var CreateDockPanel = function CreateDockPanel(_ref) {
58778
58755
  _ref$onCollapse = _ref.onCollapse,
58779
58756
  onCollapse = _ref$onCollapse === void 0 ? null : _ref$onCollapse;
58780
58757
  var _useConfigTokens = useConfigTokens(),
58781
- muted = _useConfigTokens.muted,
58782
- strong = _useConfigTokens.strong,
58783
58758
  hairline = _useConfigTokens.hairline;
58784
58759
  // { recentId, title, kind?: "question", question? } — the conversation
58785
58760
  // folded here (a new question has no recentId yet), or null (Recent).
@@ -58800,7 +58775,8 @@ var CreateDockPanel = function CreateDockPanel(_ref) {
58800
58775
  drafts = _useState8[0],
58801
58776
  setDrafts = _useState8[1];
58802
58777
  var _useResizableWidth = DashReact.useResizableWidth({
58803
- defaultWidth: 420,
58778
+ // Same default as the AI Assistant and Bot Activity docks.
58779
+ defaultWidth: 384,
58804
58780
  min: 340,
58805
58781
  max: 720,
58806
58782
  edge: "left",
@@ -58880,6 +58856,24 @@ var CreateDockPanel = function CreateDockPanel(_ref) {
58880
58856
  var sections = recentSections(plans, drafts, {
58881
58857
  conversations: 12
58882
58858
  });
58859
+ var hasRecent = sections.conversations.length + sections.drafts.length > 0;
58860
+ // A secondary button, not a link: it leaves the dock for Create full size.
58861
+ var makeNew = /*#__PURE__*/jsxRuntime.jsx(DashReact.Button2, {
58862
+ size: "sm",
58863
+ onClick: function onClick() {
58864
+ return openCreate({
58865
+ type: "dashboard"
58866
+ });
58867
+ },
58868
+ ariaLabel: "Make something new \u2014 opens Create full size",
58869
+ children: /*#__PURE__*/jsxRuntime.jsxs("span", {
58870
+ className: "inline-flex items-center gap-2",
58871
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
58872
+ icon: "up-right-and-down-left-from-center",
58873
+ className: "h-3 w-3"
58874
+ }), "Make something new\u2026"]
58875
+ })
58876
+ });
58883
58877
  var askNow = function askNow() {
58884
58878
  var q = asking.trim();
58885
58879
  if (!q) return;
@@ -58908,29 +58902,24 @@ var CreateDockPanel = function CreateDockPanel(_ref) {
58908
58902
  "aria-label": "Create",
58909
58903
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.ResizeHandle, _objectSpread$E(_objectSpread$E({}, handleProps), {}, {
58910
58904
  ariaLabel: "Resize Create"
58911
- })), /*#__PURE__*/jsxRuntime.jsxs("div", {
58912
- className: "flex-shrink-0 flex flex-row items-center gap-2 px-3 py-2 border-b ".concat(hairline),
58913
- children: [folded ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
58914
- icon: "arrow-left",
58915
- ariaLabel: "Back to Recent",
58916
- onClick: function onClick() {
58917
- return setFolded(null);
58918
- }
58919
- }) : /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
58920
- icon: "plus",
58921
- className: "h-3.5 w-3.5 opacity-70"
58922
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
58923
- className: "flex-1 min-w-0 truncate text-sm font-semibold ".concat(strong),
58924
- children: folded ? folded.title || (folded.kind === "question" ? "Question" : "Plan a dashboard") : "Create"
58925
- }), folded && folded.kind !== "question" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
58926
- icon: "up-right-and-down-left-from-center",
58927
- ariaLabel: "Expand",
58928
- onClick: expand
58929
- }) : null, onCollapse ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
58930
- icon: "xmark",
58931
- ariaLabel: "Close Create panel",
58932
- onClick: onCollapse
58933
- }) : null]
58905
+ })), /*#__PURE__*/jsxRuntime.jsx(DashReact.PanelHeader, {
58906
+ testId: "create-dock-header",
58907
+ onBack: folded ? function () {
58908
+ return setFolded(null);
58909
+ } : null,
58910
+ backLabel: "Back to Recent",
58911
+ title: folded ? folded.title || (folded.kind === "question" ? "Question" : "Plan a dashboard") : "Create",
58912
+ actions: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
58913
+ children: [folded && folded.kind !== "question" ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
58914
+ icon: "up-right-and-down-left-from-center",
58915
+ ariaLabel: "Expand",
58916
+ onClick: expand
58917
+ }) : null, onCollapse ? /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon, {
58918
+ icon: "xmark",
58919
+ ariaLabel: "Close Create panel",
58920
+ onClick: onCollapse
58921
+ }) : null]
58922
+ })
58934
58923
  }), folded && folded.kind === "question" ? /*#__PURE__*/jsxRuntime.jsx("div", {
58935
58924
  className: "flex-1 min-h-0 flex flex-col",
58936
58925
  children: /*#__PURE__*/jsxRuntime.jsx(AskStep, {
@@ -58953,59 +58942,32 @@ var CreateDockPanel = function CreateDockPanel(_ref) {
58953
58942
  }
58954
58943
  }, folded.recentId)
58955
58944
  }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
58956
- className: "flex-1 min-h-0 overflow-y-auto flex flex-col gap-2 p-3",
58957
- "data-testid": "create-dock-recent",
58945
+ className: "flex-1 min-h-0 flex flex-col",
58958
58946
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
58959
- className: "flex flex-col gap-2 pb-2",
58960
- "data-testid": "ask-box",
58961
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.TextArea, {
58962
- "aria-label": "Ask about your dashboards and bots",
58963
- value: asking,
58964
- onChange: function onChange(v) {
58965
- return setAsking(v);
58966
- },
58967
- placeholder: "Ask about your dashboards and bots \u2014 e.g. what did my bots find today?",
58968
- rows: 2,
58969
- onKeyDown: function onKeyDown(e) {
58970
- if (e.key === "Enter" && !e.shiftKey) {
58971
- e.preventDefault();
58972
- askNow();
58973
- }
58974
- }
58975
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
58976
- className: "flex flex-row justify-end",
58977
- children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button, {
58978
- size: "sm",
58979
- title: "Ask",
58980
- onClick: askNow,
58981
- disabled: !asking.trim()
58982
- })
58983
- })]
58984
- }), /*#__PURE__*/jsxRuntime.jsx(RecentList, {
58985
- sections: sections,
58986
- onOpen: openRow,
58987
- empty: /*#__PURE__*/jsxRuntime.jsx("span", {
58988
- className: "text-sm ".concat(muted),
58989
- children: "Nothing yet. Questions, plans and unfinished widgets show up here."
58990
- })
58991
- }), /*#__PURE__*/jsxRuntime.jsx("div", {
58992
- className: "pt-2",
58993
- children: /*#__PURE__*/jsxRuntime.jsx(DashReact.Button3, {
58994
- size: "sm",
58995
- onClick: function onClick() {
58996
- return openCreate({
58997
- type: "dashboard"
58998
- });
58999
- },
59000
- ariaLabel: "Make something new \u2014 opens Create full size",
59001
- children: /*#__PURE__*/jsxRuntime.jsxs("span", {
59002
- className: "inline-flex items-center gap-2",
59003
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
59004
- icon: "up-right-and-down-left-from-center",
59005
- className: "h-3 w-3"
59006
- }), "Make something new\u2026"]
58947
+ className: "flex-1 min-h-0 overflow-y-auto flex flex-col gap-4 p-4",
58948
+ "data-testid": "create-dock-recent",
58949
+ children: [/*#__PURE__*/jsxRuntime.jsx(RecentList, {
58950
+ sections: sections,
58951
+ onOpen: openRow,
58952
+ empty: /*#__PURE__*/jsxRuntime.jsx(DashReact.EmptyState, {
58953
+ testId: "create-dock-empty",
58954
+ className: "my-auto",
58955
+ title: "Nothing here yet",
58956
+ description: "Ask about your dashboards and bots below. Questions, plans and unfinished widgets show up here.",
58957
+ children: makeNew
59007
58958
  })
59008
- })
58959
+ }), hasRecent ? /*#__PURE__*/jsxRuntime.jsx("div", {
58960
+ children: makeNew
58961
+ }) : null]
58962
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.ChatComposer, {
58963
+ value: asking,
58964
+ onChange: function onChange(v) {
58965
+ return setAsking(v);
58966
+ },
58967
+ onSend: askNow,
58968
+ ariaLabel: "Ask about your dashboards and bots",
58969
+ placeholder: "Ask about your dashboards and bots\u2026",
58970
+ sendLabel: "Ask"
59009
58971
  })]
59010
58972
  })]
59011
58973
  });
@@ -88183,7 +88145,9 @@ var ChatInput = function ChatInput(_ref) {
88183
88145
  _ref$leads = _ref.leads,
88184
88146
  leads = _ref$leads === void 0 ? null : _ref$leads,
88185
88147
  _ref$onPickRecipient = _ref.onPickRecipient,
88186
- onPickRecipient = _ref$onPickRecipient === void 0 ? null : _ref$onPickRecipient;
88148
+ onPickRecipient = _ref$onPickRecipient === void 0 ? null : _ref$onPickRecipient,
88149
+ _ref$recipientPicker = _ref.recipientPicker,
88150
+ recipientPicker = _ref$recipientPicker === void 0 ? null : _ref$recipientPicker;
88187
88151
  var _useState = React.useState(""),
88188
88152
  _useState2 = _slicedToArray(_useState, 2),
88189
88153
  input = _useState2[0],
@@ -88312,10 +88276,12 @@ var ChatInput = function ChatInput(_ref) {
88312
88276
  rows: 1,
88313
88277
  placeholder: "Type a message...",
88314
88278
  hint: queued ? "Sends when the current reply finishes" : "Enter to send · Shift+Enter for a new line",
88315
- above: mentionOpen ? /*#__PURE__*/jsxRuntime.jsx(LeadMentionMenu, {
88316
- options: mentionOptions,
88317
- activeIndex: mentionIndex,
88318
- onPick: pickMention
88279
+ above: recipientPicker || mentionOpen ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
88280
+ children: [recipientPicker, mentionOpen ? /*#__PURE__*/jsxRuntime.jsx(LeadMentionMenu, {
88281
+ options: mentionOptions,
88282
+ activeIndex: mentionIndex,
88283
+ onPick: pickMention
88284
+ }) : null]
88319
88285
  }) : null
88320
88286
  });
88321
88287
  };
@@ -88458,33 +88424,37 @@ var RecipientPicker = function RecipientPicker(_ref) {
88458
88424
  group: "Team leads"
88459
88425
  };
88460
88426
  })));
88461
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
88462
- className: "flex flex-wrap items-center gap-2 px-3 pt-2",
88463
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88464
- children: "To:"
88465
- }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
88466
- label: "",
88467
- placeholder: "Send to",
88468
- value: recipient ? recipient.botId : ASSISTANT_VALUE,
88469
- options: options,
88470
- disabled: disabled,
88471
- className: "flex-1 min-w-0",
88472
- inputClassName: "text-xs py-1",
88473
- onChange: function onChange(value) {
88474
- if (value === ASSISTANT_VALUE) {
88475
- _onChange(null);
88476
- return;
88427
+ return (
88428
+ /*#__PURE__*/
88429
+ // Inside the message box (ChatInput's `recipientPicker`): the box's own
88430
+ // padding spaces it, so no padding here.
88431
+ jsxRuntime.jsxs("div", {
88432
+ className: "flex flex-wrap items-center gap-2",
88433
+ children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88434
+ children: "To:"
88435
+ }), /*#__PURE__*/jsxRuntime.jsx(DashReact.SelectInput, {
88436
+ label: "",
88437
+ placeholder: "Send to",
88438
+ value: recipient ? recipient.botId : ASSISTANT_VALUE,
88439
+ options: options,
88440
+ disabled: disabled,
88441
+ className: "flex-1 min-w-0",
88442
+ inputClassName: "text-sm py-1",
88443
+ onChange: function onChange(value) {
88444
+ if (value === ASSISTANT_VALUE) {
88445
+ _onChange(null);
88446
+ return;
88447
+ }
88448
+ var lead = leads.find(function (l) {
88449
+ return l.botId === value;
88450
+ });
88451
+ if (lead) _onChange(lead);
88477
88452
  }
88478
- var lead = leads.find(function (l) {
88479
- return l.botId === value;
88480
- });
88481
- if (lead) _onChange(lead);
88482
- }
88483
- }), leads.length === 0 && /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88484
- className: "opacity-70",
88485
- children: "No team leads yet \u2014 turn one on in a dashboard's Bots view."
88486
- })]
88487
- });
88453
+ }), leads.length === 0 && /*#__PURE__*/jsxRuntime.jsx(DashReact.Caption2, {
88454
+ children: "No team leads yet \u2014 turn one on in a dashboard's Bots view."
88455
+ })]
88456
+ })
88457
+ );
88488
88458
  };
88489
88459
 
88490
88460
  function ownKeys$5(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -89342,11 +89312,6 @@ function ChatCore(_ref) {
89342
89312
  return setLeadNotice(null);
89343
89313
  }
89344
89314
  })
89345
- }), enableLeadRecipients && /*#__PURE__*/jsxRuntime.jsx(RecipientPicker, {
89346
- leads: leads,
89347
- recipient: recipient,
89348
- onChange: handleRecipientChange,
89349
- disabled: isLoading
89350
89315
  }), /*#__PURE__*/jsxRuntime.jsx(ChatInput, {
89351
89316
  onSend: handleSend,
89352
89317
  onStop: handleStop,
@@ -89356,7 +89321,13 @@ function ChatCore(_ref) {
89356
89321
  // elsewhere "@" stays plain text (TEAM-013 AC6).
89357
89322
  ,
89358
89323
  leads: enableLeadRecipients ? leads : null,
89359
- onPickRecipient: enableLeadRecipients ? handleRecipientChange : null
89324
+ onPickRecipient: enableLeadRecipients ? handleRecipientChange : null,
89325
+ recipientPicker: enableLeadRecipients ? /*#__PURE__*/jsxRuntime.jsx(RecipientPicker, {
89326
+ leads: leads,
89327
+ recipient: recipient,
89328
+ onChange: handleRecipientChange,
89329
+ disabled: isLoading
89330
+ }) : null
89360
89331
  })]
89361
89332
  });
89362
89333
  }