@trops/dash-core 0.1.275 → 0.1.276

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
@@ -45622,15 +45622,25 @@ var WidgetsSection = function WidgetsSection(_ref) {
45622
45622
  // ── Uninstall with usage check ──────────────────────────────────────
45623
45623
 
45624
45624
  function handleDeleteRequest(widget) {
45625
- var usage = findWidgetUsage(widget.componentNames, workspaces);
45625
+ // Find all sibling widgets in the same package (uninstall is package-level)
45626
+ var siblings = widget.packageId && widget.source === "installed" ? widgets.filter(function (w) {
45627
+ return w.packageId === widget.packageId && w.name !== widget.name;
45628
+ }) : [];
45629
+ var allComponentNames = [].concat(_toConsumableArray(widget.componentNames), _toConsumableArray(siblings.flatMap(function (s) {
45630
+ return s.componentNames;
45631
+ })));
45632
+ var usage = findWidgetUsage(allComponentNames, workspaces);
45626
45633
  setDeleteUsage(usage);
45627
- setDeleteTarget(widget);
45634
+ setDeleteTarget(_objectSpread$6(_objectSpread$6({}, widget), {}, {
45635
+ _siblings: siblings
45636
+ }));
45628
45637
  }
45629
45638
  function handleConfirmDelete() {
45630
45639
  return _handleConfirmDelete.apply(this, arguments);
45631
45640
  }
45632
45641
  function _handleConfirmDelete() {
45633
45642
  _handleConfirmDelete = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
45643
+ var allNames;
45634
45644
  return _regeneratorRuntime.wrap(function (_context) {
45635
45645
  while (1) switch (_context.prev = _context.next) {
45636
45646
  case 0:
@@ -45644,7 +45654,11 @@ var WidgetsSection = function WidgetsSection(_ref) {
45644
45654
  _context.next = 2;
45645
45655
  return uninstallWidget(deleteTarget.name);
45646
45656
  case 2:
45647
- if (selectedWidgetName === deleteTarget.name) {
45657
+ // Clear selection if it was the target or any sibling
45658
+ allNames = [deleteTarget.name].concat(_toConsumableArray((deleteTarget._siblings || []).map(function (s) {
45659
+ return s.name;
45660
+ })));
45661
+ if (allNames.includes(selectedWidgetName)) {
45648
45662
  setSelectedWidgetName(null);
45649
45663
  }
45650
45664
  _context.next = 4;
@@ -46113,6 +46127,9 @@ var WidgetsSection = function WidgetsSection(_ref) {
46113
46127
 
46114
46128
  var paragraphStyles = getStylesForItem(themeObjects.PARAGRAPH, currentTheme);
46115
46129
  var deleteWidgetLabel = (deleteTarget === null || deleteTarget === void 0 ? void 0 : deleteTarget.displayName) || (deleteTarget === null || deleteTarget === void 0 ? void 0 : deleteTarget.name) || "";
46130
+ var deleteSiblings = (deleteTarget === null || deleteTarget === void 0 ? void 0 : deleteTarget._siblings) || [];
46131
+ var deletePackageLabel = deleteTarget !== null && deleteTarget !== void 0 && deleteTarget.packageId ? deleteTarget.packageId.replace(/^@[^/]+\//, "") : "";
46132
+ var hasPackageSiblings = deleteSiblings.length > 0;
46116
46133
  return /*#__PURE__*/jsxs(Fragment, {
46117
46134
  children: [/*#__PURE__*/jsx(SectionLayout, {
46118
46135
  listContent: listContent,
@@ -46130,8 +46147,8 @@ var WidgetsSection = function WidgetsSection(_ref) {
46130
46147
  setDeleteTarget(null);
46131
46148
  setDeleteUsage([]);
46132
46149
  },
46133
- title: "Uninstall Widget"
46134
- }, deleteUsage.length === 0 ? {
46150
+ title: hasPackageSiblings ? "Uninstall Package" : "Uninstall Widget"
46151
+ }, !hasPackageSiblings && deleteUsage.length === 0 ? {
46135
46152
  message: "Are you sure you want to uninstall \"".concat(deleteWidgetLabel, "\"?")
46136
46153
  } : {}), {}, {
46137
46154
  confirmLabel: "Uninstall",
@@ -46141,27 +46158,48 @@ var WidgetsSection = function WidgetsSection(_ref) {
46141
46158
  setDeleteTarget(null);
46142
46159
  setDeleteUsage([]);
46143
46160
  },
46144
- children: deleteUsage.length > 0 && /*#__PURE__*/jsxs("div", {
46161
+ children: (hasPackageSiblings || deleteUsage.length > 0) && /*#__PURE__*/jsxs("div", {
46145
46162
  className: paragraphStyles.textColor || "",
46146
- children: [/*#__PURE__*/jsxs("p", {
46147
- className: "text-sm leading-relaxed",
46148
- children: ["\"", deleteWidgetLabel, "\" is currently used in ", deleteUsage.length, " ", "dashboard", deleteUsage.length !== 1 ? "s" : "", ". Uninstalling will leave orphaned layout items on these dashboards."]
46149
- }), /*#__PURE__*/jsxs("div", {
46150
- className: "mt-2 space-y-1",
46151
- children: [/*#__PURE__*/jsx("span", {
46152
- className: "text-xs font-semibold opacity-70",
46153
- children: "Affected dashboards:"
46154
- }), deleteUsage.map(function (u) {
46155
- return /*#__PURE__*/jsxs("div", {
46156
- className: "text-xs opacity-60 flex items-center gap-1.5 pl-2",
46157
- children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
46158
- icon: "triangle-exclamation",
46159
- className: "h-3 w-3 text-yellow-500"
46160
- }), u.workspaceName, " ", /*#__PURE__*/jsxs("span", {
46161
- className: "opacity-50",
46162
- children: ["(", u.count, " instance", u.count !== 1 ? "s" : "", ")"]
46163
- })]
46164
- }, u.workspaceId);
46163
+ children: [hasPackageSiblings && /*#__PURE__*/jsxs(Fragment, {
46164
+ children: [/*#__PURE__*/jsxs("p", {
46165
+ className: "text-sm leading-relaxed",
46166
+ children: ["\"", deleteWidgetLabel, "\" is part of the", " ", /*#__PURE__*/jsx("span", {
46167
+ className: "font-semibold",
46168
+ children: deletePackageLabel
46169
+ }), " ", "package. Uninstalling will remove all", " ", deleteSiblings.length + 1, " widgets in this package:"]
46170
+ }), /*#__PURE__*/jsx("div", {
46171
+ className: "mt-2 mb-2 space-y-1",
46172
+ children: [deleteTarget].concat(_toConsumableArray(deleteSiblings)).map(function (w) {
46173
+ return /*#__PURE__*/jsxs("div", {
46174
+ className: "text-xs opacity-60 flex items-center gap-1.5 pl-2",
46175
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
46176
+ icon: "puzzle-piece",
46177
+ className: "h-3 w-3"
46178
+ }), w.displayName || w.name]
46179
+ }, w.name);
46180
+ })
46181
+ })]
46182
+ }), deleteUsage.length > 0 && /*#__PURE__*/jsxs(Fragment, {
46183
+ children: [/*#__PURE__*/jsxs("p", {
46184
+ className: "text-sm leading-relaxed",
46185
+ children: [hasPackageSiblings ? "These widgets are" : "\"".concat(deleteWidgetLabel, "\" is"), " ", "currently used in ", deleteUsage.length, " dashboard", deleteUsage.length !== 1 ? "s" : "", ". Uninstalling will leave orphaned layout items on these dashboards."]
46186
+ }), /*#__PURE__*/jsxs("div", {
46187
+ className: "mt-2 space-y-1",
46188
+ children: [/*#__PURE__*/jsx("span", {
46189
+ className: "text-xs font-semibold opacity-70",
46190
+ children: "Affected dashboards:"
46191
+ }), deleteUsage.map(function (u) {
46192
+ return /*#__PURE__*/jsxs("div", {
46193
+ className: "text-xs opacity-60 flex items-center gap-1.5 pl-2",
46194
+ children: [/*#__PURE__*/jsx(FontAwesomeIcon, {
46195
+ icon: "triangle-exclamation",
46196
+ className: "h-3 w-3 text-yellow-500"
46197
+ }), u.workspaceName, " ", /*#__PURE__*/jsxs("span", {
46198
+ className: "opacity-50",
46199
+ children: ["(", u.count, " instance", u.count !== 1 ? "s" : "", ")"]
46200
+ })]
46201
+ }, u.workspaceId);
46202
+ })]
46165
46203
  })]
46166
46204
  })]
46167
46205
  })