@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.esm.js CHANGED
@@ -6519,7 +6519,7 @@ var FolderDetail = function FolderDetail(_ref) {
6519
6519
  });
6520
6520
  };
6521
6521
 
6522
- var OptionCard$2 = function OptionCard(_ref) {
6522
+ var OptionCard$3 = function OptionCard(_ref) {
6523
6523
  var icon = _ref.icon,
6524
6524
  title = _ref.title,
6525
6525
  description = _ref.description,
@@ -6568,28 +6568,28 @@ var CreationMethodPicker = function CreationMethodPicker(_ref2) {
6568
6568
  })]
6569
6569
  }), /*#__PURE__*/jsxs("div", {
6570
6570
  className: "flex flex-col w-2/3 p-6 pt-10 space-y-3",
6571
- children: [/*#__PURE__*/jsx(OptionCard$2, {
6571
+ children: [/*#__PURE__*/jsx(OptionCard$3, {
6572
6572
  icon: "plus",
6573
6573
  title: "New Dashboard",
6574
6574
  description: "Start from a blank template and customize your layout",
6575
6575
  onClick: function onClick() {
6576
6576
  return onSelect("template");
6577
6577
  }
6578
- }), /*#__PURE__*/jsx(OptionCard$2, {
6578
+ }), /*#__PURE__*/jsx(OptionCard$3, {
6579
6579
  icon: "file-zipper",
6580
6580
  title: "Import from File",
6581
6581
  description: "Import a dashboard from a .zip file on your computer",
6582
6582
  onClick: function onClick() {
6583
6583
  return onSelect("import");
6584
6584
  }
6585
- }), /*#__PURE__*/jsx(OptionCard$2, {
6585
+ }), /*#__PURE__*/jsx(OptionCard$3, {
6586
6586
  icon: "compass",
6587
6587
  title: "Search Registry",
6588
6588
  description: "Browse and install dashboards from the online registry",
6589
6589
  onClick: function onClick() {
6590
6590
  return onSelect("registry");
6591
6591
  }
6592
- }), /*#__PURE__*/jsx(OptionCard$2, {
6592
+ }), /*#__PURE__*/jsx(OptionCard$3, {
6593
6593
  icon: "wand-magic-sparkles",
6594
6594
  title: "Dashboard Wizard",
6595
6595
  description: "Guided setup \u2014 pick categories, providers, and widgets step by step",
@@ -41715,6 +41715,94 @@ var DashboardDetail = function DashboardDetail(_ref2) {
41715
41715
  });
41716
41716
  };
41717
41717
 
41718
+ var OptionCard$2 = function OptionCard(_ref) {
41719
+ var icon = _ref.icon,
41720
+ title = _ref.title,
41721
+ description = _ref.description,
41722
+ onClick = _ref.onClick,
41723
+ currentTheme = _ref.currentTheme;
41724
+ return /*#__PURE__*/jsxs("button", {
41725
+ type: "button",
41726
+ onClick: onClick,
41727
+ 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"),
41728
+ children: [/*#__PURE__*/jsx("div", {
41729
+ className: "flex-shrink-0 h-8 w-8 flex items-center justify-center opacity-60",
41730
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
41731
+ icon: icon,
41732
+ className: "h-5 w-5"
41733
+ })
41734
+ }), /*#__PURE__*/jsxs("div", {
41735
+ className: "flex flex-col min-w-0",
41736
+ children: [/*#__PURE__*/jsx("span", {
41737
+ className: "text-sm font-medium",
41738
+ children: title
41739
+ }), /*#__PURE__*/jsx("span", {
41740
+ className: "text-xs opacity-50 mt-0.5",
41741
+ children: description
41742
+ })]
41743
+ }), /*#__PURE__*/jsx("div", {
41744
+ className: "flex-shrink-0 ml-auto opacity-30",
41745
+ children: /*#__PURE__*/jsx(FontAwesomeIcon, {
41746
+ icon: "chevron-right",
41747
+ className: "h-3 w-3"
41748
+ })
41749
+ })]
41750
+ });
41751
+ };
41752
+
41753
+ /**
41754
+ * NewDashboardChooser — consolidated entry point for the
41755
+ * "New Dashboard" header button in Settings → Dashboards.
41756
+ *
41757
+ * Audit #19 fix: the prior header button was labeled "Marketplace"
41758
+ * which was ambiguous (it set installMode=marketplace, duplicating
41759
+ * the Marketplace tab in the list). Renamed to "New Dashboard"; the
41760
+ * chooser presents the actual creation paths as labeled cards,
41761
+ * matching the ThemeNewChooser pattern.
41762
+ *
41763
+ * Options:
41764
+ * - "marketplace" → registry browser (existing DiscoverDashboardsDetail)
41765
+ * - "wizard" → existing dashboard creation wizard
41766
+ *
41767
+ * The Marketplace TAB in the list view stays — it's the in-place
41768
+ * browse affordance, distinct from this "I want to create a new
41769
+ * dashboard" entry.
41770
+ */
41771
+ var NewDashboardChooser = function NewDashboardChooser(_ref2) {
41772
+ var onSelect = _ref2.onSelect;
41773
+ var _useContext = useContext(ThemeContext),
41774
+ currentTheme = _useContext.currentTheme;
41775
+ var panelStyles = getStylesForItem(themeObjects.PANEL, currentTheme, {
41776
+ grow: false
41777
+ });
41778
+ return /*#__PURE__*/jsx("div", {
41779
+ className: "flex flex-col flex-1 min-h-0",
41780
+ children: /*#__PURE__*/jsxs("div", {
41781
+ className: "flex-1 overflow-y-auto p-6 space-y-3 ".concat(panelStyles.textColor || "text-gray-200"),
41782
+ children: [/*#__PURE__*/jsx("span", {
41783
+ className: "text-xs font-semibold opacity-50 block mb-4",
41784
+ children: "CREATE A DASHBOARD"
41785
+ }), /*#__PURE__*/jsx(OptionCard$2, {
41786
+ icon: "compass",
41787
+ title: "Search Marketplace",
41788
+ description: "Browse and install community dashboards from the online registry",
41789
+ onClick: function onClick() {
41790
+ return onSelect("marketplace");
41791
+ },
41792
+ currentTheme: currentTheme
41793
+ }), /*#__PURE__*/jsx(OptionCard$2, {
41794
+ icon: "wand-magic-sparkles",
41795
+ title: "From Wizard",
41796
+ description: "Build a new dashboard from a layout + theme + widgets",
41797
+ onClick: function onClick() {
41798
+ return onSelect("wizard");
41799
+ },
41800
+ currentTheme: currentTheme
41801
+ })]
41802
+ })
41803
+ });
41804
+ };
41805
+
41718
41806
  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; }
41719
41807
  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; }
41720
41808
  var DashboardsSection = function DashboardsSection(_ref) {
@@ -41760,7 +41848,9 @@ var DashboardsSection = function DashboardsSection(_ref) {
41760
41848
  _useState10 = _slicedToArray(_useState1, 2),
41761
41849
  viewMode = _useState10[0],
41762
41850
  setViewMode = _useState10[1];
41763
- // null | "marketplace"
41851
+ // null | "picker" | "marketplace"
41852
+ // picker — NewDashboardChooser (Phase 19 / audit #19)
41853
+ // marketplace — DiscoverDashboardsDetail (registry browser)
41764
41854
  var _useState11 = useState(null),
41765
41855
  _useState12 = _slicedToArray(_useState11, 2),
41766
41856
  installMode = _useState12[0],
@@ -41846,12 +41936,16 @@ var DashboardsSection = function DashboardsSection(_ref) {
41846
41936
  });
41847
41937
  }
41848
41938
 
41849
- // Respond to external create trigger from header button (marketplace)
41939
+ // Respond to external create trigger from the "New Dashboard"
41940
+ // header button. Audit #19: this now opens the consolidated
41941
+ // NewDashboardChooser (Marketplace + Wizard cards), matching the
41942
+ // ThemeNewChooser pattern. Pre-fix this went straight to
41943
+ // installMode="marketplace" which made the button ambiguous.
41850
41944
  var prevCreateRequested = useRef(false);
41851
41945
  useEffect(function () {
41852
41946
  if (createRequested && !prevCreateRequested.current) {
41853
41947
  setSelectedId(null);
41854
- setInstallMode("marketplace");
41948
+ setInstallMode("picker");
41855
41949
  }
41856
41950
  prevCreateRequested.current = createRequested;
41857
41951
  if (createRequested && onCreateAcknowledged) {
@@ -41859,6 +41953,16 @@ var DashboardsSection = function DashboardsSection(_ref) {
41859
41953
  }
41860
41954
  // eslint-disable-next-line react-hooks/exhaustive-deps
41861
41955
  }, [createRequested]);
41956
+ function handleChooserSelect(option) {
41957
+ if (option === "marketplace") {
41958
+ setInstallMode("marketplace");
41959
+ } else if (option === "wizard") {
41960
+ // onOpenWizard closes the Settings modal and opens the
41961
+ // dashboard wizard. Provided by AppSettingsModal.
41962
+ setInstallMode(null);
41963
+ if (typeof onOpenWizard === "function") onOpenWizard();
41964
+ }
41965
+ }
41862
41966
  var selectedWorkspace = workspaces.find(function (ws) {
41863
41967
  return ws.id === selectedId;
41864
41968
  });
@@ -41970,7 +42074,11 @@ var DashboardsSection = function DashboardsSection(_ref) {
41970
42074
  })]
41971
42075
  });
41972
42076
  var detailContent = null;
41973
- if (installMode === "marketplace") {
42077
+ if (installMode === "picker") {
42078
+ detailContent = /*#__PURE__*/jsx(NewDashboardChooser, {
42079
+ onSelect: handleChooserSelect
42080
+ });
42081
+ } else if (installMode === "marketplace") {
41974
42082
  detailContent = /*#__PURE__*/jsx(DiscoverDashboardsDetail, {
41975
42083
  onBack: function onBack() {
41976
42084
  setInstallMode(null);
@@ -48503,12 +48611,15 @@ var OptionCard = function OptionCard(_ref) {
48503
48611
  };
48504
48612
 
48505
48613
  /**
48506
- * InstallWidgetPicker — the 3-option menu shown when "Install Widgets" is clicked.
48614
+ * InstallWidgetPicker — the consolidated chooser shown when the
48615
+ * "New Widget" header button is clicked (audit #19).
48507
48616
  *
48508
48617
  * Options:
48509
- * 1. Search for Widgets (registry browser)
48510
- * 2. Install from File (.zip)
48511
- * 3. Load from Folder
48618
+ * 1. Use Widget Builder (Phase 19 — folds the inline "+ New Widget"
48619
+ * button's function into the chooser so there's one entry point)
48620
+ * 2. Search for Widgets (registry browser)
48621
+ * 3. Install from File (.zip)
48622
+ * 4. Load from Folder
48512
48623
  */
48513
48624
  var InstallWidgetPicker = function InstallWidgetPicker(_ref2) {
48514
48625
  var onSelect = _ref2.onSelect;
@@ -48523,7 +48634,15 @@ var InstallWidgetPicker = function InstallWidgetPicker(_ref2) {
48523
48634
  className: "flex-1 overflow-y-auto p-6 space-y-3 ".concat(panelStyles.textColor || "text-gray-200"),
48524
48635
  children: [/*#__PURE__*/jsx("span", {
48525
48636
  className: "text-xs font-semibold opacity-50 block mb-4",
48526
- children: "HOW TO INSTALL"
48637
+ children: "CREATE A WIDGET"
48638
+ }), /*#__PURE__*/jsx(OptionCard, {
48639
+ icon: "wand-magic-sparkles",
48640
+ title: "Use Widget Builder",
48641
+ description: "Open the AI Widget Builder to create a new widget from scratch",
48642
+ onClick: function onClick() {
48643
+ return onSelect("builder");
48644
+ },
48645
+ currentTheme: currentTheme
48527
48646
  }), /*#__PURE__*/jsx(OptionCard, {
48528
48647
  icon: "compass",
48529
48648
  title: "Search for Widgets",
@@ -49815,7 +49934,14 @@ var WidgetsSection = function WidgetsSection(_ref) {
49815
49934
  setProgressComplete(false);
49816
49935
  }
49817
49936
  function handlePickerSelect(option) {
49818
- if (option === "discover") {
49937
+ if (option === "builder") {
49938
+ // Audit #19: the inline "+ New Widget" button was removed in
49939
+ // favor of this card so there's a single entry point for new-
49940
+ // widget creation. Closes the picker and fires the same event
49941
+ // the inline button used to dispatch.
49942
+ setInstallMode(null);
49943
+ window.dispatchEvent(new Event("dash:open-widget-builder"));
49944
+ } else if (option === "discover") {
49819
49945
  setInstallMode("discover");
49820
49946
  } else if (option === "zip") {
49821
49947
  handleInstallFromZip();
@@ -49913,23 +50039,7 @@ var WidgetsSection = function WidgetsSection(_ref) {
49913
50039
  }
49914
50040
  var listContent = /*#__PURE__*/jsxs("div", {
49915
50041
  className: "flex flex-col h-full",
49916
- children: [/*#__PURE__*/jsx("div", {
49917
- className: "flex-shrink-0 px-3 pt-2 pb-1",
49918
- children: /*#__PURE__*/jsxs("button", {
49919
- type: "button",
49920
- onClick: function onClick() {
49921
- return window.dispatchEvent(new Event("dash:open-widget-builder"));
49922
- },
49923
- 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",
49924
- "data-testid": "widgets-section-new-widget-button",
49925
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
49926
- icon: "plus",
49927
- className: "text-xs"
49928
- }), /*#__PURE__*/jsx("span", {
49929
- children: "New Widget"
49930
- })]
49931
- })
49932
- }), isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxs("div", {
50042
+ children: [isChecking && packagesWithUpdates.length === 0 && /*#__PURE__*/jsxs("div", {
49933
50043
  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",
49934
50044
  "data-testid": "widgets-section-checking-updates",
49935
50045
  children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
@@ -54565,7 +54675,7 @@ var AppSettingsModal = function AppSettingsModal(_ref) {
54565
54675
  padding: false
54566
54676
  }), (activeSection === "dashboards" || activeSection === "folders" || activeSection === "providers" || activeSection === "themes" || activeSection === "widgets") && /*#__PURE__*/jsx(ButtonIcon3, {
54567
54677
  icon: "plus",
54568
- text: activeSection === "dashboards" ? "Marketplace" : activeSection === "folders" ? "New Folder" : activeSection === "providers" ? "New Provider" : activeSection === "widgets" ? "Install Widgets" : "New Theme",
54678
+ text: activeSection === "dashboards" ? "New Dashboard" : activeSection === "folders" ? "New Folder" : activeSection === "providers" ? "New Provider" : activeSection === "widgets" ? "New Widget" : "New Theme",
54569
54679
  onClick: function onClick() {
54570
54680
  return setCreateRequested(true);
54571
54681
  },