@trops/dash-core 0.1.601 → 0.1.603

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
@@ -6537,7 +6537,7 @@ var FolderDetail = function FolderDetail(_ref) {
6537
6537
  });
6538
6538
  };
6539
6539
 
6540
- var OptionCard$2 = function OptionCard(_ref) {
6540
+ var OptionCard$3 = function OptionCard(_ref) {
6541
6541
  var icon = _ref.icon,
6542
6542
  title = _ref.title,
6543
6543
  description = _ref.description,
@@ -6586,28 +6586,28 @@ var CreationMethodPicker = function CreationMethodPicker(_ref2) {
6586
6586
  })]
6587
6587
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
6588
6588
  className: "flex flex-col w-2/3 p-6 pt-10 space-y-3",
6589
- children: [/*#__PURE__*/jsxRuntime.jsx(OptionCard$2, {
6589
+ children: [/*#__PURE__*/jsxRuntime.jsx(OptionCard$3, {
6590
6590
  icon: "plus",
6591
6591
  title: "New Dashboard",
6592
6592
  description: "Start from a blank template and customize your layout",
6593
6593
  onClick: function onClick() {
6594
6594
  return onSelect("template");
6595
6595
  }
6596
- }), /*#__PURE__*/jsxRuntime.jsx(OptionCard$2, {
6596
+ }), /*#__PURE__*/jsxRuntime.jsx(OptionCard$3, {
6597
6597
  icon: "file-zipper",
6598
6598
  title: "Import from File",
6599
6599
  description: "Import a dashboard from a .zip file on your computer",
6600
6600
  onClick: function onClick() {
6601
6601
  return onSelect("import");
6602
6602
  }
6603
- }), /*#__PURE__*/jsxRuntime.jsx(OptionCard$2, {
6603
+ }), /*#__PURE__*/jsxRuntime.jsx(OptionCard$3, {
6604
6604
  icon: "compass",
6605
6605
  title: "Search Registry",
6606
6606
  description: "Browse and install dashboards from the online registry",
6607
6607
  onClick: function onClick() {
6608
6608
  return onSelect("registry");
6609
6609
  }
6610
- }), /*#__PURE__*/jsxRuntime.jsx(OptionCard$2, {
6610
+ }), /*#__PURE__*/jsxRuntime.jsx(OptionCard$3, {
6611
6611
  icon: "wand-magic-sparkles",
6612
6612
  title: "Dashboard Wizard",
6613
6613
  description: "Guided setup \u2014 pick categories, providers, and widgets step by step",
@@ -41733,6 +41733,94 @@ var DashboardDetail = function DashboardDetail(_ref2) {
41733
41733
  });
41734
41734
  };
41735
41735
 
41736
+ var OptionCard$2 = function OptionCard(_ref) {
41737
+ var icon = _ref.icon,
41738
+ title = _ref.title,
41739
+ description = _ref.description,
41740
+ onClick = _ref.onClick,
41741
+ currentTheme = _ref.currentTheme;
41742
+ return /*#__PURE__*/jsxRuntime.jsxs("button", {
41743
+ type: "button",
41744
+ onClick: onClick,
41745
+ className: "w-full flex flex-row items-center gap-4 p-4 rounded-lg text-left transition-opacity ".concat(currentTheme["bg-primary-medium"] || "bg-white/5", " hover:opacity-80"),
41746
+ children: [/*#__PURE__*/jsxRuntime.jsx("div", {
41747
+ className: "flex-shrink-0 h-8 w-8 flex items-center justify-center opacity-60",
41748
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
41749
+ icon: icon,
41750
+ className: "h-5 w-5"
41751
+ })
41752
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
41753
+ className: "flex flex-col min-w-0",
41754
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
41755
+ className: "text-sm font-medium",
41756
+ children: title
41757
+ }), /*#__PURE__*/jsxRuntime.jsx("span", {
41758
+ className: "text-xs opacity-50 mt-0.5",
41759
+ children: description
41760
+ })]
41761
+ }), /*#__PURE__*/jsxRuntime.jsx("div", {
41762
+ className: "flex-shrink-0 ml-auto opacity-30",
41763
+ children: /*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
41764
+ icon: "chevron-right",
41765
+ className: "h-3 w-3"
41766
+ })
41767
+ })]
41768
+ });
41769
+ };
41770
+
41771
+ /**
41772
+ * NewDashboardChooser — consolidated entry point for the
41773
+ * "New Dashboard" header button in Settings → Dashboards.
41774
+ *
41775
+ * Audit #19 fix: the prior header button was labeled "Marketplace"
41776
+ * which was ambiguous (it set installMode=marketplace, duplicating
41777
+ * the Marketplace tab in the list). Renamed to "New Dashboard"; the
41778
+ * chooser presents the actual creation paths as labeled cards,
41779
+ * matching the ThemeNewChooser pattern.
41780
+ *
41781
+ * Options:
41782
+ * - "marketplace" → registry browser (existing DiscoverDashboardsDetail)
41783
+ * - "wizard" → existing dashboard creation wizard
41784
+ *
41785
+ * The Marketplace TAB in the list view stays — it's the in-place
41786
+ * browse affordance, distinct from this "I want to create a new
41787
+ * dashboard" entry.
41788
+ */
41789
+ var NewDashboardChooser = function NewDashboardChooser(_ref2) {
41790
+ var onSelect = _ref2.onSelect;
41791
+ var _useContext = React.useContext(DashReact.ThemeContext),
41792
+ currentTheme = _useContext.currentTheme;
41793
+ var panelStyles = DashReact.getStylesForItem(DashReact.themeObjects.PANEL, currentTheme, {
41794
+ grow: false
41795
+ });
41796
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
41797
+ className: "flex flex-col flex-1 min-h-0",
41798
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
41799
+ className: "flex-1 overflow-y-auto p-6 space-y-3 ".concat(panelStyles.textColor || "text-gray-200"),
41800
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
41801
+ className: "text-xs font-semibold opacity-50 block mb-4",
41802
+ children: "CREATE A DASHBOARD"
41803
+ }), /*#__PURE__*/jsxRuntime.jsx(OptionCard$2, {
41804
+ icon: "compass",
41805
+ title: "Search Marketplace",
41806
+ description: "Browse and install community dashboards from the online registry",
41807
+ onClick: function onClick() {
41808
+ return onSelect("marketplace");
41809
+ },
41810
+ currentTheme: currentTheme
41811
+ }), /*#__PURE__*/jsxRuntime.jsx(OptionCard$2, {
41812
+ icon: "wand-magic-sparkles",
41813
+ title: "From Wizard",
41814
+ description: "Build a new dashboard from a layout + theme + widgets",
41815
+ onClick: function onClick() {
41816
+ return onSelect("wizard");
41817
+ },
41818
+ currentTheme: currentTheme
41819
+ })]
41820
+ })
41821
+ });
41822
+ };
41823
+
41736
41824
  function ownKeys$x(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; }
41737
41825
  function _objectSpread$x(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$x(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$x(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
41738
41826
  var DashboardsSection = function DashboardsSection(_ref) {
@@ -41778,7 +41866,9 @@ var DashboardsSection = function DashboardsSection(_ref) {
41778
41866
  _useState10 = _slicedToArray(_useState1, 2),
41779
41867
  viewMode = _useState10[0],
41780
41868
  setViewMode = _useState10[1];
41781
- // null | "marketplace"
41869
+ // null | "picker" | "marketplace"
41870
+ // picker — NewDashboardChooser (Phase 19 / audit #19)
41871
+ // marketplace — DiscoverDashboardsDetail (registry browser)
41782
41872
  var _useState11 = React.useState(null),
41783
41873
  _useState12 = _slicedToArray(_useState11, 2),
41784
41874
  installMode = _useState12[0],
@@ -41864,12 +41954,16 @@ var DashboardsSection = function DashboardsSection(_ref) {
41864
41954
  });
41865
41955
  }
41866
41956
 
41867
- // Respond to external create trigger from header button (marketplace)
41957
+ // Respond to external create trigger from the "New Dashboard"
41958
+ // header button. Audit #19: this now opens the consolidated
41959
+ // NewDashboardChooser (Marketplace + Wizard cards), matching the
41960
+ // ThemeNewChooser pattern. Pre-fix this went straight to
41961
+ // installMode="marketplace" which made the button ambiguous.
41868
41962
  var prevCreateRequested = React.useRef(false);
41869
41963
  React.useEffect(function () {
41870
41964
  if (createRequested && !prevCreateRequested.current) {
41871
41965
  setSelectedId(null);
41872
- setInstallMode("marketplace");
41966
+ setInstallMode("picker");
41873
41967
  }
41874
41968
  prevCreateRequested.current = createRequested;
41875
41969
  if (createRequested && onCreateAcknowledged) {
@@ -41877,6 +41971,16 @@ var DashboardsSection = function DashboardsSection(_ref) {
41877
41971
  }
41878
41972
  // eslint-disable-next-line react-hooks/exhaustive-deps
41879
41973
  }, [createRequested]);
41974
+ function handleChooserSelect(option) {
41975
+ if (option === "marketplace") {
41976
+ setInstallMode("marketplace");
41977
+ } else if (option === "wizard") {
41978
+ // onOpenWizard closes the Settings modal and opens the
41979
+ // dashboard wizard. Provided by AppSettingsModal.
41980
+ setInstallMode(null);
41981
+ if (typeof onOpenWizard === "function") onOpenWizard();
41982
+ }
41983
+ }
41880
41984
  var selectedWorkspace = workspaces.find(function (ws) {
41881
41985
  return ws.id === selectedId;
41882
41986
  });
@@ -41988,7 +42092,11 @@ var DashboardsSection = function DashboardsSection(_ref) {
41988
42092
  })]
41989
42093
  });
41990
42094
  var detailContent = null;
41991
- if (installMode === "marketplace") {
42095
+ if (installMode === "picker") {
42096
+ detailContent = /*#__PURE__*/jsxRuntime.jsx(NewDashboardChooser, {
42097
+ onSelect: handleChooserSelect
42098
+ });
42099
+ } else if (installMode === "marketplace") {
41992
42100
  detailContent = /*#__PURE__*/jsxRuntime.jsx(DiscoverDashboardsDetail, {
41993
42101
  onBack: function onBack() {
41994
42102
  setInstallMode(null);
@@ -48521,12 +48629,15 @@ var OptionCard = function OptionCard(_ref) {
48521
48629
  };
48522
48630
 
48523
48631
  /**
48524
- * InstallWidgetPicker — the 3-option menu shown when "Install Widgets" is clicked.
48632
+ * InstallWidgetPicker — the consolidated chooser shown when the
48633
+ * "New Widget" header button is clicked (audit #19).
48525
48634
  *
48526
48635
  * Options:
48527
- * 1. Search for Widgets (registry browser)
48528
- * 2. Install from File (.zip)
48529
- * 3. Load from Folder
48636
+ * 1. Use Widget Builder (Phase 19 — folds the inline "+ New Widget"
48637
+ * button's function into the chooser so there's one entry point)
48638
+ * 2. Search for Widgets (registry browser)
48639
+ * 3. Install from File (.zip)
48640
+ * 4. Load from Folder
48530
48641
  */
48531
48642
  var InstallWidgetPicker = function InstallWidgetPicker(_ref2) {
48532
48643
  var onSelect = _ref2.onSelect;
@@ -48541,7 +48652,15 @@ var InstallWidgetPicker = function InstallWidgetPicker(_ref2) {
48541
48652
  className: "flex-1 overflow-y-auto p-6 space-y-3 ".concat(panelStyles.textColor || "text-gray-200"),
48542
48653
  children: [/*#__PURE__*/jsxRuntime.jsx("span", {
48543
48654
  className: "text-xs font-semibold opacity-50 block mb-4",
48544
- children: "HOW TO INSTALL"
48655
+ children: "CREATE A WIDGET"
48656
+ }), /*#__PURE__*/jsxRuntime.jsx(OptionCard, {
48657
+ icon: "wand-magic-sparkles",
48658
+ title: "Use Widget Builder",
48659
+ description: "Open the AI Widget Builder to create a new widget from scratch",
48660
+ onClick: function onClick() {
48661
+ return onSelect("builder");
48662
+ },
48663
+ currentTheme: currentTheme
48545
48664
  }), /*#__PURE__*/jsxRuntime.jsx(OptionCard, {
48546
48665
  icon: "compass",
48547
48666
  title: "Search for Widgets",
@@ -49833,7 +49952,14 @@ var WidgetsSection = function WidgetsSection(_ref) {
49833
49952
  setProgressComplete(false);
49834
49953
  }
49835
49954
  function handlePickerSelect(option) {
49836
- if (option === "discover") {
49955
+ if (option === "builder") {
49956
+ // Audit #19: the inline "+ New Widget" button was removed in
49957
+ // favor of this card so there's a single entry point for new-
49958
+ // widget creation. Closes the picker and fires the same event
49959
+ // the inline button used to dispatch.
49960
+ setInstallMode(null);
49961
+ window.dispatchEvent(new Event("dash:open-widget-builder"));
49962
+ } else if (option === "discover") {
49837
49963
  setInstallMode("discover");
49838
49964
  } else if (option === "zip") {
49839
49965
  handleInstallFromZip();
@@ -49931,23 +50057,7 @@ var WidgetsSection = function WidgetsSection(_ref) {
49931
50057
  }
49932
50058
  var listContent = /*#__PURE__*/jsxRuntime.jsxs("div", {
49933
50059
  className: "flex flex-col h-full",
49934
- children: [/*#__PURE__*/jsxRuntime.jsx("div", {
49935
- className: "flex-shrink-0 px-3 pt-2 pb-1",
49936
- children: /*#__PURE__*/jsxRuntime.jsxs("button", {
49937
- type: "button",
49938
- onClick: function onClick() {
49939
- return window.dispatchEvent(new Event("dash:open-widget-builder"));
49940
- },
49941
- className: "w-full flex items-center justify-center gap-2 px-3 py-2 text-sm font-medium rounded bg-indigo-600 hover:bg-indigo-500 text-white",
49942
- "data-testid": "widgets-section-new-widget-button",
49943
- children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
49944
- icon: "plus",
49945
- className: "text-xs"
49946
- }), /*#__PURE__*/jsxRuntime.jsx("span", {
49947
- children: "New Widget"
49948
- })]
49949
- })
49950
- }), isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
50060
+ children: [isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxRuntime.jsxs("div", {
49951
50061
  className: "flex-shrink-0 px-3 py-2 border-b border-white/10 bg-gray-800/60 flex items-center gap-2 text-xs text-gray-400",
49952
50062
  "data-testid": "widgets-section-checking-updates",
49953
50063
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.FontAwesomeIcon, {
@@ -54583,7 +54693,7 @@ var AppSettingsModal = function AppSettingsModal(_ref) {
54583
54693
  padding: false
54584
54694
  }), (activeSection === "dashboards" || activeSection === "folders" || activeSection === "providers" || activeSection === "themes" || activeSection === "widgets") && /*#__PURE__*/jsxRuntime.jsx(DashReact.ButtonIcon3, {
54585
54695
  icon: "plus",
54586
- text: activeSection === "dashboards" ? "Marketplace" : activeSection === "folders" ? "New Folder" : activeSection === "providers" ? "New Provider" : activeSection === "widgets" ? "Install Widgets" : "New Theme",
54696
+ text: activeSection === "dashboards" ? "New Dashboard" : activeSection === "folders" ? "New Folder" : activeSection === "providers" ? "New Provider" : activeSection === "widgets" ? "New Widget" : "New Theme",
54587
54697
  onClick: function onClick() {
54588
54698
  return setCreateRequested(true);
54589
54699
  },