@trops/dash-core 0.1.471 → 0.1.472

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
@@ -52922,6 +52922,14 @@ var NotificationsSection = function NotificationsSection(_ref) {
52922
52922
  _useState10 = _slicedToArray(_useState1, 2),
52923
52923
  selectedKey = _useState10[0],
52924
52924
  setSelectedKey = _useState10[1];
52925
+ var _useState11 = React.useState("all"),
52926
+ _useState12 = _slicedToArray(_useState11, 2),
52927
+ filterDashboard = _useState12[0],
52928
+ setFilterDashboard = _useState12[1];
52929
+ var _useState13 = React.useState("all"),
52930
+ _useState14 = _slicedToArray(_useState13, 2),
52931
+ filterPackage = _useState14[0],
52932
+ setFilterPackage = _useState14[1];
52925
52933
 
52926
52934
  // Load preferences on mount
52927
52935
  React.useEffect(function () {
@@ -52969,15 +52977,48 @@ var NotificationsSection = function NotificationsSection(_ref) {
52969
52977
  });
52970
52978
  }, [workspaces]);
52971
52979
 
52972
- // Filter by search.
52980
+ // Derive dropdown option lists. Both sorted alphabetically so the
52981
+ // dropdowns don't shuffle as the underlying list changes order.
52982
+ var dashboardOptions = React.useMemo(function () {
52983
+ var set = new Set();
52984
+ widgetInstances.forEach(function (wi) {
52985
+ if (wi.workspaceName) set.add(wi.workspaceName);
52986
+ });
52987
+ return _toConsumableArray(set).sort(function (a, b) {
52988
+ return String(a).localeCompare(String(b), undefined, {
52989
+ sensitivity: "base"
52990
+ });
52991
+ });
52992
+ }, [widgetInstances]);
52993
+ var packageOptions = React.useMemo(function () {
52994
+ var set = new Set();
52995
+ widgetInstances.forEach(function (wi) {
52996
+ if (wi["package"]) set.add(wi["package"]);
52997
+ });
52998
+ return _toConsumableArray(set).sort(function (a, b) {
52999
+ return String(a).localeCompare(String(b), undefined, {
53000
+ sensitivity: "base"
53001
+ });
53002
+ });
53003
+ }, [widgetInstances]);
53004
+ var hasActiveFilters = searchQuery.trim() !== "" || filterDashboard !== "all" || filterPackage !== "all";
53005
+ var clearFilters = function clearFilters() {
53006
+ setSearchQuery("");
53007
+ setFilterDashboard("all");
53008
+ setFilterPackage("all");
53009
+ };
53010
+
53011
+ // Filter by search + dashboard + package (composed AND).
52973
53012
  var filteredInstances = React.useMemo(function () {
52974
53013
  var q = searchQuery.trim().toLowerCase();
52975
- if (!q) return widgetInstances;
52976
53014
  return widgetInstances.filter(function (wi) {
53015
+ if (filterDashboard !== "all" && wi.workspaceName !== filterDashboard) return false;
53016
+ if (filterPackage !== "all" && wi["package"] !== filterPackage) return false;
53017
+ if (!q) return true;
52977
53018
  var hay = [wi.title, wi["package"], wi.workspaceName, wi.componentName].filter(Boolean).join(" ").toLowerCase();
52978
53019
  return hay.includes(q);
52979
53020
  });
52980
- }, [widgetInstances, searchQuery]);
53021
+ }, [widgetInstances, searchQuery, filterDashboard, filterPackage]);
52981
53022
  function handleGlobalToggle(value) {
52982
53023
  var _window$mainApi2;
52983
53024
  setGlobalEnabled(value);
@@ -53023,8 +53064,49 @@ var NotificationsSection = function NotificationsSection(_ref) {
53023
53064
  placeholder: "Search widgets...",
53024
53065
  inputClassName: "py-1.5 text-xs"
53025
53066
  }), /*#__PURE__*/jsxRuntime.jsxs("div", {
53026
- className: "text-[10px] opacity-50 px-0.5",
53027
- children: [filteredInstances.length, " of ", widgetInstances.length, " widget", widgetInstances.length === 1 ? "" : "s"]
53067
+ className: "grid grid-cols-2 gap-1.5",
53068
+ children: [/*#__PURE__*/jsxRuntime.jsxs("select", {
53069
+ value: filterDashboard,
53070
+ onChange: function onChange(e) {
53071
+ return setFilterDashboard(e.target.value);
53072
+ },
53073
+ className: "w-full px-2 py-1 text-xs bg-gray-800/50 border border-white/10 rounded text-gray-200 focus:outline-none",
53074
+ children: [/*#__PURE__*/jsxRuntime.jsx("option", {
53075
+ value: "all",
53076
+ children: "All Dashboards"
53077
+ }), dashboardOptions.map(function (d) {
53078
+ return /*#__PURE__*/jsxRuntime.jsx("option", {
53079
+ value: d,
53080
+ children: d
53081
+ }, d);
53082
+ })]
53083
+ }), /*#__PURE__*/jsxRuntime.jsxs("select", {
53084
+ value: filterPackage,
53085
+ onChange: function onChange(e) {
53086
+ return setFilterPackage(e.target.value);
53087
+ },
53088
+ className: "w-full px-2 py-1 text-xs bg-gray-800/50 border border-white/10 rounded text-gray-200 focus:outline-none",
53089
+ children: [/*#__PURE__*/jsxRuntime.jsx("option", {
53090
+ value: "all",
53091
+ children: "All Packages"
53092
+ }), packageOptions.map(function (p) {
53093
+ return /*#__PURE__*/jsxRuntime.jsx("option", {
53094
+ value: p,
53095
+ children: p
53096
+ }, p);
53097
+ })]
53098
+ })]
53099
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
53100
+ className: "flex items-center justify-between text-[10px] px-0.5",
53101
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
53102
+ className: "opacity-50",
53103
+ children: hasActiveFilters ? "".concat(filteredInstances.length, " of ").concat(widgetInstances.length, " widgets") : "".concat(widgetInstances.length, " widget").concat(widgetInstances.length === 1 ? "" : "s")
53104
+ }), hasActiveFilters && /*#__PURE__*/jsxRuntime.jsx("button", {
53105
+ type: "button",
53106
+ onClick: clearFilters,
53107
+ className: "opacity-60 hover:opacity-100 transition-opacity text-gray-300 hover:bg-white/10 px-1.5 py-0.5 rounded",
53108
+ children: "Clear"
53109
+ })]
53028
53110
  })]
53029
53111
  }), /*#__PURE__*/jsxRuntime.jsxs(DashReact.Sidebar.Content, {
53030
53112
  children: [/*#__PURE__*/jsxRuntime.jsx(DashReact.Sidebar.Item, {