@mediaradar/design-components 0.40.0 → 0.42.0
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/approved-components.json +1 -1
- package/dist/index.cjs +238 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +62 -8
- package/dist/index.d.ts +62 -8
- package/dist/index.js +245 -47
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1071,7 +1071,7 @@ function NavBtn({ children, onClick, ...rest }) {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
|
|
1073
1073
|
// src/SearchBar.tsx
|
|
1074
|
-
import { useEffect as useEffect4, useId as useId3, useRef as useRef4, useState as useState4 } from "react";
|
|
1074
|
+
import { useEffect as useEffect4, useId as useId3, useLayoutEffect as useLayoutEffect2, useRef as useRef4, useState as useState4 } from "react";
|
|
1075
1075
|
import { AlertCircle, Check as Check3, ChevronDown as ChevronDown3, Search as Search3, X as X2 } from "lucide-react";
|
|
1076
1076
|
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1077
1077
|
var HEIGHT = { sm: "h-8", md: "h-10", lg: "h-11" };
|
|
@@ -1082,6 +1082,23 @@ var MODE_LABEL = {
|
|
|
1082
1082
|
contextual: "Contextual",
|
|
1083
1083
|
adCode: "Ad Code"
|
|
1084
1084
|
};
|
|
1085
|
+
function parseAdCodes(text) {
|
|
1086
|
+
return text.split(/[\s,;]+/).map((c) => c.trim()).filter(Boolean);
|
|
1087
|
+
}
|
|
1088
|
+
function mergeAdCodes(existing, incoming) {
|
|
1089
|
+
const seen = new Set(existing.map((c) => c.toUpperCase()));
|
|
1090
|
+
const out = [...existing];
|
|
1091
|
+
for (const code of incoming) {
|
|
1092
|
+
const key = code.toUpperCase();
|
|
1093
|
+
if (seen.has(key)) continue;
|
|
1094
|
+
seen.add(key);
|
|
1095
|
+
out.push(code);
|
|
1096
|
+
}
|
|
1097
|
+
return out;
|
|
1098
|
+
}
|
|
1099
|
+
function slug3(value) {
|
|
1100
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
1101
|
+
}
|
|
1085
1102
|
function cx2(...classes) {
|
|
1086
1103
|
return classes.filter(Boolean).join(" ");
|
|
1087
1104
|
}
|
|
@@ -1093,12 +1110,53 @@ function SearchBar({
|
|
|
1093
1110
|
size = "lg",
|
|
1094
1111
|
matchValue,
|
|
1095
1112
|
onMatchChange,
|
|
1113
|
+
adCodes = [],
|
|
1114
|
+
onAdCodesChange,
|
|
1115
|
+
isAdCodeMatched,
|
|
1116
|
+
onDownloadAdCodes,
|
|
1096
1117
|
className,
|
|
1097
1118
|
testIdPrefix
|
|
1098
1119
|
}) {
|
|
1099
1120
|
const [open, setOpen] = useState4(false);
|
|
1100
1121
|
const ref = useRef4(null);
|
|
1101
1122
|
const input = useRef4(null);
|
|
1123
|
+
const [codesOpen, setCodesOpen] = useState4(false);
|
|
1124
|
+
const codesRef = useRef4(null);
|
|
1125
|
+
const codesPopover = useRef4(null);
|
|
1126
|
+
const refocus = useRef4(null);
|
|
1127
|
+
const adCodeMode = variant === "filterable" && matchValue?.mode === "adCode" && !!onAdCodesChange;
|
|
1128
|
+
const matchedCount = adCodes.filter((c) => isAdCodeMatched?.(c)).length;
|
|
1129
|
+
const hasMisses = !!isAdCodeMatched && matchedCount < adCodes.length;
|
|
1130
|
+
useEffect4(() => {
|
|
1131
|
+
if (!codesOpen) return;
|
|
1132
|
+
const onKey = (e) => {
|
|
1133
|
+
if (e.key !== "Escape") return;
|
|
1134
|
+
setCodesOpen(false);
|
|
1135
|
+
input.current?.focus();
|
|
1136
|
+
};
|
|
1137
|
+
const onClick = (e) => {
|
|
1138
|
+
if (codesRef.current && !codesRef.current.contains(e.target)) setCodesOpen(false);
|
|
1139
|
+
};
|
|
1140
|
+
window.addEventListener("keydown", onKey);
|
|
1141
|
+
window.addEventListener("mousedown", onClick);
|
|
1142
|
+
return () => {
|
|
1143
|
+
window.removeEventListener("keydown", onKey);
|
|
1144
|
+
window.removeEventListener("mousedown", onClick);
|
|
1145
|
+
};
|
|
1146
|
+
}, [codesOpen]);
|
|
1147
|
+
useLayoutEffect2(() => {
|
|
1148
|
+
const i = refocus.current;
|
|
1149
|
+
if (i === null) return;
|
|
1150
|
+
refocus.current = null;
|
|
1151
|
+
const buttons = codesPopover.current?.querySelectorAll("[data-remove-code]");
|
|
1152
|
+
if (i >= 0 && buttons && buttons.length > 0) buttons[Math.min(i, buttons.length - 1)].focus();
|
|
1153
|
+
else input.current?.focus();
|
|
1154
|
+
}, [adCodes]);
|
|
1155
|
+
const updateCodes = (next, focusIndex) => {
|
|
1156
|
+
refocus.current = next.length ? focusIndex : -1;
|
|
1157
|
+
if (!next.length) setCodesOpen(false);
|
|
1158
|
+
onAdCodesChange?.(next);
|
|
1159
|
+
};
|
|
1102
1160
|
useEffect4(() => {
|
|
1103
1161
|
if (!open) return;
|
|
1104
1162
|
const onKey = (e) => e.key === "Escape" && setOpen(false);
|
|
@@ -1117,27 +1175,158 @@ function SearchBar({
|
|
|
1117
1175
|
"div",
|
|
1118
1176
|
{
|
|
1119
1177
|
className: cx2(
|
|
1120
|
-
"flex min-w-[200px] flex-1 items-stretch rounded-control border border-border-strong bg-input focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus",
|
|
1178
|
+
"relative flex min-w-[200px] flex-1 items-stretch rounded-control border border-border-strong bg-input focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus",
|
|
1121
1179
|
HEIGHT[size],
|
|
1122
1180
|
className
|
|
1123
1181
|
),
|
|
1124
1182
|
children: [
|
|
1125
|
-
/* @__PURE__ */ jsxs8(
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1183
|
+
/* @__PURE__ */ jsxs8(
|
|
1184
|
+
"div",
|
|
1185
|
+
{
|
|
1186
|
+
ref: codesRef,
|
|
1187
|
+
className: "flex min-w-0 flex-1 cursor-text items-center gap-2 px-2.5",
|
|
1188
|
+
onMouseDown: (e) => {
|
|
1189
|
+
if (e.target === e.currentTarget) {
|
|
1190
|
+
e.preventDefault();
|
|
1191
|
+
input.current?.focus();
|
|
1192
|
+
}
|
|
1193
|
+
},
|
|
1194
|
+
children: [
|
|
1195
|
+
/* @__PURE__ */ jsx9(Search3, { size: 15, "aria-hidden": "true", className: "shrink-0 text-text-tertiary" }),
|
|
1196
|
+
adCodeMode && adCodes.length > 0 && /* @__PURE__ */ jsxs8(
|
|
1197
|
+
"span",
|
|
1198
|
+
{
|
|
1199
|
+
className: cx2(
|
|
1200
|
+
"inline-flex shrink-0 items-center gap-1 rounded-full py-0.5 pl-2 pr-1 text-xs font-medium",
|
|
1201
|
+
hasMisses ? "bg-status-danger/15 text-text-danger" : "bg-subtle text-text-primary"
|
|
1202
|
+
),
|
|
1203
|
+
children: [
|
|
1204
|
+
/* @__PURE__ */ jsxs8(
|
|
1205
|
+
"button",
|
|
1206
|
+
{
|
|
1207
|
+
type: "button",
|
|
1208
|
+
onClick: () => setCodesOpen((o) => !o),
|
|
1209
|
+
"aria-expanded": codesOpen,
|
|
1210
|
+
"aria-haspopup": "dialog",
|
|
1211
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-ad-codes`,
|
|
1212
|
+
className: "inline-flex items-center gap-1 rounded-control focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
1213
|
+
children: [
|
|
1214
|
+
hasMisses && /* @__PURE__ */ jsx9(AlertCircle, { size: 13, "aria-hidden": "true" }),
|
|
1215
|
+
hasMisses ? `${matchedCount} of ${adCodes.length} matched` : adCodes.length === 1 ? adCodes[0] : `${adCodes.length} Ad Codes`
|
|
1216
|
+
]
|
|
1217
|
+
}
|
|
1218
|
+
),
|
|
1219
|
+
/* @__PURE__ */ jsx9(
|
|
1220
|
+
"button",
|
|
1221
|
+
{
|
|
1222
|
+
type: "button",
|
|
1223
|
+
"aria-label": "Clear all ad codes",
|
|
1224
|
+
onClick: () => updateCodes([], -1),
|
|
1225
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-ad-codes-clear`,
|
|
1226
|
+
className: "inline-flex rounded-full p-0.5 hover:bg-surface focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
1227
|
+
children: /* @__PURE__ */ jsx9(X2, { size: 12, "aria-hidden": "true" })
|
|
1228
|
+
}
|
|
1229
|
+
)
|
|
1230
|
+
]
|
|
1231
|
+
}
|
|
1232
|
+
),
|
|
1233
|
+
/* @__PURE__ */ jsx9(
|
|
1234
|
+
"input",
|
|
1235
|
+
{
|
|
1236
|
+
ref: input,
|
|
1237
|
+
type: "text",
|
|
1238
|
+
value,
|
|
1239
|
+
onChange: (e) => onChange?.(e.target.value),
|
|
1240
|
+
onKeyDown: (e) => {
|
|
1241
|
+
if (!adCodeMode || e.key !== "Enter") return;
|
|
1242
|
+
const typed = parseAdCodes(value ?? "");
|
|
1243
|
+
if (!typed.length) return;
|
|
1244
|
+
e.preventDefault();
|
|
1245
|
+
onAdCodesChange?.(mergeAdCodes(adCodes, typed));
|
|
1246
|
+
onChange?.("");
|
|
1247
|
+
},
|
|
1248
|
+
placeholder: adCodeMode && adCodes.length === 0 ? "Enter ad codes, then press Enter" : placeholder,
|
|
1249
|
+
"aria-label": placeholder,
|
|
1250
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-search`,
|
|
1251
|
+
className: "min-w-0 flex-1 bg-transparent text-dense text-text-primary outline-hidden placeholder:text-text-tertiary"
|
|
1252
|
+
}
|
|
1253
|
+
),
|
|
1254
|
+
adCodeMode && codesOpen && adCodes.length > 0 && /* @__PURE__ */ jsxs8(
|
|
1255
|
+
"div",
|
|
1256
|
+
{
|
|
1257
|
+
ref: codesPopover,
|
|
1258
|
+
role: "dialog",
|
|
1259
|
+
"aria-label": "Ad codes",
|
|
1260
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-ad-codes-popover`,
|
|
1261
|
+
className: "absolute right-0 top-full z-50 mt-2 w-110 max-w-[90vw] cursor-auto rounded-card border border-border-default bg-surface p-3 shadow-overlay",
|
|
1262
|
+
children: [
|
|
1263
|
+
/* @__PURE__ */ jsx9("p", { className: "mb-2 text-xs font-medium text-text-secondary", children: isAdCodeMatched ? `${matchedCount} ${matchedCount === 1 ? "ad was" : "ads were"} found` : `${adCodes.length} ${adCodes.length === 1 ? "ad code" : "ad codes"}` }),
|
|
1264
|
+
/* @__PURE__ */ jsx9("ul", { className: "flex max-h-50 flex-wrap gap-2 overflow-y-auto p-0.5", children: adCodes.map((code, i) => {
|
|
1265
|
+
const missed = !!isAdCodeMatched && !isAdCodeMatched(code);
|
|
1266
|
+
return /* @__PURE__ */ jsxs8(
|
|
1267
|
+
"li",
|
|
1268
|
+
{
|
|
1269
|
+
className: cx2(
|
|
1270
|
+
"inline-flex items-center gap-1 rounded-full py-1 pl-2.5 pr-1.5 text-card-title",
|
|
1271
|
+
missed ? "bg-status-danger/15 text-text-danger" : "bg-subtle text-text-primary"
|
|
1272
|
+
),
|
|
1273
|
+
children: [
|
|
1274
|
+
code,
|
|
1275
|
+
missed && /* @__PURE__ */ jsx9("span", { className: "sr-only", children: " (not found)" }),
|
|
1276
|
+
/* @__PURE__ */ jsx9(
|
|
1277
|
+
"button",
|
|
1278
|
+
{
|
|
1279
|
+
type: "button",
|
|
1280
|
+
"data-remove-code": "",
|
|
1281
|
+
"aria-label": `Remove ${code}`,
|
|
1282
|
+
onClick: () => updateCodes(adCodes.filter((c) => c !== code), i),
|
|
1283
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-ad-code-remove-${slug3(code)}`,
|
|
1284
|
+
className: "inline-flex rounded-full p-0.5 hover:bg-surface focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
1285
|
+
children: /* @__PURE__ */ jsx9(X2, { size: 13, "aria-hidden": "true" })
|
|
1286
|
+
}
|
|
1287
|
+
)
|
|
1288
|
+
]
|
|
1289
|
+
},
|
|
1290
|
+
code
|
|
1291
|
+
);
|
|
1292
|
+
}) }),
|
|
1293
|
+
/* @__PURE__ */ jsx9("div", { className: "mt-3 flex justify-end", children: /* @__PURE__ */ jsx9(
|
|
1294
|
+
"button",
|
|
1295
|
+
{
|
|
1296
|
+
type: "button",
|
|
1297
|
+
onClick: () => {
|
|
1298
|
+
setCodesOpen(false);
|
|
1299
|
+
input.current?.focus();
|
|
1300
|
+
},
|
|
1301
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-ad-codes-done`,
|
|
1302
|
+
className: "rounded-control bg-brand-primaryAction px-4 py-2 text-dense font-semibold text-brand-onprimary transition hover:brightness-110 focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-border-focus",
|
|
1303
|
+
children: "Search"
|
|
1304
|
+
}
|
|
1305
|
+
) }),
|
|
1306
|
+
onDownloadAdCodes && /* @__PURE__ */ jsxs8("div", { className: "mt-3 flex items-start gap-2 rounded-control border border-border-default px-3 py-2.5 text-card-title text-text-secondary", children: [
|
|
1307
|
+
/* @__PURE__ */ jsx9(AlertCircle, { size: 16, "aria-hidden": "true", className: "mt-0.5 shrink-0 text-text-tertiary" }),
|
|
1308
|
+
/* @__PURE__ */ jsxs8("span", { children: [
|
|
1309
|
+
hasMisses && "Some ad codes in your search could not be matched. ",
|
|
1310
|
+
/* @__PURE__ */ jsx9(
|
|
1311
|
+
"button",
|
|
1312
|
+
{
|
|
1313
|
+
type: "button",
|
|
1314
|
+
onClick: () => onDownloadAdCodes(adCodes),
|
|
1315
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-ad-codes-download`,
|
|
1316
|
+
className: "font-medium text-text-link underline focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
1317
|
+
children: "Download"
|
|
1318
|
+
}
|
|
1319
|
+
),
|
|
1320
|
+
" ",
|
|
1321
|
+
hasMisses ? "the results to see the status of each ad code." : "the list of ad codes with their status."
|
|
1322
|
+
] })
|
|
1323
|
+
] })
|
|
1324
|
+
]
|
|
1325
|
+
}
|
|
1326
|
+
)
|
|
1327
|
+
]
|
|
1328
|
+
}
|
|
1329
|
+
),
|
|
1141
1330
|
value && onChange && /* @__PURE__ */ jsx9(
|
|
1142
1331
|
"button",
|
|
1143
1332
|
{
|
|
@@ -1283,34 +1472,40 @@ function ModeRow({
|
|
|
1283
1472
|
onSelect,
|
|
1284
1473
|
testId
|
|
1285
1474
|
}) {
|
|
1475
|
+
const descId = useId3();
|
|
1286
1476
|
return /* @__PURE__ */ jsxs8(
|
|
1287
1477
|
"div",
|
|
1288
1478
|
{
|
|
1289
|
-
role: "radio",
|
|
1290
|
-
tabIndex: 0,
|
|
1291
|
-
"aria-checked": selected,
|
|
1292
|
-
"data-testid": testId,
|
|
1293
1479
|
onClick: onSelect,
|
|
1294
|
-
|
|
1295
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
1296
|
-
e.preventDefault();
|
|
1297
|
-
onSelect();
|
|
1298
|
-
}
|
|
1299
|
-
},
|
|
1300
|
-
className: "flex cursor-pointer flex-col items-stretch gap-1 rounded-control p-1.5 text-left transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
1480
|
+
className: "flex cursor-pointer flex-col items-stretch gap-1 rounded-control p-1.5 text-left transition-colors hover:bg-subtle",
|
|
1301
1481
|
children: [
|
|
1302
1482
|
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1303
1483
|
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
1304
1484
|
/* @__PURE__ */ jsxs8("span", { className: "flex items-center gap-1", children: [
|
|
1305
|
-
/* @__PURE__ */ jsx9(
|
|
1485
|
+
/* @__PURE__ */ jsx9(
|
|
1486
|
+
"button",
|
|
1487
|
+
{
|
|
1488
|
+
type: "button",
|
|
1489
|
+
role: "radio",
|
|
1490
|
+
"aria-checked": selected,
|
|
1491
|
+
"aria-describedby": descId,
|
|
1492
|
+
"data-testid": testId,
|
|
1493
|
+
onClick: (e) => {
|
|
1494
|
+
e.stopPropagation();
|
|
1495
|
+
onSelect();
|
|
1496
|
+
},
|
|
1497
|
+
className: "rounded-control text-left text-[14px] font-semibold text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
1498
|
+
children: title
|
|
1499
|
+
}
|
|
1500
|
+
),
|
|
1306
1501
|
/* @__PURE__ */ jsx9(RowInfoTip, { text: infoText })
|
|
1307
1502
|
] }),
|
|
1308
|
-
badge && /* @__PURE__ */ jsx9(
|
|
1503
|
+
badge && /* @__PURE__ */ jsx9(Badge, { kind: "category", children: badge }),
|
|
1309
1504
|
extra
|
|
1310
1505
|
] }),
|
|
1311
1506
|
selected && /* @__PURE__ */ jsx9(Check3, { size: 16, strokeWidth: 2.5, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" })
|
|
1312
1507
|
] }),
|
|
1313
|
-
/* @__PURE__ */ jsx9("span", { className: "block text-[12.5px] leading-snug text-text-secondary", children: description })
|
|
1508
|
+
/* @__PURE__ */ jsx9("span", { id: descId, className: "block text-[12.5px] leading-snug text-text-secondary", children: description })
|
|
1314
1509
|
]
|
|
1315
1510
|
}
|
|
1316
1511
|
);
|
|
@@ -1373,7 +1568,7 @@ function RowInfoTip({ text }) {
|
|
|
1373
1568
|
"aria-label": "More information",
|
|
1374
1569
|
"aria-expanded": open,
|
|
1375
1570
|
"aria-describedby": id,
|
|
1376
|
-
className: "inline-flex text-text-tertiary transition-colors hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
1571
|
+
className: "-m-1.5 inline-flex size-6 items-center justify-center rounded-control text-text-tertiary transition-colors hover:text-text-primary focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
1377
1572
|
children: /* @__PURE__ */ jsx9(AlertCircle, { size: 13, "aria-hidden": "true" })
|
|
1378
1573
|
}
|
|
1379
1574
|
),
|
|
@@ -1560,7 +1755,7 @@ function Option({
|
|
|
1560
1755
|
}
|
|
1561
1756
|
|
|
1562
1757
|
// src/SelectFilter.tsx
|
|
1563
|
-
import { useCallback as useCallback2, useEffect as useEffect6, useLayoutEffect as
|
|
1758
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useLayoutEffect as useLayoutEffect3, useRef as useRef7, useState as useState6 } from "react";
|
|
1564
1759
|
import { createPortal as createPortal2 } from "react-dom";
|
|
1565
1760
|
import { Check as Check5, ChevronDown as ChevronDown5 } from "lucide-react";
|
|
1566
1761
|
|
|
@@ -1590,7 +1785,7 @@ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
|
1590
1785
|
function cx4(...classes) {
|
|
1591
1786
|
return classes.filter(Boolean).join(" ");
|
|
1592
1787
|
}
|
|
1593
|
-
function
|
|
1788
|
+
function slug4(value) {
|
|
1594
1789
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
1595
1790
|
}
|
|
1596
1791
|
function OptionIcon({ children }) {
|
|
@@ -1632,7 +1827,7 @@ function SelectFilter({
|
|
|
1632
1827
|
const above = r.bottom + 8 + h > window.innerHeight && r.top - 8 - h > 0;
|
|
1633
1828
|
setPos({ top: above ? r.top - 8 - h : r.bottom + 8, left: align === "right" ? r.right - r.width : r.left, width: r.width });
|
|
1634
1829
|
}, [align, options.length]);
|
|
1635
|
-
|
|
1830
|
+
useLayoutEffect3(() => {
|
|
1636
1831
|
if (!open) return;
|
|
1637
1832
|
reposition();
|
|
1638
1833
|
}, [open, reposition]);
|
|
@@ -1710,7 +1905,7 @@ function SelectFilter({
|
|
|
1710
1905
|
type: "button",
|
|
1711
1906
|
role: "option",
|
|
1712
1907
|
"aria-selected": selected,
|
|
1713
|
-
"data-testid": testIdPrefix && `${testIdPrefix}-option-${
|
|
1908
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-option-${slug4(o)}`,
|
|
1714
1909
|
onClick: () => {
|
|
1715
1910
|
onChange(o);
|
|
1716
1911
|
close();
|
|
@@ -2110,7 +2305,7 @@ function StackedColumnPlaceholder({
|
|
|
2110
2305
|
}
|
|
2111
2306
|
|
|
2112
2307
|
// src/Tooltip.tsx
|
|
2113
|
-
import { useEffect as useEffect8, useId as useId4, useLayoutEffect as
|
|
2308
|
+
import { useEffect as useEffect8, useId as useId4, useLayoutEffect as useLayoutEffect4, useRef as useRef9, useState as useState8 } from "react";
|
|
2114
2309
|
import { createPortal as createPortal3 } from "react-dom";
|
|
2115
2310
|
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2116
2311
|
function cx6(...parts) {
|
|
@@ -2276,7 +2471,7 @@ function Tooltip({
|
|
|
2276
2471
|
window.addEventListener("keydown", onKey);
|
|
2277
2472
|
return () => window.removeEventListener("keydown", onKey);
|
|
2278
2473
|
}, [anchor]);
|
|
2279
|
-
|
|
2474
|
+
useLayoutEffect4(() => {
|
|
2280
2475
|
if (!anchor) return;
|
|
2281
2476
|
const el = boxRef.current;
|
|
2282
2477
|
if (!el) return;
|
|
@@ -2417,7 +2612,7 @@ function SelectedSection({ count, open, onToggle, children, testIdPrefix }) {
|
|
|
2417
2612
|
}
|
|
2418
2613
|
|
|
2419
2614
|
// src/SelectionPicker.tsx
|
|
2420
|
-
import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as
|
|
2615
|
+
import { useCallback as useCallback3, useEffect as useEffect9, useLayoutEffect as useLayoutEffect5, useMemo as useMemo3, useRef as useRef11, useState as useState9 } from "react";
|
|
2421
2616
|
import { createPortal as createPortal4 } from "react-dom";
|
|
2422
2617
|
import { Search as Search4, Plus as Plus2, Info as Info2, ChevronRight as ChevronRight3, ChevronDown as ChevronDown8, Check as Check6, List, Loader2 } from "lucide-react";
|
|
2423
2618
|
|
|
@@ -2518,7 +2713,7 @@ import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-r
|
|
|
2518
2713
|
function cx8(...parts) {
|
|
2519
2714
|
return parts.filter(Boolean).join(" ");
|
|
2520
2715
|
}
|
|
2521
|
-
function
|
|
2716
|
+
function slug5(value) {
|
|
2522
2717
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
2523
2718
|
}
|
|
2524
2719
|
function SelectionPicker({
|
|
@@ -2715,7 +2910,7 @@ function SelectionPicker({
|
|
|
2715
2910
|
checked: isSel,
|
|
2716
2911
|
onChange: () => toggleRow(row),
|
|
2717
2912
|
ariaLabel: row.name,
|
|
2718
|
-
testId: testIdPrefix && `${testIdPrefix}-row-${
|
|
2913
|
+
testId: testIdPrefix && `${testIdPrefix}-row-${slug5(row.id)}`
|
|
2719
2914
|
}
|
|
2720
2915
|
),
|
|
2721
2916
|
/* @__PURE__ */ jsx27("div", { className: cx8("grid gap-2 text-dense text-text-primary", gridForColumns(columns)), children: columns.map((c) => /* @__PURE__ */ jsx27("span", { className: cx8("truncate", c.className), children: c.render(row) }, c.key)) }),
|
|
@@ -2906,7 +3101,7 @@ function FilterDropdown({
|
|
|
2906
3101
|
const [pos, setPos] = useState9(null);
|
|
2907
3102
|
const searchable = filter.options.length > 8;
|
|
2908
3103
|
const shownOptions = searchable && q.trim() ? filter.options.filter((o) => o.toLowerCase().includes(q.trim().toLowerCase())) : filter.options;
|
|
2909
|
-
|
|
3104
|
+
useLayoutEffect5(() => {
|
|
2910
3105
|
if (!open || !btnRef.current) return;
|
|
2911
3106
|
const r = btnRef.current.getBoundingClientRect();
|
|
2912
3107
|
setPos({ top: r.bottom + 6, left: r.left });
|
|
@@ -2933,7 +3128,7 @@ function FilterDropdown({
|
|
|
2933
3128
|
}, [open]);
|
|
2934
3129
|
const count = active.size;
|
|
2935
3130
|
const label = count === 0 ? filter.label : count === 1 ? [...active][0] : "Multiple";
|
|
2936
|
-
const filterSlug =
|
|
3131
|
+
const filterSlug = slug5(filter.label);
|
|
2937
3132
|
return /* @__PURE__ */ jsxs25("div", { className: "relative", children: [
|
|
2938
3133
|
/* @__PURE__ */ jsxs25(
|
|
2939
3134
|
"button",
|
|
@@ -2986,7 +3181,7 @@ function FilterDropdown({
|
|
|
2986
3181
|
checked: on,
|
|
2987
3182
|
onChange: () => onToggle(opt),
|
|
2988
3183
|
ariaLabel: opt,
|
|
2989
|
-
testId: testIdPrefix && `${testIdPrefix}-filter-${filterSlug}-${
|
|
3184
|
+
testId: testIdPrefix && `${testIdPrefix}-filter-${filterSlug}-${slug5(opt)}`
|
|
2990
3185
|
}
|
|
2991
3186
|
),
|
|
2992
3187
|
opt
|
|
@@ -4254,7 +4449,7 @@ function SectionHeading({ title, description, actions, as: Tag2 = "h2", id, clas
|
|
|
4254
4449
|
// src/PageHeader.tsx
|
|
4255
4450
|
import { ArrowLeft } from "lucide-react";
|
|
4256
4451
|
import { jsx as jsx45, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
4257
|
-
function PageHeader({ title, description, actions, back, className }) {
|
|
4452
|
+
function PageHeader({ title, description, actions, meta, back, className }) {
|
|
4258
4453
|
return /* @__PURE__ */ jsxs39("header", { className: cn("flex flex-wrap items-center justify-between gap-x-6 gap-y-3", className), children: [
|
|
4259
4454
|
/* @__PURE__ */ jsxs39("div", { className: "min-w-0", children: [
|
|
4260
4455
|
back && /* @__PURE__ */ jsxs39(
|
|
@@ -4269,7 +4464,10 @@ function PageHeader({ title, description, actions, back, className }) {
|
|
|
4269
4464
|
]
|
|
4270
4465
|
}
|
|
4271
4466
|
),
|
|
4272
|
-
/* @__PURE__ */
|
|
4467
|
+
meta ? /* @__PURE__ */ jsxs39("div", { className: "flex flex-wrap items-center gap-x-2.5 gap-y-1", children: [
|
|
4468
|
+
/* @__PURE__ */ jsx45("h1", { className: "text-xl font-semibold tracking-tight text-text-primary", children: title }),
|
|
4469
|
+
meta
|
|
4470
|
+
] }) : /* @__PURE__ */ jsx45("h1", { className: "text-xl font-semibold tracking-tight text-text-primary", children: title }),
|
|
4273
4471
|
description && /* @__PURE__ */ jsx45("p", { className: "mt-0.5 max-w-2xl text-sm text-text-secondary", children: description })
|
|
4274
4472
|
] }),
|
|
4275
4473
|
actions && /* @__PURE__ */ jsx45("div", { className: "flex shrink-0 items-center gap-2", children: actions })
|