@datum-cloud/activity-ui 0.5.1-dev.a55ad87 → 0.6.0-dev.5b51180

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
@@ -1198,6 +1198,48 @@ function constructNow(date) {
1198
1198
  return constructFrom(date, Date.now());
1199
1199
  }
1200
1200
 
1201
+ /**
1202
+ * The {@link isSameDay} function options.
1203
+ */
1204
+
1205
+ /**
1206
+ * @name isSameDay
1207
+ * @category Day Helpers
1208
+ * @summary Are the given dates in the same day (and year and month)?
1209
+ *
1210
+ * @description
1211
+ * Are the given dates in the same day (and year and month)?
1212
+ *
1213
+ * @param laterDate - The first date to check
1214
+ * @param earlierDate - The second date to check
1215
+ * @param options - An object with options
1216
+ *
1217
+ * @returns The dates are in the same day (and year and month)
1218
+ *
1219
+ * @example
1220
+ * // Are 4 September 06:00:00 and 4 September 18:00:00 in the same day?
1221
+ * const result = isSameDay(new Date(2014, 8, 4, 6, 0), new Date(2014, 8, 4, 18, 0))
1222
+ * //=> true
1223
+ *
1224
+ * @example
1225
+ * // Are 4 September and 4 October in the same day?
1226
+ * const result = isSameDay(new Date(2014, 8, 4), new Date(2014, 9, 4))
1227
+ * //=> false
1228
+ *
1229
+ * @example
1230
+ * // Are 4 September, 2014 and 4 September, 2015 in the same day?
1231
+ * const result = isSameDay(new Date(2014, 8, 4), new Date(2015, 8, 4))
1232
+ * //=> false
1233
+ */
1234
+ function isSameDay(laterDate, earlierDate, options) {
1235
+ const [dateLeft_, dateRight_] = normalizeDates(
1236
+ options?.in,
1237
+ laterDate,
1238
+ earlierDate,
1239
+ );
1240
+ return +startOfDay(dateLeft_) === +startOfDay(dateRight_);
1241
+ }
1242
+
1201
1243
  /**
1202
1244
  * @name isDate
1203
1245
  * @category Common Helpers
@@ -3934,6 +3976,36 @@ function formatISO(date, options) {
3934
3976
  return result;
3935
3977
  }
3936
3978
 
3979
+ /**
3980
+ * The {@link isToday} function options.
3981
+ */
3982
+
3983
+ /**
3984
+ * @name isToday
3985
+ * @category Day Helpers
3986
+ * @summary Is the given date today?
3987
+ * @pure false
3988
+ *
3989
+ * @description
3990
+ * Is the given date today?
3991
+ *
3992
+ * @param date - The date to check
3993
+ * @param options - An object with options
3994
+ *
3995
+ * @returns The date is today
3996
+ *
3997
+ * @example
3998
+ * // If today is 6 October 2014, is 6 October 14:00:00 today?
3999
+ * const result = isToday(new Date(2014, 9, 6, 14, 0))
4000
+ * //=> true
4001
+ */
4002
+ function isToday(date, options) {
4003
+ return isSameDay(
4004
+ constructFrom(date, date),
4005
+ constructNow(date),
4006
+ );
4007
+ }
4008
+
3937
4009
  /**
3938
4010
  * The {@link subDays} function options.
3939
4011
  */
@@ -3961,6 +4033,36 @@ function subDays(date, amount, options) {
3961
4033
  return addDays(date, -amount, options);
3962
4034
  }
3963
4035
 
4036
+ /**
4037
+ * The {@link isYesterday} function options.
4038
+ */
4039
+
4040
+ /**
4041
+ * @name isYesterday
4042
+ * @category Day Helpers
4043
+ * @summary Is the given date yesterday?
4044
+ * @pure false
4045
+ *
4046
+ * @description
4047
+ * Is the given date yesterday?
4048
+ *
4049
+ * @param date - The date to check
4050
+ * @param options - An object with options
4051
+ *
4052
+ * @returns The date is yesterday
4053
+ *
4054
+ * @example
4055
+ * // If today is 6 October 2014, is 5 October 14:00:00 yesterday?
4056
+ * const result = isYesterday(new Date(2014, 9, 5, 14, 0))
4057
+ * //=> true
4058
+ */
4059
+ function isYesterday(date, options) {
4060
+ return isSameDay(
4061
+ constructFrom(date, date),
4062
+ subDays(constructNow(date), 1),
4063
+ );
4064
+ }
4065
+
3964
4066
  /**
3965
4067
  * The {@link subHours} function options.
3966
4068
  */
@@ -7902,7 +8004,7 @@ const createLucideIcon = (iconName, iconNode) => {
7902
8004
  */
7903
8005
 
7904
8006
 
7905
- const __iconNode$n = [
8007
+ const __iconNode$o = [
7906
8008
  [
7907
8009
  "path",
7908
8010
  {
@@ -7911,7 +8013,7 @@ const __iconNode$n = [
7911
8013
  }
7912
8014
  ]
7913
8015
  ];
7914
- const Activity = createLucideIcon("activity", __iconNode$n);
8016
+ const Activity = createLucideIcon("activity", __iconNode$o);
7915
8017
 
7916
8018
  /**
7917
8019
  * @license lucide-react v0.577.0 - ISC
@@ -7921,7 +8023,7 @@ const Activity = createLucideIcon("activity", __iconNode$n);
7921
8023
  */
7922
8024
 
7923
8025
 
7924
- const __iconNode$m = [
8026
+ const __iconNode$n = [
7925
8027
  ["path", { d: "M10.268 21a2 2 0 0 0 3.464 0", key: "vwvbt9" }],
7926
8028
  [
7927
8029
  "path",
@@ -7931,7 +8033,7 @@ const __iconNode$m = [
7931
8033
  }
7932
8034
  ]
7933
8035
  ];
7934
- const Bell = createLucideIcon("bell", __iconNode$m);
8036
+ const Bell = createLucideIcon("bell", __iconNode$n);
7935
8037
 
7936
8038
  /**
7937
8039
  * @license lucide-react v0.577.0 - ISC
@@ -7941,8 +8043,8 @@ const Bell = createLucideIcon("bell", __iconNode$m);
7941
8043
  */
7942
8044
 
7943
8045
 
7944
- const __iconNode$l = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
7945
- const Check = createLucideIcon("check", __iconNode$l);
8046
+ const __iconNode$m = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
8047
+ const Check = createLucideIcon("check", __iconNode$m);
7946
8048
 
7947
8049
  /**
7948
8050
  * @license lucide-react v0.577.0 - ISC
@@ -7952,8 +8054,8 @@ const Check = createLucideIcon("check", __iconNode$l);
7952
8054
  */
7953
8055
 
7954
8056
 
7955
- const __iconNode$k = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
7956
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$k);
8057
+ const __iconNode$l = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
8058
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$l);
7957
8059
 
7958
8060
  /**
7959
8061
  * @license lucide-react v0.577.0 - ISC
@@ -7963,8 +8065,8 @@ const ChevronDown = createLucideIcon("chevron-down", __iconNode$k);
7963
8065
  */
7964
8066
 
7965
8067
 
7966
- const __iconNode$j = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
7967
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$j);
8068
+ const __iconNode$k = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
8069
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$k);
7968
8070
 
7969
8071
  /**
7970
8072
  * @license lucide-react v0.577.0 - ISC
@@ -7974,8 +8076,8 @@ const ChevronRight = createLucideIcon("chevron-right", __iconNode$j);
7974
8076
  */
7975
8077
 
7976
8078
 
7977
- const __iconNode$i = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
7978
- const ChevronUp = createLucideIcon("chevron-up", __iconNode$i);
8079
+ const __iconNode$j = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
8080
+ const ChevronUp = createLucideIcon("chevron-up", __iconNode$j);
7979
8081
 
7980
8082
  /**
7981
8083
  * @license lucide-react v0.577.0 - ISC
@@ -7985,12 +8087,12 @@ const ChevronUp = createLucideIcon("chevron-up", __iconNode$i);
7985
8087
  */
7986
8088
 
7987
8089
 
7988
- const __iconNode$h = [
8090
+ const __iconNode$i = [
7989
8091
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
7990
8092
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
7991
8093
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
7992
8094
  ];
7993
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$h);
8095
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$i);
7994
8096
 
7995
8097
  /**
7996
8098
  * @license lucide-react v0.577.0 - ISC
@@ -8000,11 +8102,11 @@ const CircleAlert = createLucideIcon("circle-alert", __iconNode$h);
8000
8102
  */
8001
8103
 
8002
8104
 
8003
- const __iconNode$g = [
8105
+ const __iconNode$h = [
8004
8106
  ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
8005
8107
  ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
8006
8108
  ];
8007
- const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$g);
8109
+ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$h);
8008
8110
 
8009
8111
  /**
8010
8112
  * @license lucide-react v0.577.0 - ISC
@@ -8014,11 +8116,11 @@ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$g);
8014
8116
  */
8015
8117
 
8016
8118
 
8017
- const __iconNode$f = [
8119
+ const __iconNode$g = [
8018
8120
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
8019
8121
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
8020
8122
  ];
8021
- const CircleCheck = createLucideIcon("circle-check", __iconNode$f);
8123
+ const CircleCheck = createLucideIcon("circle-check", __iconNode$g);
8022
8124
 
8023
8125
  /**
8024
8126
  * @license lucide-react v0.577.0 - ISC
@@ -8028,12 +8130,12 @@ const CircleCheck = createLucideIcon("circle-check", __iconNode$f);
8028
8130
  */
8029
8131
 
8030
8132
 
8031
- const __iconNode$e = [
8133
+ const __iconNode$f = [
8032
8134
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
8033
8135
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
8034
8136
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
8035
8137
  ];
8036
- const CircleX = createLucideIcon("circle-x", __iconNode$e);
8138
+ const CircleX = createLucideIcon("circle-x", __iconNode$f);
8037
8139
 
8038
8140
  /**
8039
8141
  * @license lucide-react v0.577.0 - ISC
@@ -8043,11 +8145,11 @@ const CircleX = createLucideIcon("circle-x", __iconNode$e);
8043
8145
  */
8044
8146
 
8045
8147
 
8046
- const __iconNode$d = [
8148
+ const __iconNode$e = [
8047
8149
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
8048
8150
  ["path", { d: "M12 6v6l4 2", key: "mmk7yg" }]
8049
8151
  ];
8050
- const Clock = createLucideIcon("clock", __iconNode$d);
8152
+ const Clock = createLucideIcon("clock", __iconNode$e);
8051
8153
 
8052
8154
  /**
8053
8155
  * @license lucide-react v0.577.0 - ISC
@@ -8057,11 +8159,11 @@ const Clock = createLucideIcon("clock", __iconNode$d);
8057
8159
  */
8058
8160
 
8059
8161
 
8060
- const __iconNode$c = [
8162
+ const __iconNode$d = [
8061
8163
  ["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
8062
8164
  ["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
8063
8165
  ];
8064
- const Copy = createLucideIcon("copy", __iconNode$c);
8166
+ const Copy = createLucideIcon("copy", __iconNode$d);
8065
8167
 
8066
8168
  /**
8067
8169
  * @license lucide-react v0.577.0 - ISC
@@ -8071,7 +8173,7 @@ const Copy = createLucideIcon("copy", __iconNode$c);
8071
8173
  */
8072
8174
 
8073
8175
 
8074
- const __iconNode$b = [
8176
+ const __iconNode$c = [
8075
8177
  [
8076
8178
  "path",
8077
8179
  {
@@ -8081,7 +8183,7 @@ const __iconNode$b = [
8081
8183
  ],
8082
8184
  ["circle", { cx: "12", cy: "12", r: "3", key: "1v7zrd" }]
8083
8185
  ];
8084
- const Eye = createLucideIcon("eye", __iconNode$b);
8186
+ const Eye = createLucideIcon("eye", __iconNode$c);
8085
8187
 
8086
8188
  /**
8087
8189
  * @license lucide-react v0.577.0 - ISC
@@ -8091,8 +8193,8 @@ const Eye = createLucideIcon("eye", __iconNode$b);
8091
8193
  */
8092
8194
 
8093
8195
 
8094
- const __iconNode$a = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
8095
- const LoaderCircle = createLucideIcon("loader-circle", __iconNode$a);
8196
+ const __iconNode$b = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
8197
+ const LoaderCircle = createLucideIcon("loader-circle", __iconNode$b);
8096
8198
 
8097
8199
  /**
8098
8200
  * @license lucide-react v0.577.0 - ISC
@@ -8102,7 +8204,7 @@ const LoaderCircle = createLucideIcon("loader-circle", __iconNode$a);
8102
8204
  */
8103
8205
 
8104
8206
 
8105
- const __iconNode$9 = [
8207
+ const __iconNode$a = [
8106
8208
  [
8107
8209
  "path",
8108
8210
  {
@@ -8112,7 +8214,7 @@ const __iconNode$9 = [
8112
8214
  ],
8113
8215
  ["path", { d: "m15 5 4 4", key: "1mk7zo" }]
8114
8216
  ];
8115
- const Pencil = createLucideIcon("pencil", __iconNode$9);
8217
+ const Pencil = createLucideIcon("pencil", __iconNode$a);
8116
8218
 
8117
8219
  /**
8118
8220
  * @license lucide-react v0.577.0 - ISC
@@ -8122,11 +8224,11 @@ const Pencil = createLucideIcon("pencil", __iconNode$9);
8122
8224
  */
8123
8225
 
8124
8226
 
8125
- const __iconNode$8 = [
8227
+ const __iconNode$9 = [
8126
8228
  ["path", { d: "M5 12h14", key: "1ays0h" }],
8127
8229
  ["path", { d: "M12 5v14", key: "s699le" }]
8128
8230
  ];
8129
- const Plus = createLucideIcon("plus", __iconNode$8);
8231
+ const Plus = createLucideIcon("plus", __iconNode$9);
8130
8232
 
8131
8233
  /**
8132
8234
  * @license lucide-react v0.577.0 - ISC
@@ -8136,13 +8238,13 @@ const Plus = createLucideIcon("plus", __iconNode$8);
8136
8238
  */
8137
8239
 
8138
8240
 
8139
- const __iconNode$7 = [
8241
+ const __iconNode$8 = [
8140
8242
  ["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
8141
8243
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }],
8142
8244
  ["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
8143
8245
  ["path", { d: "M8 16H3v5", key: "1cv678" }]
8144
8246
  ];
8145
- const RefreshCw = createLucideIcon("refresh-cw", __iconNode$7);
8247
+ const RefreshCw = createLucideIcon("refresh-cw", __iconNode$8);
8146
8248
 
8147
8249
  /**
8148
8250
  * @license lucide-react v0.577.0 - ISC
@@ -8152,11 +8254,11 @@ const RefreshCw = createLucideIcon("refresh-cw", __iconNode$7);
8152
8254
  */
8153
8255
 
8154
8256
 
8155
- const __iconNode$6 = [
8257
+ const __iconNode$7 = [
8156
8258
  ["path", { d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8", key: "1p45f6" }],
8157
8259
  ["path", { d: "M21 3v5h-5", key: "1q7to0" }]
8158
8260
  ];
8159
- const RotateCw = createLucideIcon("rotate-cw", __iconNode$6);
8261
+ const RotateCw = createLucideIcon("rotate-cw", __iconNode$7);
8160
8262
 
8161
8263
  /**
8162
8264
  * @license lucide-react v0.577.0 - ISC
@@ -8166,11 +8268,32 @@ const RotateCw = createLucideIcon("rotate-cw", __iconNode$6);
8166
8268
  */
8167
8269
 
8168
8270
 
8169
- const __iconNode$5 = [
8271
+ const __iconNode$6 = [
8170
8272
  ["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
8171
8273
  ["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
8172
8274
  ];
8173
- const Search = createLucideIcon("search", __iconNode$5);
8275
+ const Search = createLucideIcon("search", __iconNode$6);
8276
+
8277
+ /**
8278
+ * @license lucide-react v0.577.0 - ISC
8279
+ *
8280
+ * This source code is licensed under the ISC license.
8281
+ * See the LICENSE file in the root directory of this source tree.
8282
+ */
8283
+
8284
+
8285
+ const __iconNode$5 = [
8286
+ ["path", { d: "M10 5H3", key: "1qgfaw" }],
8287
+ ["path", { d: "M12 19H3", key: "yhmn1j" }],
8288
+ ["path", { d: "M14 3v4", key: "1sua03" }],
8289
+ ["path", { d: "M16 17v4", key: "1q0r14" }],
8290
+ ["path", { d: "M21 12h-9", key: "1o4lsq" }],
8291
+ ["path", { d: "M21 19h-5", key: "1rlt1p" }],
8292
+ ["path", { d: "M21 5h-7", key: "1oszz2" }],
8293
+ ["path", { d: "M8 10v4", key: "tgpxqk" }],
8294
+ ["path", { d: "M8 12H3", key: "a7s4jb" }]
8295
+ ];
8296
+ const SlidersHorizontal = createLucideIcon("sliders-horizontal", __iconNode$5);
8174
8297
 
8175
8298
  /**
8176
8299
  * @license lucide-react v0.577.0 - ISC
@@ -10300,36 +10423,6 @@ function ActivityExpandedDetails({ activity, compact = false, }) {
10300
10423
  return (jsxRuntime.jsx(TooltipProvider, { children: compact ? (jsxRuntime.jsx(DetailPanelShell, { children: body })) : (jsxRuntime.jsx("div", { className: "mt-4 pt-4 border-t border-border", children: body })) }));
10301
10424
  }
10302
10425
 
10303
- // Number of columns rendered for the feed variant. Used as the colSpan on
10304
- // the expanded-detail row so it stretches across the full width.
10305
- const ACTIVITY_FEED_COLUMN_COUNT = 5;
10306
- /**
10307
- * Get avatar initials from actor name
10308
- */
10309
- function getActorInitials(name) {
10310
- const parts = name.split(/[@\s.]+/).filter(Boolean);
10311
- if (parts.length === 0)
10312
- return "?";
10313
- if (parts.length === 1)
10314
- return parts[0].charAt(0).toUpperCase();
10315
- return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
10316
- }
10317
- /**
10318
- * Get Tailwind classes for actor avatar based on actor type
10319
- */
10320
- function getActorAvatarClasses(actorType, compact) {
10321
- const baseClasses = cn("rounded-full flex items-center justify-center shrink-0 font-semibold", compact ? "w-5 h-5 text-1xs" : "w-6 h-6 text-1xs");
10322
- switch (actorType) {
10323
- case "user":
10324
- return cn(baseClasses, "bg-primary text-primary-foreground");
10325
- case "controller":
10326
- return cn(baseClasses, "bg-secondary text-secondary-foreground");
10327
- case "machine account":
10328
- return cn(baseClasses, "bg-muted text-muted-foreground");
10329
- default:
10330
- return cn(baseClasses, "bg-muted text-muted-foreground");
10331
- }
10332
- }
10333
10426
  /**
10334
10427
  * Extract verb from activity summary (e.g., "alice created HTTPProxy" -> "created")
10335
10428
  */
@@ -10338,24 +10431,24 @@ function extractVerb(summary) {
10338
10431
  if (words.length >= 2) {
10339
10432
  return words[1].toLowerCase();
10340
10433
  }
10341
- return "unknown";
10434
+ return 'unknown';
10342
10435
  }
10343
10436
  /**
10344
- * Normalize verb to a canonical form for coloring
10437
+ * Normalize a verb to a canonical form used for coloring/icons/grouping.
10345
10438
  */
10346
10439
  function normalizeVerb(verb) {
10347
10440
  const normalized = verb.toLowerCase();
10348
- if (normalized.includes("create") || normalized.includes("add"))
10349
- return "create";
10350
- if (normalized.includes("delete") || normalized.includes("remove"))
10351
- return "delete";
10352
- if (normalized.includes("update") ||
10353
- normalized.includes("patch") ||
10354
- normalized.includes("modify") ||
10355
- normalized.includes("change") ||
10356
- normalized.includes("edit"))
10357
- return "update";
10358
- return "other";
10441
+ if (normalized.includes('create') || normalized.includes('add'))
10442
+ return 'create';
10443
+ if (normalized.includes('delete') || normalized.includes('remove'))
10444
+ return 'delete';
10445
+ if (normalized.includes('update') ||
10446
+ normalized.includes('patch') ||
10447
+ normalized.includes('modify') ||
10448
+ normalized.includes('change') ||
10449
+ normalized.includes('edit'))
10450
+ return 'update';
10451
+ return 'other';
10359
10452
  }
10360
10453
  /**
10361
10454
  * Get icon container + icon color classes based on verb
@@ -10363,25 +10456,25 @@ function normalizeVerb(verb) {
10363
10456
  function getActionIconClasses(verb) {
10364
10457
  const normalizedVerb = normalizeVerb(verb);
10365
10458
  switch (normalizedVerb) {
10366
- case "create":
10459
+ case 'create':
10367
10460
  return {
10368
- container: "bg-[var(--success-100)]",
10369
- icon: "text-[var(--success-500)]",
10461
+ container: 'bg-blue-50 dark:bg-blue-950',
10462
+ icon: 'text-blue-500 dark:text-blue-400',
10370
10463
  };
10371
- case "update":
10464
+ case 'update':
10372
10465
  return {
10373
- container: "bg-[var(--info-100)]",
10374
- icon: "text-[var(--info-500)]",
10466
+ container: 'bg-green-50 dark:bg-green-950',
10467
+ icon: 'text-green-600 dark:text-green-400',
10375
10468
  };
10376
- case "delete":
10469
+ case 'delete':
10377
10470
  return {
10378
- container: "bg-destructive/10",
10379
- icon: "text-destructive",
10471
+ container: 'bg-red-50 dark:bg-red-950',
10472
+ icon: 'text-red-500 dark:text-red-400',
10380
10473
  };
10381
10474
  default:
10382
10475
  return {
10383
- container: "bg-muted",
10384
- icon: "text-muted-foreground",
10476
+ container: 'bg-slate-100 dark:bg-slate-800',
10477
+ icon: 'text-slate-500 dark:text-slate-400',
10385
10478
  };
10386
10479
  }
10387
10480
  }
@@ -10391,20 +10484,51 @@ function getActionIconClasses(verb) {
10391
10484
  function getTimelineIcon(verb) {
10392
10485
  const normalizedVerb = normalizeVerb(verb);
10393
10486
  switch (normalizedVerb) {
10394
- case "create":
10487
+ case 'create':
10395
10488
  return Plus;
10396
- case "update":
10489
+ case 'update':
10397
10490
  return Pencil;
10398
- case "delete":
10491
+ case 'delete':
10399
10492
  return Trash2;
10400
10493
  default:
10401
10494
  return Activity;
10402
10495
  }
10403
10496
  }
10497
+
10498
+ // Number of columns rendered for the feed variant. Used as the colSpan on
10499
+ // the expanded-detail row so it stretches across the full width.
10500
+ const ACTIVITY_FEED_COLUMN_COUNT = 5;
10501
+ /**
10502
+ * Get avatar initials from actor name
10503
+ */
10504
+ function getActorInitials(name) {
10505
+ const parts = name.split(/[@\s.]+/).filter(Boolean);
10506
+ if (parts.length === 0)
10507
+ return "?";
10508
+ if (parts.length === 1)
10509
+ return parts[0].charAt(0).toUpperCase();
10510
+ return (parts[0].charAt(0) + parts[parts.length - 1].charAt(0)).toUpperCase();
10511
+ }
10512
+ /**
10513
+ * Get Tailwind classes for actor avatar based on actor type
10514
+ */
10515
+ function getActorAvatarClasses(actorType, compact) {
10516
+ const baseClasses = cn("rounded-full flex items-center justify-center shrink-0 font-semibold", compact ? "w-5 h-5 text-1xs" : "w-6 h-6 text-1xs");
10517
+ switch (actorType) {
10518
+ case "user":
10519
+ return cn(baseClasses, "bg-primary text-primary-foreground");
10520
+ case "controller":
10521
+ return cn(baseClasses, "bg-secondary text-secondary-foreground");
10522
+ case "machine account":
10523
+ return cn(baseClasses, "bg-muted text-muted-foreground");
10524
+ default:
10525
+ return cn(baseClasses, "bg-muted text-muted-foreground");
10526
+ }
10527
+ }
10404
10528
  /**
10405
10529
  * ActivityFeedItem renders a single activity in the feed or timeline
10406
10530
  */
10407
- function ActivityFeedItem({ activity, onResourceClick, resourceLinkResolver, tenantLinkResolver, tenantRenderer, onActorClick, onActivityClick, isSelected = false, className = "", compact = false, isNew = false, variant = "feed", isLast = false, defaultExpanded = false, }) {
10531
+ function ActivityFeedItem({ activity, onResourceClick, resourceLinkResolver, tenantLinkResolver, tenantRenderer, onActorClick, onActivityClick, isSelected = false, className = "", compact = false, isNew = false, variant = "feed", isLast = false, defaultExpanded = false, density = "default", }) {
10408
10532
  const [isExpanded, setIsExpanded] = React.useState(defaultExpanded);
10409
10533
  const { spec, metadata } = activity;
10410
10534
  const { actor, summary, links, tenant } = spec;
@@ -10425,7 +10549,7 @@ function ActivityFeedItem({ activity, onResourceClick, resourceLinkResolver, ten
10425
10549
  if (isTimeline) {
10426
10550
  const { container: iconBg, icon: iconColor } = getActionIconClasses(verb);
10427
10551
  const Icon = getTimelineIcon(verb);
10428
- return (jsxRuntime.jsxs("div", { className: cn(!isLast && !isExpanded && "border-b border-border", className), children: [jsxRuntime.jsxs("div", { className: cn("flex items-center gap-3 py-3 cursor-pointer group", isSelected && "bg-muted/40"), onClick: toggleExpand, children: [jsxRuntime.jsx("div", { className: cn("w-8 h-8 rounded-md shrink-0 flex items-center justify-center", iconBg, iconColor), children: jsxRuntime.jsx(Icon, { size: 16, strokeWidth: 2 }) }), jsxRuntime.jsx("div", { className: "flex-1 min-w-0 text-sm text-foreground leading-snug", children: jsxRuntime.jsx(ActivityFeedSummary, { summary: summary, links: links, onResourceClick: onResourceClick, resourceLinkResolver: resourceLinkResolver, resourceLinkContext: { tenant } }) }), tenant && (jsxRuntime.jsx("div", { className: "shrink-0", children: tenantRenderer ? (tenantRenderer(tenant)) : (jsxRuntime.jsx(TenantBadge, { tenant: tenant, tenantLinkResolver: tenantLinkResolver, size: "compact" })) })), jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground whitespace-nowrap shrink-0", children: jsxRuntime.jsx(Timestamp, { value: timestamp }) }), jsxRuntime.jsx(button.Button, { type: "quaternary", theme: "borderless", size: "small", className: "h-5 py-0 px-1 text-base text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0", onClick: toggleExpand, "aria-expanded": isExpanded, children: isExpanded ? "−" : "+" })] }), isExpanded && (jsxRuntime.jsx(ActivityExpandedDetails, { activity: activity, tenantLinkResolver: tenantLinkResolver, compact: true }))] }));
10552
+ return (jsxRuntime.jsxs("div", { className: cn(!isLast && !isExpanded && "border-b border-border", className), children: [jsxRuntime.jsxs("div", { className: cn("flex items-center gap-3 cursor-pointer group", density === "compact" ? "py-1.5" : "py-3", isSelected && "bg-muted/40"), onClick: toggleExpand, children: [jsxRuntime.jsx("div", { className: cn("rounded-md shrink-0 flex items-center justify-center", density === "compact" ? "w-6 h-6" : "w-8 h-8", iconBg, iconColor), children: jsxRuntime.jsx(Icon, { size: 16, strokeWidth: 2 }) }), jsxRuntime.jsx("div", { className: "flex-1 min-w-0 text-sm text-foreground leading-snug", children: jsxRuntime.jsx(ActivityFeedSummary, { summary: summary, links: links, onResourceClick: onResourceClick, resourceLinkResolver: resourceLinkResolver, resourceLinkContext: { tenant } }) }), tenant && (jsxRuntime.jsx("div", { className: "shrink-0", children: tenantRenderer ? (tenantRenderer(tenant)) : (jsxRuntime.jsx(TenantBadge, { tenant: tenant, tenantLinkResolver: tenantLinkResolver, size: "compact" })) })), jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground whitespace-nowrap shrink-0", children: jsxRuntime.jsx(Timestamp, { value: timestamp }) }), jsxRuntime.jsx(button.Button, { type: "quaternary", theme: "borderless", size: "small", className: "h-5 py-0 px-1 text-base text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0", onClick: toggleExpand, "aria-expanded": isExpanded, children: isExpanded ? "−" : "+" })] }), isExpanded && (jsxRuntime.jsx(ActivityExpandedDetails, { activity: activity, tenantLinkResolver: tenantLinkResolver, compact: true }))] }));
10429
10553
  }
10430
10554
  // Feed variant — flat-column table row. Columns: Actor | Summary |
10431
10555
  // Tenant | When | expand toggle. Renders an additional TableRow with a
@@ -10718,7 +10842,7 @@ const getSelectedPreset$1 = (timeRange) => {
10718
10842
  /**
10719
10843
  * ActivityFeedFilters provides filter controls for the activity feed
10720
10844
  */
10721
- function ActivityFeedFilters({ client, filters, timeRange, onFiltersChange, onTimeRangeChange, disabled = false, hiddenFilters = [], className = "", extraFilters, }) {
10845
+ function ActivityFeedFilters({ client, filters, timeRange, onFiltersChange, onTimeRangeChange, disabled = false, hiddenFilters = [], className = "", extraFilters, layout = "inline", }) {
10722
10846
  const { resourceKinds, actorNames, apiGroups, resourceNamespaces, error: facetsError, } = useFacets(client, timeRange, filters);
10723
10847
  // Log facets error for debugging
10724
10848
  if (facetsError) {
@@ -10938,12 +11062,186 @@ function ActivityFeedFilters({ client, filters, timeRange, onFiltersChange, onTi
10938
11062
  clearTimeout(searchDebounceRef.current);
10939
11063
  onFiltersChangeRef.current({ ...filtersRef.current, search: undefined });
10940
11064
  }, []);
11065
+ const searchInput = (jsxRuntime.jsxs("div", { className: "relative min-w-[200px] flex-1 max-w-xs", children: [jsxRuntime.jsx(Search, { className: "absolute left-2 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }), jsxRuntime.jsx(input.Input, { type: "text", placeholder: "Search activities...", value: searchInputValue, onChange: handleSearchChange, className: "pl-8 h-7 text-xs pr-6" }), searchInputValue && (jsxRuntime.jsx("button", { onClick: handleSearchClear, className: "absolute right-1.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors", "aria-label": "Clear search", children: jsxRuntime.jsx(X, { className: "h-3.5 w-3.5" }) }))] }));
11066
+ const changeSourceControl = !hiddenFilters.includes("changeSource") && (jsxRuntime.jsx(ChangeSourceToggle, { value: filters.changeSource || "all", onChange: handleChangeSourceChange, disabled: disabled }));
11067
+ const filterChips = activeFilterIds.map((filterId) => {
11068
+ const config = FILTER_CONFIGS$1[filterId];
11069
+ return (jsxRuntime.jsx(FilterChip, { label: config.label, values: getFilterValues(filterId), options: config.inputMode === "typeahead"
11070
+ ? getFilterOptions(filterId)
11071
+ : undefined, onValuesChange: (values) => handleFilterChange(filterId, values), onClear: () => handleFilterClear(filterId), onPopoverClose: () => handlePopoverClose(filterId), inputMode: config.inputMode, placeholder: config.placeholder, searchPlaceholder: config.searchPlaceholder, autoOpen: pendingFilter === filterId, disabled: disabled }, filterId));
11072
+ });
11073
+ const addFilterControl = (jsxRuntime.jsx(AddFilterDropdown, { availableFilters: availableFilters, activeFilterIds: activeFilterIds, onAddFilter: handleAddFilter, hasActiveFilters: activeFilterIds.length > 0, disabled: disabled }));
11074
+ const timeRangeControl = (jsxRuntime.jsx(TimeRangeDropdown, { presets: TIME_PRESETS$1, selectedPreset: selectedPreset, onPresetSelect: handleTimePresetSelect, onCustomRangeApply: handleCustomRangeApply, customStart: customStart, customEnd: customEnd, disabled: disabled, displayLabel: getTimeRangeLabel() }));
11075
+ if (layout === "compact") {
11076
+ const activeFilterCount = activeFilterIds.length +
11077
+ (!hiddenFilters.includes("changeSource") &&
11078
+ filters.changeSource &&
11079
+ filters.changeSource !== "all"
11080
+ ? 1
11081
+ : 0);
11082
+ return (jsxRuntime.jsx("div", { className: `border-b border-border py-4 ${className}`, children: jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2 items-center", children: [searchInput, jsxRuntime.jsxs(popover.Popover, { children: [jsxRuntime.jsx(popover.PopoverTrigger, { asChild: true, children: jsxRuntime.jsxs("button", { type: "button", disabled: disabled, className: cn("flex h-7 items-center gap-1.5 rounded-md border border-border bg-background px-2 text-xs", "text-muted-foreground hover:text-foreground hover:border-foreground/50 transition-colors", "focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", "disabled:cursor-not-allowed disabled:opacity-50"), children: [jsxRuntime.jsx(SlidersHorizontal, { className: "h-3.5 w-3.5" }), jsxRuntime.jsx("span", { className: "font-medium", children: "Filters" }), activeFilterCount > 0 && (jsxRuntime.jsx("span", { className: "ml-0.5 rounded-full bg-primary text-primary-foreground text-[10px] font-semibold leading-none px-1.5 py-0.5", children: activeFilterCount }))] }) }), jsxRuntime.jsx(popover.PopoverContent, { className: "w-[320px] p-3", sideOffset: 4, align: "start", children: jsxRuntime.jsxs("div", { className: "flex flex-col gap-3", children: [changeSourceControl, jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2 items-center", children: [filterChips, addFilterControl] }), extraFilters, timeRangeControl] }) })] })] }) }));
11083
+ }
10941
11084
  return (jsxRuntime.jsx("div", { className: `border-b border-border py-4 ${className}`, children: jsxRuntime.jsxs("div", { className: "flex flex-wrap gap-2 items-center", children: [!hiddenFilters.includes("changeSource") && (jsxRuntime.jsx(ChangeSourceToggle, { value: filters.changeSource || "all", onChange: handleChangeSourceChange, disabled: disabled })), jsxRuntime.jsxs("div", { className: "relative min-w-[200px] flex-1 max-w-xs", children: [jsxRuntime.jsx(Search, { className: "pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" }), jsxRuntime.jsx(input.Input, { type: "text", placeholder: "Search activities...", value: searchInputValue, onChange: handleSearchChange, className: "h-9 pl-9 pr-9 text-xs md:text-xs" }), searchInputValue && (jsxRuntime.jsx("button", { onClick: handleSearchClear, className: "absolute right-0 top-0 flex h-9 w-9 items-center justify-center rounded-r-lg text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring", "aria-label": "Clear search", children: jsxRuntime.jsx(X, { className: "h-3.5 w-3.5" }) }))] }), activeFilterIds.map((filterId) => {
10942
11085
  const config = FILTER_CONFIGS$1[filterId];
10943
11086
  return (jsxRuntime.jsx(FilterChip, { label: config.label, values: getFilterValues(filterId), options: config.inputMode === "typeahead"
10944
11087
  ? getFilterOptions(filterId)
10945
11088
  : undefined, onValuesChange: (values) => handleFilterChange(filterId, values), onClear: () => handleFilterClear(filterId), onPopoverClose: () => handlePopoverClose(filterId), inputMode: config.inputMode, placeholder: config.placeholder, searchPlaceholder: config.searchPlaceholder, autoOpen: pendingFilter === filterId, disabled: disabled }, filterId));
10946
- }), jsxRuntime.jsx(AddFilterDropdown, { availableFilters: availableFilters, activeFilterIds: activeFilterIds, onAddFilter: handleAddFilter, hasActiveFilters: activeFilterIds.length > 0, disabled: disabled }), extraFilters, jsxRuntime.jsx("div", { className: "flex-1 min-w-[20px]" }), jsxRuntime.jsx(TimeRangeDropdown, { presets: TIME_PRESETS$1, selectedPreset: selectedPreset, onPresetSelect: handleTimePresetSelect, onCustomRangeApply: handleCustomRangeApply, customStart: customStart, customEnd: customEnd, disabled: disabled, displayLabel: getTimeRangeLabel() })] }) }));
11089
+ }), jsxRuntime.jsx(AddFilterDropdown, { availableFilters: availableFilters, activeFilterIds: activeFilterIds, onAddFilter: handleAddFilter, hasActiveFilters: activeFilterIds.length > 0, disabled: disabled }), extraFilters, jsxRuntime.jsx("div", { className: "flex-1 min-w-[20px]" }), timeRangeControl] }) }));
11090
+ }
11091
+
11092
+ const KIND_PLURALS = {
11093
+ DNSRecordSet: "DNS records",
11094
+ };
11095
+ function pluralizeKind(kind, count) {
11096
+ if (count === 1)
11097
+ return kind;
11098
+ return KIND_PLURALS[kind] ?? `${kind}s`;
11099
+ }
11100
+ const VERB_LABEL = {
11101
+ create: "created",
11102
+ update: "updated",
11103
+ delete: "deleted",
11104
+ other: "changed",
11105
+ };
11106
+ /**
11107
+ * ActivityFeedGroupItem renders a run of consecutive same verb/kind/actor
11108
+ * activities (see `groupActivities`) as a single collapsed row in the
11109
+ * "digest" timeline. A group of size 1 renders exactly like a normal
11110
+ * `ActivityFeedItem` — no visual change for ungrouped activities. Larger
11111
+ * groups render a synthesized summary ("{actor} created 12 DNS records")
11112
+ * that expands to reveal the individual activities underneath.
11113
+ */
11114
+ function ActivityFeedGroupItem({ group, resourceLinkResolver, tenantLinkResolver, tenantRenderer, onActorClick, onActivityClick, isLast = false, }) {
11115
+ const [isExpanded, setIsExpanded] = React.useState(false);
11116
+ if (group.count === 1) {
11117
+ return (jsxRuntime.jsx(ActivityFeedItem, { activity: group.activities[0], resourceLinkResolver: resourceLinkResolver, tenantLinkResolver: tenantLinkResolver, tenantRenderer: tenantRenderer, onActorClick: onActorClick, onActivityClick: onActivityClick, variant: "timeline", density: "compact", isLast: isLast }));
11118
+ }
11119
+ const { container: iconBg, icon: iconColor } = getActionIconClasses(group.verb);
11120
+ const Icon = getTimelineIcon(group.verb);
11121
+ const actorVisible = group.actorDisplayName || group.actorName;
11122
+ const summary = `${actorVisible} ${VERB_LABEL[group.verb]} ${group.count} ${pluralizeKind(group.kind, group.count)}`;
11123
+ const toggleExpand = (e) => {
11124
+ e.stopPropagation();
11125
+ setIsExpanded((prev) => !prev);
11126
+ };
11127
+ return (jsxRuntime.jsxs("div", { className: cn(!isLast && !isExpanded && "border-b border-border"), children: [jsxRuntime.jsxs("div", { className: "flex items-center gap-3 py-1.5 cursor-pointer group", onClick: toggleExpand, children: [jsxRuntime.jsxs("div", { className: cn("w-6 h-6 rounded-md shrink-0 flex items-center justify-center relative", iconBg, iconColor), children: [jsxRuntime.jsx(Icon, { size: 14, strokeWidth: 2 }), jsxRuntime.jsx("span", { className: "absolute -bottom-1 -right-1 rounded-full bg-background border border-border px-1 text-[10px] font-semibold leading-tight text-foreground", children: group.count })] }), jsxRuntime.jsx("div", { className: "flex-1 min-w-0 text-xs text-foreground leading-normal", children: summary }), group.tenant && (jsxRuntime.jsx("div", { className: "shrink-0", children: tenantRenderer ? (tenantRenderer(group.tenant)) : (jsxRuntime.jsx(TenantBadge, { tenant: group.tenant, tenantLinkResolver: tenantLinkResolver, size: "compact" })) })), jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground whitespace-nowrap shrink-0", children: jsxRuntime.jsx(Timestamp, { value: group.latestTimestamp }) }), jsxRuntime.jsx(button.Button, { type: "quaternary", theme: "borderless", size: "small", className: "h-5 py-0 px-1 text-base text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity shrink-0", onClick: toggleExpand, "aria-expanded": isExpanded, children: isExpanded ? "−" : "+" })] }), isExpanded && (jsxRuntime.jsx("div", { className: "pl-11 flex flex-col", children: group.activities.map((activity, index) => (jsxRuntime.jsx(ActivityFeedItem, { activity: activity, resourceLinkResolver: resourceLinkResolver, tenantLinkResolver: tenantLinkResolver, tenantRenderer: tenantRenderer, onActorClick: onActorClick, onActivityClick: onActivityClick, compact: true, density: "compact", variant: "timeline", isLast: index === group.activities.length - 1 }, activity.metadata?.uid || activity.metadata?.name))) }))] }));
11128
+ }
11129
+
11130
+ /**
11131
+ * Thin stat strip summarizing the activities currently loaded in the feed —
11132
+ * e.g. "18 changes · 3 people · 1 system". Computed client-side over the
11133
+ * loaded/paginated activities; it is a quick-glance headline, not a
11134
+ * full-range aggregate (that would require a backend facet query).
11135
+ */
11136
+ function ActivityDigestSummary({ activities, className = "" }) {
11137
+ const stats = React.useMemo(() => {
11138
+ const humanActors = new Set();
11139
+ const systemActors = new Set();
11140
+ for (const activity of activities) {
11141
+ const { actor, changeSource } = activity.spec;
11142
+ if (changeSource === "human") {
11143
+ humanActors.add(actor.name);
11144
+ }
11145
+ else {
11146
+ systemActors.add(actor.name);
11147
+ }
11148
+ }
11149
+ return {
11150
+ total: activities.length,
11151
+ people: humanActors.size,
11152
+ systems: systemActors.size,
11153
+ };
11154
+ }, [activities]);
11155
+ if (stats.total === 0)
11156
+ return null;
11157
+ const parts = [`${stats.total} ${stats.total === 1 ? "change" : "changes"}`];
11158
+ if (stats.people > 0)
11159
+ parts.push(`${stats.people} ${stats.people === 1 ? "person" : "people"}`);
11160
+ if (stats.systems > 0)
11161
+ parts.push(`${stats.systems} ${stats.systems === 1 ? "system" : "systems"}`);
11162
+ return (jsxRuntime.jsx("div", { className: `px-1 pt-4 pb-2 text-xs text-muted-foreground ${className}`, children: parts.join(" · ") }));
11163
+ }
11164
+
11165
+ function tenantKey(tenant) {
11166
+ if (!tenant)
11167
+ return '';
11168
+ return `${tenant.type}:${tenant.name}`;
11169
+ }
11170
+ function groupSignature(activity) {
11171
+ const { spec } = activity;
11172
+ const verb = normalizeVerb(extractVerb(spec.summary));
11173
+ return [verb, spec.resource.kind, spec.actor.name, tenantKey(spec.tenant)].join('|');
11174
+ }
11175
+ /**
11176
+ * Group consecutive activities that share verb + resource kind + actor +
11177
+ * tenant. Activities are assumed to already be sorted newest-first (as
11178
+ * returned by `useActivityFeed`); only adjacent items are merged, so a
11179
+ * burst of matching activities collapses into one group without needing
11180
+ * any time-window heuristics.
11181
+ */
11182
+ function groupActivities(activities) {
11183
+ const groups = [];
11184
+ for (const activity of activities) {
11185
+ const signature = groupSignature(activity);
11186
+ const last = groups[groups.length - 1];
11187
+ if (last && last.key === signature) {
11188
+ last.activities.push(activity);
11189
+ last.count += 1;
11190
+ continue;
11191
+ }
11192
+ const { spec } = activity;
11193
+ groups.push({
11194
+ key: signature,
11195
+ verb: normalizeVerb(extractVerb(spec.summary)),
11196
+ kind: spec.resource.kind,
11197
+ actorName: spec.actor.name,
11198
+ actorDisplayName: spec.actor.displayName,
11199
+ tenant: spec.tenant,
11200
+ activities: [activity],
11201
+ count: 1,
11202
+ latestTimestamp: activity.metadata?.creationTimestamp,
11203
+ });
11204
+ }
11205
+ return groups;
11206
+ }
11207
+ function dayLabel(timestamp) {
11208
+ if (!timestamp)
11209
+ return 'Unknown date';
11210
+ const date = new Date(timestamp);
11211
+ if (Number.isNaN(date.getTime()))
11212
+ return 'Unknown date';
11213
+ if (isToday(date))
11214
+ return 'Today';
11215
+ if (isYesterday(date))
11216
+ return 'Yesterday';
11217
+ return format(date, 'MMMM d, yyyy');
11218
+ }
11219
+ /**
11220
+ * Bucket activities into calendar-day sections (Today / Yesterday / a
11221
+ * formatted date), then group consecutive matching activities within each
11222
+ * day. Bucketing by day first (rather than grouping across the whole list)
11223
+ * keeps a group from silently spanning a day boundary.
11224
+ */
11225
+ function groupActivitiesByDay(activities) {
11226
+ const sections = [];
11227
+ let currentLabel = null;
11228
+ let currentBucket = [];
11229
+ const flush = () => {
11230
+ if (currentLabel !== null && currentBucket.length > 0) {
11231
+ sections.push({ label: currentLabel, groups: groupActivities(currentBucket) });
11232
+ }
11233
+ };
11234
+ for (const activity of activities) {
11235
+ const label = dayLabel(activity.metadata?.creationTimestamp);
11236
+ if (label !== currentLabel) {
11237
+ flush();
11238
+ currentLabel = label;
11239
+ currentBucket = [];
11240
+ }
11241
+ currentBucket.push(activity);
11242
+ }
11243
+ flush();
11244
+ return sections;
10947
11245
  }
10948
11246
 
10949
11247
  /**
@@ -11074,10 +11372,10 @@ function ActivityFeed({ client, initialFilters = { changeSource: "human" }, init
11074
11372
  // Parent containers must have proper height constraints (h-screen/h-full + overflow-hidden)
11075
11373
  const effectiveMaxHeight = maxHeight === "none" ? undefined : maxHeight;
11076
11374
  const listClasses = "flex-1 min-h-0 overflow-y-auto flex flex-col";
11077
- return (jsxRuntime.jsx(TooltipProvider, { delayDuration: 200, children: jsxRuntime.jsxs(card.Card, { className: containerClasses, children: [enableStreaming && (jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsxs("div", { className: "flex items-center", children: [isStreaming && !watchError && (jsxRuntime.jsx(TooltipProvider, { delayDuration: 300, children: jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsxs("span", { className: "relative flex h-2 w-2", children: [jsxRuntime.jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-[var(--success-500)] opacity-75" }), jsxRuntime.jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-[var(--success-500)]" })] }), jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: "Streaming activity..." })] }) }), jsxRuntime.jsx(TooltipContent, { className: "text-xs", children: jsxRuntime.jsx("p", { children: "New activities will appear automatically" }) })] }) })), watchError && (jsxRuntime.jsx(TooltipProvider, { delayDuration: 300, children: jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("span", { className: "relative flex h-2 w-2", children: jsxRuntime.jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-destructive" }) }), jsxRuntime.jsx("span", { className: "text-xs text-destructive", children: "Connection error" })] }) }), jsxRuntime.jsx(TooltipContent, { className: "text-xs", children: jsxRuntime.jsx("p", { children: "Stream connection lost" }) })] }) })), newActivitiesCount > 0 && !watchError && (jsxRuntime.jsxs(Badge, { variant: "secondary", className: "text-xs", children: ["+", newActivitiesCount, " new"] }))] }), jsxRuntime.jsx(button.Button, { type: "tertiary", theme: "outline", size: "small", onClick: handleStreamingToggle, children: watchError ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("svg", { className: "w-4 h-4 mr-1.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", strokeWidth: "2", children: [jsxRuntime.jsx("path", { d: "M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4" }), jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "3" })] }), "Retry"] })) : isStreaming ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("svg", { className: "w-4 h-4 mr-1.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [jsxRuntime.jsx("rect", { x: "6", y: "4", width: "4", height: "16" }), jsxRuntime.jsx("rect", { x: "14", y: "4", width: "4", height: "16" })] }), "Pause"] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("svg", { className: "w-4 h-4 mr-1.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: jsxRuntime.jsx("polygon", { points: "5,3 19,12 5,21", fill: "currentColor" }) }), "Resume"] })) })] })), showFilters && (jsxRuntime.jsx(ActivityFeedFilters, { client: client, filters: filters, timeRange: timeRange, onFiltersChange: handleFiltersChange, onTimeRangeChange: handleTimeRangeChange, disabled: isLoading, hiddenFilters: hiddenFilters })), jsxRuntime.jsx(ApiErrorAlert, { error: error, onRetry: refresh, className: "mb-4", errorFormatter: errorFormatter }), jsxRuntime.jsx(ApiErrorAlert, { error: watchError, onRetry: startStreaming, className: "mb-4", errorFormatter: errorFormatter }), !policiesLoading && hasPolicies === false && (jsxRuntime.jsxs("div", { className: "flex flex-col items-center py-12 px-8 text-center bg-muted border border-dashed border-border rounded-xl mb-4", children: [jsxRuntime.jsx("div", { className: "flex justify-center mb-4 text-muted-foreground", children: jsxRuntime.jsxs("svg", { width: "56", height: "56", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntime.jsx("path", { d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2" }), jsxRuntime.jsx("rect", { x: "9", y: "3", width: "6", height: "4", rx: "1" }), jsxRuntime.jsx("path", { d: "M9 12h6" }), jsxRuntime.jsx("path", { d: "M9 16h6" })] }) }), jsxRuntime.jsx("h3", { className: "m-0 mb-2 text-lg font-semibold text-foreground leading-snug", children: "Get started with activity logging" }), jsxRuntime.jsx("p", { className: "m-0 mb-6 text-sm leading-relaxed text-muted-foreground max-w-[400px]", children: "Activity policies define which resources to track and how to summarize changes. Create your first policy to start seeing activity logs here." }), onCreatePolicy && (jsxRuntime.jsx(button.Button, { onClick: onCreatePolicy, children: "Create Policy" }))] })), jsxRuntime.jsxs("div", { className: listClasses, ref: scrollContainerRef, style: effectiveMaxHeight ? { maxHeight: effectiveMaxHeight } : undefined, children: [!isLoading &&
11375
+ return (jsxRuntime.jsx(TooltipProvider, { delayDuration: 200, children: jsxRuntime.jsxs(card.Card, { className: containerClasses, children: [enableStreaming && (jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [jsxRuntime.jsxs("div", { className: "flex items-center", children: [isStreaming && !watchError && (jsxRuntime.jsx(TooltipProvider, { delayDuration: 300, children: jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsxs("span", { className: "relative flex h-2 w-2", children: [jsxRuntime.jsx("span", { className: "animate-ping absolute inline-flex h-full w-full rounded-full bg-[var(--success-500)] opacity-75" }), jsxRuntime.jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-[var(--success-500)]" })] }), jsxRuntime.jsx("span", { className: "text-xs text-muted-foreground", children: "Streaming activity..." })] }) }), jsxRuntime.jsx(TooltipContent, { className: "text-xs", children: jsxRuntime.jsx("p", { children: "New activities will appear automatically" }) })] }) })), watchError && (jsxRuntime.jsx(TooltipProvider, { delayDuration: 300, children: jsxRuntime.jsxs(Tooltip, { children: [jsxRuntime.jsx(TooltipTrigger, { asChild: true, children: jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntime.jsx("span", { className: "relative flex h-2 w-2", children: jsxRuntime.jsx("span", { className: "relative inline-flex rounded-full h-2 w-2 bg-destructive" }) }), jsxRuntime.jsx("span", { className: "text-xs text-destructive", children: "Connection error" })] }) }), jsxRuntime.jsx(TooltipContent, { className: "text-xs", children: jsxRuntime.jsx("p", { children: "Stream connection lost" }) })] }) })), newActivitiesCount > 0 && !watchError && (jsxRuntime.jsxs(Badge, { variant: "secondary", className: "text-xs", children: ["+", newActivitiesCount, " new"] }))] }), jsxRuntime.jsx(button.Button, { type: "tertiary", theme: "outline", size: "small", onClick: handleStreamingToggle, children: watchError ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("svg", { className: "w-4 h-4 mr-1.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", strokeWidth: "2", children: [jsxRuntime.jsx("path", { d: "M21 2l-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0l3 3L22 7l-3-3m-3.5 3.5L19 4" }), jsxRuntime.jsx("circle", { cx: "12", cy: "12", r: "3" })] }), "Retry"] })) : isStreaming ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("svg", { className: "w-4 h-4 mr-1.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [jsxRuntime.jsx("rect", { x: "6", y: "4", width: "4", height: "16" }), jsxRuntime.jsx("rect", { x: "14", y: "4", width: "4", height: "16" })] }), "Pause"] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("svg", { className: "w-4 h-4 mr-1.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: jsxRuntime.jsx("polygon", { points: "5,3 19,12 5,21", fill: "currentColor" }) }), "Resume"] })) })] })), showFilters && (jsxRuntime.jsx(ActivityFeedFilters, { client: client, filters: filters, timeRange: timeRange, onFiltersChange: handleFiltersChange, onTimeRangeChange: handleTimeRangeChange, disabled: isLoading, hiddenFilters: hiddenFilters, layout: variant === "digest" ? "compact" : "inline" })), variant === "digest" && !isLoading && activities.length > 0 && (jsxRuntime.jsx(ActivityDigestSummary, { activities: activities })), jsxRuntime.jsx(ApiErrorAlert, { error: error, onRetry: refresh, className: "mb-4", errorFormatter: errorFormatter }), jsxRuntime.jsx(ApiErrorAlert, { error: watchError, onRetry: startStreaming, className: "mb-4", errorFormatter: errorFormatter }), !policiesLoading && hasPolicies === false && (jsxRuntime.jsxs("div", { className: "flex flex-col items-center py-12 px-8 text-center bg-muted border border-dashed border-border rounded-xl mb-4", children: [jsxRuntime.jsx("div", { className: "flex justify-center mb-4 text-muted-foreground", children: jsxRuntime.jsxs("svg", { width: "56", height: "56", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round", children: [jsxRuntime.jsx("path", { d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2" }), jsxRuntime.jsx("rect", { x: "9", y: "3", width: "6", height: "4", rx: "1" }), jsxRuntime.jsx("path", { d: "M9 12h6" }), jsxRuntime.jsx("path", { d: "M9 16h6" })] }) }), jsxRuntime.jsx("h3", { className: "m-0 mb-2 text-lg font-semibold text-foreground leading-snug", children: "Get started with activity logging" }), jsxRuntime.jsx("p", { className: "m-0 mb-6 text-sm leading-relaxed text-muted-foreground max-w-[400px]", children: "Activity policies define which resources to track and how to summarize changes. Create your first policy to start seeing activity logs here." }), onCreatePolicy && (jsxRuntime.jsx(button.Button, { onClick: onCreatePolicy, children: "Create Policy" }))] })), jsxRuntime.jsxs("div", { className: listClasses, ref: scrollContainerRef, style: effectiveMaxHeight ? { maxHeight: effectiveMaxHeight } : undefined, children: [!isLoading &&
11078
11376
  activities.length === 0 &&
11079
11377
  hasPolicies !== false &&
11080
- variant === "timeline" && (jsxRuntime.jsxs("div", { className: "py-12 text-center text-muted-foreground", children: [jsxRuntime.jsx("p", { className: "m-0", children: "No activities found" }), jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-2 m-0", children: "Try adjusting your filters or time range" })] })), variant === "timeline" ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isLoading && activities.length === 0 && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 8 }).map((_, index) => (jsxRuntime.jsx(ActivityFeedItemSkeleton, { compact: compact }, index))) })), activities.map((activity, index) => (jsxRuntime.jsx(ActivityFeedItem, { activity: activity, onResourceClick: onResourceClick, resourceLinkResolver: resourceLinkResolver, tenantLinkResolver: tenantLinkResolver, tenantRenderer: tenantRenderer, onActorClick: handleActorClick, onActivityClick: onActivityClick, compact: compact, isNew: enableStreaming && index < newActivitiesCount, variant: variant, isLast: index === activities.length - 1 }, activity.metadata?.uid || activity.metadata?.name)))] })) : (jsxRuntime.jsxs(table.Table, { className: "w-full", children: [jsxRuntime.jsx(table.TableHeader, { children: jsxRuntime.jsxs(table.TableRow, { children: [jsxRuntime.jsx(table.TableHead, { className: "w-12", "aria-label": "Actor" }), jsxRuntime.jsx(table.TableHead, { children: "Summary" }), jsxRuntime.jsx(table.TableHead, { children: "Tenant" }), jsxRuntime.jsx(table.TableHead, { className: "w-[170px]", children: "When" }), jsxRuntime.jsx(table.TableHead, { className: "w-10", "aria-label": "Expand" })] }) }), jsxRuntime.jsxs(table.TableBody, { children: [isLoading && activities.length === 0 && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 8 }).map((_, index) => (jsxRuntime.jsxs(table.TableRow, { children: [jsxRuntime.jsx(table.TableCell, { className: "py-2", children: jsxRuntime.jsx(skeleton.Skeleton, { className: "h-6 w-6 rounded-full" }) }), jsxRuntime.jsx(table.TableCell, { className: "py-2", children: jsxRuntime.jsx(skeleton.Skeleton, { className: "h-4 w-3/4" }) }), jsxRuntime.jsx(table.TableCell, { className: "py-2", children: jsxRuntime.jsx(skeleton.Skeleton, { className: "h-5 w-32 rounded-full" }) }), jsxRuntime.jsx(table.TableCell, { className: "py-2", children: jsxRuntime.jsx(skeleton.Skeleton, { className: "h-4 w-24" }) }), jsxRuntime.jsx(table.TableCell, { className: "py-2", children: jsxRuntime.jsx(skeleton.Skeleton, { className: "h-6 w-6" }) })] }, `sk-${index}`))) })), !isLoading &&
11378
+ (variant === "timeline" || variant === "digest") && (jsxRuntime.jsxs("div", { className: "py-12 text-center text-muted-foreground", children: [jsxRuntime.jsx("p", { className: "m-0", children: "No activities found" }), jsxRuntime.jsx("p", { className: "text-sm text-muted-foreground mt-2 m-0", children: "Try adjusting your filters or time range" })] })), variant === "digest" ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isLoading && activities.length === 0 && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 8 }).map((_, index) => (jsxRuntime.jsx(ActivityFeedItemSkeleton, { compact: compact }, index))) })), groupActivitiesByDay(activities).map((section) => (jsxRuntime.jsxs("div", { className: "flex flex-col", children: [jsxRuntime.jsx("div", { className: "sticky top-0 z-10 bg-card pt-2 pb-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground", children: section.label }), section.groups.map((group, index) => (jsxRuntime.jsx(ActivityFeedGroupItem, { group: group, resourceLinkResolver: resourceLinkResolver, tenantLinkResolver: tenantLinkResolver, tenantRenderer: tenantRenderer, onActorClick: handleActorClick, onActivityClick: onActivityClick, isLast: index === section.groups.length - 1 }, `${section.label}-${group.key}-${index}`)))] }, section.label)))] })) : variant === "timeline" ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [isLoading && activities.length === 0 && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 8 }).map((_, index) => (jsxRuntime.jsx(ActivityFeedItemSkeleton, { compact: compact }, index))) })), activities.map((activity, index) => (jsxRuntime.jsx(ActivityFeedItem, { activity: activity, onResourceClick: onResourceClick, resourceLinkResolver: resourceLinkResolver, tenantLinkResolver: tenantLinkResolver, tenantRenderer: tenantRenderer, onActorClick: handleActorClick, onActivityClick: onActivityClick, compact: compact, isNew: enableStreaming && index < newActivitiesCount, variant: variant, isLast: index === activities.length - 1 }, activity.metadata?.uid || activity.metadata?.name)))] })) : (jsxRuntime.jsxs(table.Table, { className: "w-full", children: [jsxRuntime.jsx(table.TableHeader, { children: jsxRuntime.jsxs(table.TableRow, { children: [jsxRuntime.jsx(table.TableHead, { className: "w-12", "aria-label": "Actor" }), jsxRuntime.jsx(table.TableHead, { children: "Summary" }), jsxRuntime.jsx(table.TableHead, { children: "Tenant" }), jsxRuntime.jsx(table.TableHead, { className: "w-[170px]", children: "When" }), jsxRuntime.jsx(table.TableHead, { className: "w-10", "aria-label": "Expand" })] }) }), jsxRuntime.jsxs(table.TableBody, { children: [isLoading && activities.length === 0 && (jsxRuntime.jsx(jsxRuntime.Fragment, { children: Array.from({ length: 8 }).map((_, index) => (jsxRuntime.jsxs(table.TableRow, { children: [jsxRuntime.jsx(table.TableCell, { className: "py-2", children: jsxRuntime.jsx(skeleton.Skeleton, { className: "h-6 w-6 rounded-full" }) }), jsxRuntime.jsx(table.TableCell, { className: "py-2", children: jsxRuntime.jsx(skeleton.Skeleton, { className: "h-4 w-3/4" }) }), jsxRuntime.jsx(table.TableCell, { className: "py-2", children: jsxRuntime.jsx(skeleton.Skeleton, { className: "h-5 w-32 rounded-full" }) }), jsxRuntime.jsx(table.TableCell, { className: "py-2", children: jsxRuntime.jsx(skeleton.Skeleton, { className: "h-4 w-24" }) }), jsxRuntime.jsx(table.TableCell, { className: "py-2", children: jsxRuntime.jsx(skeleton.Skeleton, { className: "h-6 w-6" }) })] }, `sk-${index}`))) })), !isLoading &&
11081
11379
  activities.length === 0 &&
11082
11380
  hasPolicies !== false && (jsxRuntime.jsx(table.TableRow, { children: jsxRuntime.jsxs(table.TableCell, { colSpan: ACTIVITY_FEED_COLUMN_COUNT, className: "text-center py-12 text-muted-foreground", children: [jsxRuntime.jsx("div", { children: "No activities found" }), jsxRuntime.jsx("div", { className: "text-sm mt-2", children: "Try adjusting your filters or time range" })] }) })), activities.map((activity, index) => (jsxRuntime.jsx(ActivityFeedItem, { activity: activity, onResourceClick: onResourceClick, resourceLinkResolver: resourceLinkResolver, tenantLinkResolver: tenantLinkResolver, tenantRenderer: tenantRenderer, onActorClick: handleActorClick, onActivityClick: onActivityClick, compact: compact, isNew: enableStreaming && index < newActivitiesCount, variant: variant, isLast: index === activities.length - 1 }, activity.metadata?.uid || activity.metadata?.name)))] })] })), infiniteScroll && hasMore && (jsxRuntime.jsx("div", { ref: loadMoreTriggerRef, className: "h-px mt-4" })), !infiniteScroll && activities.length > 0 ? (jsxRuntime.jsxs("div", { className: "flex items-center justify-between gap-4 px-4 py-3 border-t border-border text-sm text-muted-foreground", children: [jsxRuntime.jsxs("span", { children: [activities.length, " ", activities.length === 1 ? "activity" : "activities", hasMore ? " so far" : ""] }), hasMore ? (jsxRuntime.jsx(button.Button, { type: "tertiary", theme: "outline", size: "small", htmlType: "button", onClick: handleLoadMoreClick, disabled: isLoading, children: isLoading ? "Loading…" : "Load more" })) : (jsxRuntime.jsx("span", { children: "End of results" }))] })) : null] })] }) }));
11083
11381
  }
@@ -16587,9 +16885,11 @@ exports.AUDIT_TEMPLATES = AUDIT_TEMPLATES;
16587
16885
  exports.ActionMultiSelect = ActionMultiSelect;
16588
16886
  exports.ActionToggle = ActionToggle;
16589
16887
  exports.ActivityApiClient = ActivityApiClient;
16888
+ exports.ActivityDigestSummary = ActivityDigestSummary;
16590
16889
  exports.ActivityExpandedDetails = ActivityExpandedDetails;
16591
16890
  exports.ActivityFeed = ActivityFeed;
16592
16891
  exports.ActivityFeedFilters = ActivityFeedFilters;
16892
+ exports.ActivityFeedGroupItem = ActivityFeedGroupItem;
16593
16893
  exports.ActivityFeedItem = ActivityFeedItem;
16594
16894
  exports.ActivityFeedItemSkeleton = ActivityFeedItemSkeleton;
16595
16895
  exports.ActivityFeedSummary = ActivityFeedSummary;
@@ -16669,6 +16969,8 @@ exports.extractFieldPathsFromMany = extractFieldPathsFromMany;
16669
16969
  exports.generateShareableUrl = generateShareableUrl;
16670
16970
  exports.getReindexJobDuration = getReindexJobDuration;
16671
16971
  exports.getReindexJobStatusMessage = getReindexJobStatusMessage;
16972
+ exports.groupActivities = groupActivities;
16973
+ exports.groupActivitiesByDay = groupActivitiesByDay;
16672
16974
  exports.isEventRecord = isEventRecord;
16673
16975
  exports.isReindexJobRunning = isReindexJobRunning;
16674
16976
  exports.isReindexJobTerminal = isReindexJobTerminal;