@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.esm.js CHANGED
@@ -52904,6 +52904,14 @@ var NotificationsSection = function NotificationsSection(_ref) {
52904
52904
  _useState10 = _slicedToArray(_useState1, 2),
52905
52905
  selectedKey = _useState10[0],
52906
52906
  setSelectedKey = _useState10[1];
52907
+ var _useState11 = useState("all"),
52908
+ _useState12 = _slicedToArray(_useState11, 2),
52909
+ filterDashboard = _useState12[0],
52910
+ setFilterDashboard = _useState12[1];
52911
+ var _useState13 = useState("all"),
52912
+ _useState14 = _slicedToArray(_useState13, 2),
52913
+ filterPackage = _useState14[0],
52914
+ setFilterPackage = _useState14[1];
52907
52915
 
52908
52916
  // Load preferences on mount
52909
52917
  useEffect(function () {
@@ -52951,15 +52959,48 @@ var NotificationsSection = function NotificationsSection(_ref) {
52951
52959
  });
52952
52960
  }, [workspaces]);
52953
52961
 
52954
- // Filter by search.
52962
+ // Derive dropdown option lists. Both sorted alphabetically so the
52963
+ // dropdowns don't shuffle as the underlying list changes order.
52964
+ var dashboardOptions = useMemo(function () {
52965
+ var set = new Set();
52966
+ widgetInstances.forEach(function (wi) {
52967
+ if (wi.workspaceName) set.add(wi.workspaceName);
52968
+ });
52969
+ return _toConsumableArray(set).sort(function (a, b) {
52970
+ return String(a).localeCompare(String(b), undefined, {
52971
+ sensitivity: "base"
52972
+ });
52973
+ });
52974
+ }, [widgetInstances]);
52975
+ var packageOptions = useMemo(function () {
52976
+ var set = new Set();
52977
+ widgetInstances.forEach(function (wi) {
52978
+ if (wi["package"]) set.add(wi["package"]);
52979
+ });
52980
+ return _toConsumableArray(set).sort(function (a, b) {
52981
+ return String(a).localeCompare(String(b), undefined, {
52982
+ sensitivity: "base"
52983
+ });
52984
+ });
52985
+ }, [widgetInstances]);
52986
+ var hasActiveFilters = searchQuery.trim() !== "" || filterDashboard !== "all" || filterPackage !== "all";
52987
+ var clearFilters = function clearFilters() {
52988
+ setSearchQuery("");
52989
+ setFilterDashboard("all");
52990
+ setFilterPackage("all");
52991
+ };
52992
+
52993
+ // Filter by search + dashboard + package (composed AND).
52955
52994
  var filteredInstances = useMemo(function () {
52956
52995
  var q = searchQuery.trim().toLowerCase();
52957
- if (!q) return widgetInstances;
52958
52996
  return widgetInstances.filter(function (wi) {
52997
+ if (filterDashboard !== "all" && wi.workspaceName !== filterDashboard) return false;
52998
+ if (filterPackage !== "all" && wi["package"] !== filterPackage) return false;
52999
+ if (!q) return true;
52959
53000
  var hay = [wi.title, wi["package"], wi.workspaceName, wi.componentName].filter(Boolean).join(" ").toLowerCase();
52960
53001
  return hay.includes(q);
52961
53002
  });
52962
- }, [widgetInstances, searchQuery]);
53003
+ }, [widgetInstances, searchQuery, filterDashboard, filterPackage]);
52963
53004
  function handleGlobalToggle(value) {
52964
53005
  var _window$mainApi2;
52965
53006
  setGlobalEnabled(value);
@@ -53005,8 +53046,49 @@ var NotificationsSection = function NotificationsSection(_ref) {
53005
53046
  placeholder: "Search widgets...",
53006
53047
  inputClassName: "py-1.5 text-xs"
53007
53048
  }), /*#__PURE__*/jsxs("div", {
53008
- className: "text-[10px] opacity-50 px-0.5",
53009
- children: [filteredInstances.length, " of ", widgetInstances.length, " widget", widgetInstances.length === 1 ? "" : "s"]
53049
+ className: "grid grid-cols-2 gap-1.5",
53050
+ children: [/*#__PURE__*/jsxs("select", {
53051
+ value: filterDashboard,
53052
+ onChange: function onChange(e) {
53053
+ return setFilterDashboard(e.target.value);
53054
+ },
53055
+ className: "w-full px-2 py-1 text-xs bg-gray-800/50 border border-white/10 rounded text-gray-200 focus:outline-none",
53056
+ children: [/*#__PURE__*/jsx("option", {
53057
+ value: "all",
53058
+ children: "All Dashboards"
53059
+ }), dashboardOptions.map(function (d) {
53060
+ return /*#__PURE__*/jsx("option", {
53061
+ value: d,
53062
+ children: d
53063
+ }, d);
53064
+ })]
53065
+ }), /*#__PURE__*/jsxs("select", {
53066
+ value: filterPackage,
53067
+ onChange: function onChange(e) {
53068
+ return setFilterPackage(e.target.value);
53069
+ },
53070
+ className: "w-full px-2 py-1 text-xs bg-gray-800/50 border border-white/10 rounded text-gray-200 focus:outline-none",
53071
+ children: [/*#__PURE__*/jsx("option", {
53072
+ value: "all",
53073
+ children: "All Packages"
53074
+ }), packageOptions.map(function (p) {
53075
+ return /*#__PURE__*/jsx("option", {
53076
+ value: p,
53077
+ children: p
53078
+ }, p);
53079
+ })]
53080
+ })]
53081
+ }), /*#__PURE__*/jsxs("div", {
53082
+ className: "flex items-center justify-between text-[10px] px-0.5",
53083
+ children: [/*#__PURE__*/jsx("span", {
53084
+ className: "opacity-50",
53085
+ children: hasActiveFilters ? "".concat(filteredInstances.length, " of ").concat(widgetInstances.length, " widgets") : "".concat(widgetInstances.length, " widget").concat(widgetInstances.length === 1 ? "" : "s")
53086
+ }), hasActiveFilters && /*#__PURE__*/jsx("button", {
53087
+ type: "button",
53088
+ onClick: clearFilters,
53089
+ className: "opacity-60 hover:opacity-100 transition-opacity text-gray-300 hover:bg-white/10 px-1.5 py-0.5 rounded",
53090
+ children: "Clear"
53091
+ })]
53010
53092
  })]
53011
53093
  }), /*#__PURE__*/jsxs(Sidebar.Content, {
53012
53094
  children: [/*#__PURE__*/jsx(Sidebar.Item, {