@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.esm.js CHANGED
@@ -2,7 +2,7 @@ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
2
2
  import _typeof from '@babel/runtime/helpers/typeof';
3
3
  import _defineProperty from '@babel/runtime/helpers/defineProperty';
4
4
  import * as DashReact from '@trops/dash-react';
5
- import { isObject, ThemeContext, FontAwesomeIcon, Modal, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, Tag, Button3, Button2, Paragraph, Sidebar, Panel, Stepper, Tag3, Card2, Card3, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, SelectInput, CodeEditorVS, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, ButtonIcon2, DropdownPanel, MenuItem2, useStatusTokens, Caption2, ConfirmationModal, DropComponent, DragComponent, getStyleName, capitalizeFirstLetter, isHexColor as isHexColor$1, deriveShades, colorTypes, TAILWIND_PALETTE, Toggle, normalizeHex as normalizeHex$1, contrastRatio, Caption, getColorFamilies, getCuratedColorGrid, DashPanel, hexToRgb as hexToRgb$1, themeVariants, SubHeading, Heading2, Paragraph2, Paragraph3, ButtonIcon3, Tag2, Alert, Alert2, Alert3, Toast, Toast2, Toast3, ProgressBar, ProgressBar2, ProgressBar3, MenuItem, Breadcrumbs, Breadcrumbs2, Breadcrumbs3, Caption3, Code, Code2, Code3, Divider, Divider2, Divider3, DashPanel2, DashPanel3, Tabs, Tabs2, Tabs3, Accordion, Accordion2, Accordion3, Toggle2, Toggle3, TextArea, Checkbox, Slider, RadioGroup, AlertBanner, StatusBadge as StatusBadge$1, Skeleton, StatCard, DataList, EmptyState, Card, Panel2, ThemeFromUrlPane, AlgoliaSearchBox, CodeEditorInline, Icon2, SectionLabel, SegmentedControl, ChatMessage, ChatComposer, useResizableWidth, ResizeHandle, ChoiceMenu, CommandPalette, useSidebar, FilterMenu, Navbar, withRouter, Menu as Menu$1, ChatToolCall } from '@trops/dash-react';
5
+ import { isObject, ThemeContext, FontAwesomeIcon, Modal, deepCopy, MainSection, getUUID, getStylesForItem, themeObjects, Heading, SearchInput, ButtonIcon, SubHeading3, InputText, Button, Tag, Button3, Button2, Paragraph, Sidebar, Panel, Stepper, Tag3, Card2, Card3, Heading3, MenuItem3, FormLabel, SelectMenu, Switch, SelectInput, CodeEditorVS, SettingsModal, SubHeading2, tailwindHeightFractions, Menu3, Panel3, ButtonIcon2, DropdownPanel, MenuItem2, useStatusTokens, Caption2, ConfirmationModal, DropComponent, DragComponent, getStyleName, capitalizeFirstLetter, isHexColor as isHexColor$1, deriveShades, colorTypes, TAILWIND_PALETTE, Toggle, normalizeHex as normalizeHex$1, contrastRatio, Caption, getColorFamilies, getCuratedColorGrid, DashPanel, hexToRgb as hexToRgb$1, themeVariants, SubHeading, Heading2, Paragraph2, Paragraph3, ButtonIcon3, Tag2, Alert, Alert2, Alert3, Toast, Toast2, Toast3, ProgressBar, ProgressBar2, ProgressBar3, MenuItem, Breadcrumbs, Breadcrumbs2, Breadcrumbs3, Caption3, Code, Code2, Code3, Divider, Divider2, Divider3, DashPanel2, DashPanel3, Tabs, Tabs2, Tabs3, Accordion, Accordion2, Accordion3, Toggle2, Toggle3, TextArea, Checkbox, Slider, RadioGroup, AlertBanner, StatusBadge as StatusBadge$1, Skeleton, StatCard, DataList, EmptyState, Card, Panel2, ThemeFromUrlPane, AlgoliaSearchBox, CodeEditorInline, Icon2, SectionLabel, SegmentedControl, ChatMessage, ChatComposer, ListRow, useResizableWidth, ResizeHandle, PanelHeader, ChoiceMenu, CommandPalette, useSidebar, FilterMenu, Navbar, withRouter, Menu as Menu$1, ChatToolCall } from '@trops/dash-react';
6
6
  export * from '@trops/dash-react';
7
7
  export { FontAwesomeIcon, ThemeContext } from '@trops/dash-react';
8
8
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
@@ -57935,56 +57935,30 @@ var ICONS = {
57935
57935
  "widget-draft": "pen-to-square"
57936
57936
  };
57937
57937
 
57938
- /** One row: icon, title, then status · age underneath — left-aligned. */
57938
+ /**
57939
+ * One row (dash-react ListRow — design guide "List rows"): icon, title, then
57940
+ * status · age underneath; Remove (×) shows on hover, outside the row button.
57941
+ */
57939
57942
  var RecentRow = function RecentRow(_ref) {
57940
57943
  var row = _ref.row,
57941
57944
  onOpen = _ref.onOpen,
57942
57945
  onRemove = _ref.onRemove;
57943
- var _useConfigTokens = useConfigTokens(),
57944
- muted = _useConfigTokens.muted,
57945
- strong = _useConfigTokens.strong;
57946
- return /*#__PURE__*/jsxs("div", {
57947
- className: "flex flex-row items-center gap-2",
57948
- "data-testid": "recent-row",
57949
- children: [/*#__PURE__*/jsx("div", {
57950
- className: "flex-1 min-w-0",
57951
- children: /*#__PURE__*/jsx(Button3, {
57952
- size: "sm",
57953
- block: true,
57954
- onClick: function onClick() {
57955
- return onOpen(row);
57956
- },
57957
- children: /*#__PURE__*/jsxs("span", {
57958
- className: "flex flex-row items-start gap-2 w-full text-left"
57959
- // Buttons don't wrap or left-align their text; a row must.
57960
- ,
57961
- style: {
57962
- whiteSpace: "normal",
57963
- minWidth: 0
57964
- },
57965
- "aria-label": recentLine(row),
57966
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
57967
- icon: ICONS[row.kind] || "pen-to-square",
57968
- className: "h-3.5 w-3.5 mt-0.5 flex-shrink-0"
57969
- }), /*#__PURE__*/jsxs("span", {
57970
- className: "flex flex-col min-w-0",
57971
- children: [/*#__PURE__*/jsx("span", {
57972
- className: "truncate ".concat(strong),
57973
- children: row.title
57974
- }), /*#__PURE__*/jsxs("span", {
57975
- className: "text-xs ".concat(muted),
57976
- children: [row.status, " \xB7 ", draftAge(row.updatedAt)]
57977
- })]
57978
- })]
57979
- })
57980
- })
57981
- }), onRemove && row.kind !== "widget-draft" ? /*#__PURE__*/jsx(ButtonIcon, {
57946
+ return /*#__PURE__*/jsx(ListRow, {
57947
+ testId: "recent-row",
57948
+ icon: ICONS[row.kind] || "pen-to-square",
57949
+ title: row.title,
57950
+ meta: "".concat(row.status, " \xB7 ").concat(draftAge(row.updatedAt)),
57951
+ ariaLabel: recentLine(row),
57952
+ onClick: function onClick() {
57953
+ return onOpen(row);
57954
+ },
57955
+ trailing: onRemove && row.kind !== "widget-draft" ? /*#__PURE__*/jsx(ButtonIcon, {
57982
57956
  icon: "xmark",
57983
57957
  ariaLabel: "Remove ".concat(row.title, " from Recent"),
57984
57958
  onClick: function onClick() {
57985
57959
  return onRemove(row);
57986
57960
  }
57987
- }) : null]
57961
+ }) : null
57988
57962
  });
57989
57963
  };
57990
57964
 
@@ -58734,7 +58708,10 @@ var AskStep = function AskStep(_ref) {
58734
58708
  return send(reply);
58735
58709
  },
58736
58710
  busy: busy,
58737
- placeholder: busy ? "The Planner is looking…" : "Ask a follow-up…",
58711
+ placeholder: busy ? "The Planner is looking…" : "Ask a follow-up…"
58712
+ // Same word as the dock's first question (one label per action).
58713
+ ,
58714
+ sendLabel: "Ask",
58738
58715
  className: "flex-shrink-0"
58739
58716
  })]
58740
58717
  });
@@ -58760,8 +58737,6 @@ var CreateDockPanel = function CreateDockPanel(_ref) {
58760
58737
  _ref$onCollapse = _ref.onCollapse,
58761
58738
  onCollapse = _ref$onCollapse === void 0 ? null : _ref$onCollapse;
58762
58739
  var _useConfigTokens = useConfigTokens(),
58763
- muted = _useConfigTokens.muted,
58764
- strong = _useConfigTokens.strong,
58765
58740
  hairline = _useConfigTokens.hairline;
58766
58741
  // { recentId, title, kind?: "question", question? } — the conversation
58767
58742
  // folded here (a new question has no recentId yet), or null (Recent).
@@ -58782,7 +58757,8 @@ var CreateDockPanel = function CreateDockPanel(_ref) {
58782
58757
  drafts = _useState8[0],
58783
58758
  setDrafts = _useState8[1];
58784
58759
  var _useResizableWidth = useResizableWidth({
58785
- defaultWidth: 420,
58760
+ // Same default as the AI Assistant and Bot Activity docks.
58761
+ defaultWidth: 384,
58786
58762
  min: 340,
58787
58763
  max: 720,
58788
58764
  edge: "left",
@@ -58862,6 +58838,24 @@ var CreateDockPanel = function CreateDockPanel(_ref) {
58862
58838
  var sections = recentSections(plans, drafts, {
58863
58839
  conversations: 12
58864
58840
  });
58841
+ var hasRecent = sections.conversations.length + sections.drafts.length > 0;
58842
+ // A secondary button, not a link: it leaves the dock for Create full size.
58843
+ var makeNew = /*#__PURE__*/jsx(Button2, {
58844
+ size: "sm",
58845
+ onClick: function onClick() {
58846
+ return openCreate({
58847
+ type: "dashboard"
58848
+ });
58849
+ },
58850
+ ariaLabel: "Make something new \u2014 opens Create full size",
58851
+ children: /*#__PURE__*/jsxs("span", {
58852
+ className: "inline-flex items-center gap-2",
58853
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
58854
+ icon: "up-right-and-down-left-from-center",
58855
+ className: "h-3 w-3"
58856
+ }), "Make something new\u2026"]
58857
+ })
58858
+ });
58865
58859
  var askNow = function askNow() {
58866
58860
  var q = asking.trim();
58867
58861
  if (!q) return;
@@ -58890,29 +58884,24 @@ var CreateDockPanel = function CreateDockPanel(_ref) {
58890
58884
  "aria-label": "Create",
58891
58885
  children: [/*#__PURE__*/jsx(ResizeHandle, _objectSpread$E(_objectSpread$E({}, handleProps), {}, {
58892
58886
  ariaLabel: "Resize Create"
58893
- })), /*#__PURE__*/jsxs("div", {
58894
- className: "flex-shrink-0 flex flex-row items-center gap-2 px-3 py-2 border-b ".concat(hairline),
58895
- children: [folded ? /*#__PURE__*/jsx(ButtonIcon, {
58896
- icon: "arrow-left",
58897
- ariaLabel: "Back to Recent",
58898
- onClick: function onClick() {
58899
- return setFolded(null);
58900
- }
58901
- }) : /*#__PURE__*/jsx(FontAwesomeIcon, {
58902
- icon: "plus",
58903
- className: "h-3.5 w-3.5 opacity-70"
58904
- }), /*#__PURE__*/jsx("span", {
58905
- className: "flex-1 min-w-0 truncate text-sm font-semibold ".concat(strong),
58906
- children: folded ? folded.title || (folded.kind === "question" ? "Question" : "Plan a dashboard") : "Create"
58907
- }), folded && folded.kind !== "question" ? /*#__PURE__*/jsx(ButtonIcon, {
58908
- icon: "up-right-and-down-left-from-center",
58909
- ariaLabel: "Expand",
58910
- onClick: expand
58911
- }) : null, onCollapse ? /*#__PURE__*/jsx(ButtonIcon, {
58912
- icon: "xmark",
58913
- ariaLabel: "Close Create panel",
58914
- onClick: onCollapse
58915
- }) : null]
58887
+ })), /*#__PURE__*/jsx(PanelHeader, {
58888
+ testId: "create-dock-header",
58889
+ onBack: folded ? function () {
58890
+ return setFolded(null);
58891
+ } : null,
58892
+ backLabel: "Back to Recent",
58893
+ title: folded ? folded.title || (folded.kind === "question" ? "Question" : "Plan a dashboard") : "Create",
58894
+ actions: /*#__PURE__*/jsxs(Fragment, {
58895
+ children: [folded && folded.kind !== "question" ? /*#__PURE__*/jsx(ButtonIcon, {
58896
+ icon: "up-right-and-down-left-from-center",
58897
+ ariaLabel: "Expand",
58898
+ onClick: expand
58899
+ }) : null, onCollapse ? /*#__PURE__*/jsx(ButtonIcon, {
58900
+ icon: "xmark",
58901
+ ariaLabel: "Close Create panel",
58902
+ onClick: onCollapse
58903
+ }) : null]
58904
+ })
58916
58905
  }), folded && folded.kind === "question" ? /*#__PURE__*/jsx("div", {
58917
58906
  className: "flex-1 min-h-0 flex flex-col",
58918
58907
  children: /*#__PURE__*/jsx(AskStep, {
@@ -58935,59 +58924,32 @@ var CreateDockPanel = function CreateDockPanel(_ref) {
58935
58924
  }
58936
58925
  }, folded.recentId)
58937
58926
  }) : /*#__PURE__*/jsxs("div", {
58938
- className: "flex-1 min-h-0 overflow-y-auto flex flex-col gap-2 p-3",
58939
- "data-testid": "create-dock-recent",
58927
+ className: "flex-1 min-h-0 flex flex-col",
58940
58928
  children: [/*#__PURE__*/jsxs("div", {
58941
- className: "flex flex-col gap-2 pb-2",
58942
- "data-testid": "ask-box",
58943
- children: [/*#__PURE__*/jsx(TextArea, {
58944
- "aria-label": "Ask about your dashboards and bots",
58945
- value: asking,
58946
- onChange: function onChange(v) {
58947
- return setAsking(v);
58948
- },
58949
- placeholder: "Ask about your dashboards and bots \u2014 e.g. what did my bots find today?",
58950
- rows: 2,
58951
- onKeyDown: function onKeyDown(e) {
58952
- if (e.key === "Enter" && !e.shiftKey) {
58953
- e.preventDefault();
58954
- askNow();
58955
- }
58956
- }
58957
- }), /*#__PURE__*/jsx("div", {
58958
- className: "flex flex-row justify-end",
58959
- children: /*#__PURE__*/jsx(Button, {
58960
- size: "sm",
58961
- title: "Ask",
58962
- onClick: askNow,
58963
- disabled: !asking.trim()
58964
- })
58965
- })]
58966
- }), /*#__PURE__*/jsx(RecentList, {
58967
- sections: sections,
58968
- onOpen: openRow,
58969
- empty: /*#__PURE__*/jsx("span", {
58970
- className: "text-sm ".concat(muted),
58971
- children: "Nothing yet. Questions, plans and unfinished widgets show up here."
58972
- })
58973
- }), /*#__PURE__*/jsx("div", {
58974
- className: "pt-2",
58975
- children: /*#__PURE__*/jsx(Button3, {
58976
- size: "sm",
58977
- onClick: function onClick() {
58978
- return openCreate({
58979
- type: "dashboard"
58980
- });
58981
- },
58982
- ariaLabel: "Make something new \u2014 opens Create full size",
58983
- children: /*#__PURE__*/jsxs("span", {
58984
- className: "inline-flex items-center gap-2",
58985
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
58986
- icon: "up-right-and-down-left-from-center",
58987
- className: "h-3 w-3"
58988
- }), "Make something new\u2026"]
58929
+ className: "flex-1 min-h-0 overflow-y-auto flex flex-col gap-4 p-4",
58930
+ "data-testid": "create-dock-recent",
58931
+ children: [/*#__PURE__*/jsx(RecentList, {
58932
+ sections: sections,
58933
+ onOpen: openRow,
58934
+ empty: /*#__PURE__*/jsx(EmptyState, {
58935
+ testId: "create-dock-empty",
58936
+ className: "my-auto",
58937
+ title: "Nothing here yet",
58938
+ description: "Ask about your dashboards and bots below. Questions, plans and unfinished widgets show up here.",
58939
+ children: makeNew
58989
58940
  })
58990
- })
58941
+ }), hasRecent ? /*#__PURE__*/jsx("div", {
58942
+ children: makeNew
58943
+ }) : null]
58944
+ }), /*#__PURE__*/jsx(ChatComposer, {
58945
+ value: asking,
58946
+ onChange: function onChange(v) {
58947
+ return setAsking(v);
58948
+ },
58949
+ onSend: askNow,
58950
+ ariaLabel: "Ask about your dashboards and bots",
58951
+ placeholder: "Ask about your dashboards and bots\u2026",
58952
+ sendLabel: "Ask"
58991
58953
  })]
58992
58954
  })]
58993
58955
  });
@@ -88165,7 +88127,9 @@ var ChatInput = function ChatInput(_ref) {
88165
88127
  _ref$leads = _ref.leads,
88166
88128
  leads = _ref$leads === void 0 ? null : _ref$leads,
88167
88129
  _ref$onPickRecipient = _ref.onPickRecipient,
88168
- onPickRecipient = _ref$onPickRecipient === void 0 ? null : _ref$onPickRecipient;
88130
+ onPickRecipient = _ref$onPickRecipient === void 0 ? null : _ref$onPickRecipient,
88131
+ _ref$recipientPicker = _ref.recipientPicker,
88132
+ recipientPicker = _ref$recipientPicker === void 0 ? null : _ref$recipientPicker;
88169
88133
  var _useState = useState(""),
88170
88134
  _useState2 = _slicedToArray(_useState, 2),
88171
88135
  input = _useState2[0],
@@ -88294,10 +88258,12 @@ var ChatInput = function ChatInput(_ref) {
88294
88258
  rows: 1,
88295
88259
  placeholder: "Type a message...",
88296
88260
  hint: queued ? "Sends when the current reply finishes" : "Enter to send · Shift+Enter for a new line",
88297
- above: mentionOpen ? /*#__PURE__*/jsx(LeadMentionMenu, {
88298
- options: mentionOptions,
88299
- activeIndex: mentionIndex,
88300
- onPick: pickMention
88261
+ above: recipientPicker || mentionOpen ? /*#__PURE__*/jsxs(Fragment, {
88262
+ children: [recipientPicker, mentionOpen ? /*#__PURE__*/jsx(LeadMentionMenu, {
88263
+ options: mentionOptions,
88264
+ activeIndex: mentionIndex,
88265
+ onPick: pickMention
88266
+ }) : null]
88301
88267
  }) : null
88302
88268
  });
88303
88269
  };
@@ -88440,33 +88406,37 @@ var RecipientPicker = function RecipientPicker(_ref) {
88440
88406
  group: "Team leads"
88441
88407
  };
88442
88408
  })));
88443
- return /*#__PURE__*/jsxs("div", {
88444
- className: "flex flex-wrap items-center gap-2 px-3 pt-2",
88445
- children: [/*#__PURE__*/jsx(Caption2, {
88446
- children: "To:"
88447
- }), /*#__PURE__*/jsx(SelectInput, {
88448
- label: "",
88449
- placeholder: "Send to",
88450
- value: recipient ? recipient.botId : ASSISTANT_VALUE,
88451
- options: options,
88452
- disabled: disabled,
88453
- className: "flex-1 min-w-0",
88454
- inputClassName: "text-xs py-1",
88455
- onChange: function onChange(value) {
88456
- if (value === ASSISTANT_VALUE) {
88457
- _onChange(null);
88458
- return;
88409
+ return (
88410
+ /*#__PURE__*/
88411
+ // Inside the message box (ChatInput's `recipientPicker`): the box's own
88412
+ // padding spaces it, so no padding here.
88413
+ jsxs("div", {
88414
+ className: "flex flex-wrap items-center gap-2",
88415
+ children: [/*#__PURE__*/jsx(Caption2, {
88416
+ children: "To:"
88417
+ }), /*#__PURE__*/jsx(SelectInput, {
88418
+ label: "",
88419
+ placeholder: "Send to",
88420
+ value: recipient ? recipient.botId : ASSISTANT_VALUE,
88421
+ options: options,
88422
+ disabled: disabled,
88423
+ className: "flex-1 min-w-0",
88424
+ inputClassName: "text-sm py-1",
88425
+ onChange: function onChange(value) {
88426
+ if (value === ASSISTANT_VALUE) {
88427
+ _onChange(null);
88428
+ return;
88429
+ }
88430
+ var lead = leads.find(function (l) {
88431
+ return l.botId === value;
88432
+ });
88433
+ if (lead) _onChange(lead);
88459
88434
  }
88460
- var lead = leads.find(function (l) {
88461
- return l.botId === value;
88462
- });
88463
- if (lead) _onChange(lead);
88464
- }
88465
- }), leads.length === 0 && /*#__PURE__*/jsx(Caption2, {
88466
- className: "opacity-70",
88467
- children: "No team leads yet \u2014 turn one on in a dashboard's Bots view."
88468
- })]
88469
- });
88435
+ }), leads.length === 0 && /*#__PURE__*/jsx(Caption2, {
88436
+ children: "No team leads yet \u2014 turn one on in a dashboard's Bots view."
88437
+ })]
88438
+ })
88439
+ );
88470
88440
  };
88471
88441
 
88472
88442
  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; }
@@ -89324,11 +89294,6 @@ function ChatCore(_ref) {
89324
89294
  return setLeadNotice(null);
89325
89295
  }
89326
89296
  })
89327
- }), enableLeadRecipients && /*#__PURE__*/jsx(RecipientPicker, {
89328
- leads: leads,
89329
- recipient: recipient,
89330
- onChange: handleRecipientChange,
89331
- disabled: isLoading
89332
89297
  }), /*#__PURE__*/jsx(ChatInput, {
89333
89298
  onSend: handleSend,
89334
89299
  onStop: handleStop,
@@ -89338,7 +89303,13 @@ function ChatCore(_ref) {
89338
89303
  // elsewhere "@" stays plain text (TEAM-013 AC6).
89339
89304
  ,
89340
89305
  leads: enableLeadRecipients ? leads : null,
89341
- onPickRecipient: enableLeadRecipients ? handleRecipientChange : null
89306
+ onPickRecipient: enableLeadRecipients ? handleRecipientChange : null,
89307
+ recipientPicker: enableLeadRecipients ? /*#__PURE__*/jsx(RecipientPicker, {
89308
+ leads: leads,
89309
+ recipient: recipient,
89310
+ onChange: handleRecipientChange,
89311
+ disabled: isLoading
89312
+ }) : null
89342
89313
  })]
89343
89314
  });
89344
89315
  }