@mediaradar/design-components 0.39.0 → 0.41.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 +288 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +85 -19
- package/dist/index.d.ts +85 -19
- package/dist/index.js +309 -65
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -94,7 +94,7 @@ function InfoTip({ text, size = 11, label = "More information", trigger = "click
|
|
|
94
94
|
|
|
95
95
|
// src/AdvertiserQuickFilter.tsx
|
|
96
96
|
import { useCallback, useEffect as useEffect2, useMemo, useRef as useRef2, useState as useState2 } from "react";
|
|
97
|
-
import { Check, ChevronDown, ListChecks, Search as Search2, X } from "lucide-react";
|
|
97
|
+
import { Check, ChevronDown, ListChecks, Plus, Search as Search2, X } from "lucide-react";
|
|
98
98
|
|
|
99
99
|
// src/AdvertiserSearchPrompt.tsx
|
|
100
100
|
import { Search } from "lucide-react";
|
|
@@ -149,11 +149,21 @@ function ChipContent({ caption, value, icon }) {
|
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
// src/AdvertiserQuickFilter.tsx
|
|
152
|
-
import {
|
|
152
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
153
153
|
function cx(...parts) {
|
|
154
154
|
return parts.filter(Boolean).join(" ");
|
|
155
155
|
}
|
|
156
156
|
var SELECT_ALL_THRESHOLD = 5;
|
|
157
|
+
function usePaging(total, pageSize, resetKey) {
|
|
158
|
+
const [pages, setPages] = useState2(1);
|
|
159
|
+
const [prevKey, setPrevKey] = useState2(resetKey);
|
|
160
|
+
if (prevKey !== resetKey) {
|
|
161
|
+
setPrevKey(resetKey);
|
|
162
|
+
setPages(1);
|
|
163
|
+
}
|
|
164
|
+
const shown = pageSize && pageSize > 0 ? Math.min(total, pages * pageSize) : total;
|
|
165
|
+
return { shown, remaining: total - shown, showMore: () => setPages((p) => p + 1) };
|
|
166
|
+
}
|
|
157
167
|
function slug(value) {
|
|
158
168
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
159
169
|
}
|
|
@@ -167,6 +177,8 @@ function AdvertiserQuickFilter({
|
|
|
167
177
|
showFooter = false,
|
|
168
178
|
clearValue = [],
|
|
169
179
|
parked = [],
|
|
180
|
+
prepopulate = false,
|
|
181
|
+
pageSize,
|
|
170
182
|
searchPlaceholder = "Search for an advertiser",
|
|
171
183
|
promptLabel = "an advertiser name",
|
|
172
184
|
noResultsHint = "Try checking your spelling or searching for a broader brand name.",
|
|
@@ -221,10 +233,28 @@ function AdvertiserQuickFilter({
|
|
|
221
233
|
() => draft.map((id) => options.find((o) => o.id === id)).filter(Boolean),
|
|
222
234
|
[draft, options]
|
|
223
235
|
);
|
|
224
|
-
const
|
|
225
|
-
() => ql ? options.filter((o) => !draft.includes(o.id) && o.label.toLowerCase().includes(ql)) : [],
|
|
226
|
-
[ql, options, draft]
|
|
236
|
+
const matches = useMemo(
|
|
237
|
+
() => ql || prepopulate ? options.filter((o) => !draft.includes(o.id) && (!ql || o.label.toLowerCase().includes(ql))) : [],
|
|
238
|
+
[ql, prepopulate, options, draft]
|
|
227
239
|
);
|
|
240
|
+
const { shown: pageEnd, remaining, showMore } = usePaging(
|
|
241
|
+
matches.length,
|
|
242
|
+
prepopulate ? pageSize : void 0,
|
|
243
|
+
`${open}|${ql}`
|
|
244
|
+
);
|
|
245
|
+
const results = useMemo(() => matches.slice(0, pageEnd), [matches, pageEnd]);
|
|
246
|
+
const resultsRef = useRef2(null);
|
|
247
|
+
const focusFrom = useRef2(null);
|
|
248
|
+
const loadMore = () => {
|
|
249
|
+
focusFrom.current = results.length;
|
|
250
|
+
showMore();
|
|
251
|
+
};
|
|
252
|
+
useEffect2(() => {
|
|
253
|
+
const from = focusFrom.current;
|
|
254
|
+
if (from === null) return;
|
|
255
|
+
focusFrom.current = null;
|
|
256
|
+
resultsRef.current?.querySelectorAll('[role="checkbox"]')[from]?.focus();
|
|
257
|
+
}, [pageEnd]);
|
|
228
258
|
const visibleIds = results.map((o) => o.id);
|
|
229
259
|
const allVisibleSelected = visibleIds.length > 0 && visibleIds.every((id) => draft.includes(id));
|
|
230
260
|
const toggleAllVisible = () => setDraft(
|
|
@@ -330,14 +360,18 @@ function AdvertiserQuickFilter({
|
|
|
330
360
|
o.id
|
|
331
361
|
)) })
|
|
332
362
|
] }),
|
|
333
|
-
|
|
363
|
+
prepopulate && /* @__PURE__ */ jsxs4("p", { role: "status", className: "sr-only", "data-testid": testIdPrefix && `${testIdPrefix}-result-count`, children: [
|
|
364
|
+
matches.length === 1 ? "1 result" : `${matches.length} results`,
|
|
365
|
+
remaining > 0 ? `, showing ${results.length}` : ""
|
|
366
|
+
] }),
|
|
367
|
+
!ql && !prepopulate ? /* @__PURE__ */ jsx4(AdvertiserSearchPrompt, { label: promptLabel }) : !ql && results.length === 0 ? null : results.length === 0 ? /* @__PURE__ */ jsxs4("div", { className: "flex flex-col items-center gap-1.5 px-4 py-8 text-center", children: [
|
|
334
368
|
/* @__PURE__ */ jsxs4("p", { className: "text-[13px] font-medium text-text-primary", children: [
|
|
335
369
|
"No results found for \u201C",
|
|
336
370
|
q.trim(),
|
|
337
371
|
"\u201D"
|
|
338
372
|
] }),
|
|
339
373
|
/* @__PURE__ */ jsx4("p", { className: "text-[12px] leading-snug text-text-tertiary", children: noResultsHint })
|
|
340
|
-
] }) : /* @__PURE__ */ jsxs4(
|
|
374
|
+
] }) : /* @__PURE__ */ jsxs4("div", { ref: resultsRef, children: [
|
|
341
375
|
results.length > SELECT_ALL_THRESHOLD && /* @__PURE__ */ jsxs4(
|
|
342
376
|
"button",
|
|
343
377
|
{
|
|
@@ -360,7 +394,22 @@ function AdvertiserQuickFilter({
|
|
|
360
394
|
testId: testIdPrefix && `${testIdPrefix}-option-${slug(o.id)}`
|
|
361
395
|
},
|
|
362
396
|
o.id
|
|
363
|
-
))
|
|
397
|
+
)),
|
|
398
|
+
remaining > 0 && !!pageSize && /* @__PURE__ */ jsxs4(
|
|
399
|
+
"button",
|
|
400
|
+
{
|
|
401
|
+
type: "button",
|
|
402
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-show-more`,
|
|
403
|
+
onClick: loadMore,
|
|
404
|
+
className: "flex w-full items-center gap-1.5 rounded-control px-2 py-2 text-left text-xs font-semibold text-text-link transition-colors hover:bg-subtle focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-border-focus",
|
|
405
|
+
children: [
|
|
406
|
+
/* @__PURE__ */ jsx4(Plus, { size: 13, "aria-hidden": "true" }),
|
|
407
|
+
"Show ",
|
|
408
|
+
Math.min(remaining, pageSize),
|
|
409
|
+
" more"
|
|
410
|
+
]
|
|
411
|
+
}
|
|
412
|
+
)
|
|
364
413
|
] })
|
|
365
414
|
] }),
|
|
366
415
|
showFooter ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center justify-between border-t border-border-default px-3 py-2.5", children: [
|
|
@@ -1022,9 +1071,9 @@ function NavBtn({ children, onClick, ...rest }) {
|
|
|
1022
1071
|
}
|
|
1023
1072
|
|
|
1024
1073
|
// src/SearchBar.tsx
|
|
1025
|
-
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";
|
|
1026
1075
|
import { AlertCircle, Check as Check3, ChevronDown as ChevronDown3, Search as Search3, X as X2 } from "lucide-react";
|
|
1027
|
-
import { Fragment as
|
|
1076
|
+
import { Fragment as Fragment2, jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1028
1077
|
var HEIGHT = { sm: "h-8", md: "h-10", lg: "h-11" };
|
|
1029
1078
|
var DEFAULT_SEARCH_MATCH = { mode: "anyWord", wordJoin: "Or" };
|
|
1030
1079
|
var MODE_LABEL = {
|
|
@@ -1033,6 +1082,23 @@ var MODE_LABEL = {
|
|
|
1033
1082
|
contextual: "Contextual",
|
|
1034
1083
|
adCode: "Ad Code"
|
|
1035
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
|
+
}
|
|
1036
1102
|
function cx2(...classes) {
|
|
1037
1103
|
return classes.filter(Boolean).join(" ");
|
|
1038
1104
|
}
|
|
@@ -1044,12 +1110,53 @@ function SearchBar({
|
|
|
1044
1110
|
size = "lg",
|
|
1045
1111
|
matchValue,
|
|
1046
1112
|
onMatchChange,
|
|
1113
|
+
adCodes = [],
|
|
1114
|
+
onAdCodesChange,
|
|
1115
|
+
isAdCodeMatched,
|
|
1116
|
+
onDownloadAdCodes,
|
|
1047
1117
|
className,
|
|
1048
1118
|
testIdPrefix
|
|
1049
1119
|
}) {
|
|
1050
1120
|
const [open, setOpen] = useState4(false);
|
|
1051
1121
|
const ref = useRef4(null);
|
|
1052
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
|
+
};
|
|
1053
1160
|
useEffect4(() => {
|
|
1054
1161
|
if (!open) return;
|
|
1055
1162
|
const onKey = (e) => e.key === "Escape" && setOpen(false);
|
|
@@ -1068,27 +1175,158 @@ function SearchBar({
|
|
|
1068
1175
|
"div",
|
|
1069
1176
|
{
|
|
1070
1177
|
className: cx2(
|
|
1071
|
-
"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",
|
|
1072
1179
|
HEIGHT[size],
|
|
1073
1180
|
className
|
|
1074
1181
|
),
|
|
1075
1182
|
children: [
|
|
1076
|
-
/* @__PURE__ */ jsxs8(
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
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
|
+
),
|
|
1092
1330
|
value && onChange && /* @__PURE__ */ jsx9(
|
|
1093
1331
|
"button",
|
|
1094
1332
|
{
|
|
@@ -1152,7 +1390,7 @@ function SearchBar({
|
|
|
1152
1390
|
selected: matchValue.mode === "anyWord",
|
|
1153
1391
|
onSelect: () => onMatchChange?.({ mode: "anyWord", wordJoin: matchValue.wordJoin }),
|
|
1154
1392
|
testId: testIdPrefix && `${testIdPrefix}-mode-anyWord`,
|
|
1155
|
-
description: /* @__PURE__ */ jsx9(
|
|
1393
|
+
description: /* @__PURE__ */ jsx9(Fragment2, { children: "Find creatives that contain your keyword(s) using an \u201COr\u201D (match any) or \u201CAnd\u201D (match all) conditional in any order." }),
|
|
1156
1394
|
infoText: "The Or/And choice applies only when Any Word is the active search mode.",
|
|
1157
1395
|
extra: /* @__PURE__ */ jsxs8("span", { className: "flex items-center gap-3", children: [
|
|
1158
1396
|
/* @__PURE__ */ jsx9(
|
|
@@ -1234,34 +1472,40 @@ function ModeRow({
|
|
|
1234
1472
|
onSelect,
|
|
1235
1473
|
testId
|
|
1236
1474
|
}) {
|
|
1475
|
+
const descId = useId3();
|
|
1237
1476
|
return /* @__PURE__ */ jsxs8(
|
|
1238
1477
|
"div",
|
|
1239
1478
|
{
|
|
1240
|
-
role: "radio",
|
|
1241
|
-
tabIndex: 0,
|
|
1242
|
-
"aria-checked": selected,
|
|
1243
|
-
"data-testid": testId,
|
|
1244
1479
|
onClick: onSelect,
|
|
1245
|
-
|
|
1246
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
1247
|
-
e.preventDefault();
|
|
1248
|
-
onSelect();
|
|
1249
|
-
}
|
|
1250
|
-
},
|
|
1251
|
-
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",
|
|
1252
1481
|
children: [
|
|
1253
1482
|
/* @__PURE__ */ jsxs8("div", { className: "flex items-center justify-between gap-2", children: [
|
|
1254
1483
|
/* @__PURE__ */ jsxs8("div", { className: "flex flex-wrap items-center gap-3", children: [
|
|
1255
1484
|
/* @__PURE__ */ jsxs8("span", { className: "flex items-center gap-1", children: [
|
|
1256
|
-
/* @__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
|
+
),
|
|
1257
1501
|
/* @__PURE__ */ jsx9(RowInfoTip, { text: infoText })
|
|
1258
1502
|
] }),
|
|
1259
|
-
badge && /* @__PURE__ */ jsx9(
|
|
1503
|
+
badge && /* @__PURE__ */ jsx9(Badge, { kind: "category", children: badge }),
|
|
1260
1504
|
extra
|
|
1261
1505
|
] }),
|
|
1262
1506
|
selected && /* @__PURE__ */ jsx9(Check3, { size: 16, strokeWidth: 2.5, "aria-hidden": "true", className: "shrink-0 text-brand-primaryAction" })
|
|
1263
1507
|
] }),
|
|
1264
|
-
/* @__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 })
|
|
1265
1509
|
]
|
|
1266
1510
|
}
|
|
1267
1511
|
);
|
|
@@ -1324,7 +1568,7 @@ function RowInfoTip({ text }) {
|
|
|
1324
1568
|
"aria-label": "More information",
|
|
1325
1569
|
"aria-expanded": open,
|
|
1326
1570
|
"aria-describedby": id,
|
|
1327
|
-
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",
|
|
1328
1572
|
children: /* @__PURE__ */ jsx9(AlertCircle, { size: 13, "aria-hidden": "true" })
|
|
1329
1573
|
}
|
|
1330
1574
|
),
|
|
@@ -1511,7 +1755,7 @@ function Option({
|
|
|
1511
1755
|
}
|
|
1512
1756
|
|
|
1513
1757
|
// src/SelectFilter.tsx
|
|
1514
|
-
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";
|
|
1515
1759
|
import { createPortal as createPortal2 } from "react-dom";
|
|
1516
1760
|
import { Check as Check5, ChevronDown as ChevronDown5 } from "lucide-react";
|
|
1517
1761
|
|
|
@@ -1541,7 +1785,7 @@ import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
|
1541
1785
|
function cx4(...classes) {
|
|
1542
1786
|
return classes.filter(Boolean).join(" ");
|
|
1543
1787
|
}
|
|
1544
|
-
function
|
|
1788
|
+
function slug4(value) {
|
|
1545
1789
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
1546
1790
|
}
|
|
1547
1791
|
function OptionIcon({ children }) {
|
|
@@ -1583,7 +1827,7 @@ function SelectFilter({
|
|
|
1583
1827
|
const above = r.bottom + 8 + h > window.innerHeight && r.top - 8 - h > 0;
|
|
1584
1828
|
setPos({ top: above ? r.top - 8 - h : r.bottom + 8, left: align === "right" ? r.right - r.width : r.left, width: r.width });
|
|
1585
1829
|
}, [align, options.length]);
|
|
1586
|
-
|
|
1830
|
+
useLayoutEffect3(() => {
|
|
1587
1831
|
if (!open) return;
|
|
1588
1832
|
reposition();
|
|
1589
1833
|
}, [open, reposition]);
|
|
@@ -1661,7 +1905,7 @@ function SelectFilter({
|
|
|
1661
1905
|
type: "button",
|
|
1662
1906
|
role: "option",
|
|
1663
1907
|
"aria-selected": selected,
|
|
1664
|
-
"data-testid": testIdPrefix && `${testIdPrefix}-option-${
|
|
1908
|
+
"data-testid": testIdPrefix && `${testIdPrefix}-option-${slug4(o)}`,
|
|
1665
1909
|
onClick: () => {
|
|
1666
1910
|
onChange(o);
|
|
1667
1911
|
close();
|
|
@@ -2061,7 +2305,7 @@ function StackedColumnPlaceholder({
|
|
|
2061
2305
|
}
|
|
2062
2306
|
|
|
2063
2307
|
// src/Tooltip.tsx
|
|
2064
|
-
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";
|
|
2065
2309
|
import { createPortal as createPortal3 } from "react-dom";
|
|
2066
2310
|
import { jsx as jsx22, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2067
2311
|
function cx6(...parts) {
|
|
@@ -2227,7 +2471,7 @@ function Tooltip({
|
|
|
2227
2471
|
window.addEventListener("keydown", onKey);
|
|
2228
2472
|
return () => window.removeEventListener("keydown", onKey);
|
|
2229
2473
|
}, [anchor]);
|
|
2230
|
-
|
|
2474
|
+
useLayoutEffect4(() => {
|
|
2231
2475
|
if (!anchor) return;
|
|
2232
2476
|
const el = boxRef.current;
|
|
2233
2477
|
if (!el) return;
|
|
@@ -2368,9 +2612,9 @@ function SelectedSection({ count, open, onToggle, children, testIdPrefix }) {
|
|
|
2368
2612
|
}
|
|
2369
2613
|
|
|
2370
2614
|
// src/SelectionPicker.tsx
|
|
2371
|
-
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";
|
|
2372
2616
|
import { createPortal as createPortal4 } from "react-dom";
|
|
2373
|
-
import { Search as Search4, Plus, Info as Info2, ChevronRight as ChevronRight3, ChevronDown as ChevronDown8, Check as Check6, List, Loader2 } from "lucide-react";
|
|
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";
|
|
2374
2618
|
|
|
2375
2619
|
// src/Tabs.tsx
|
|
2376
2620
|
import { useRef as useRef10 } from "react";
|
|
@@ -2465,11 +2709,11 @@ function SegmentedControl({
|
|
|
2465
2709
|
}
|
|
2466
2710
|
|
|
2467
2711
|
// src/SelectionPicker.tsx
|
|
2468
|
-
import { Fragment as
|
|
2712
|
+
import { Fragment as Fragment3, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
2469
2713
|
function cx8(...parts) {
|
|
2470
2714
|
return parts.filter(Boolean).join(" ");
|
|
2471
2715
|
}
|
|
2472
|
-
function
|
|
2716
|
+
function slug5(value) {
|
|
2473
2717
|
return value.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
|
|
2474
2718
|
}
|
|
2475
2719
|
function SelectionPicker({
|
|
@@ -2561,7 +2805,7 @@ function SelectionPicker({
|
|
|
2561
2805
|
};
|
|
2562
2806
|
const rowGridCols = showInfoColumn ? "grid-cols-[36px_1fr_44px]" : "grid-cols-[36px_1fr]";
|
|
2563
2807
|
return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-4", children: [
|
|
2564
|
-
helper && /* @__PURE__ */ jsxs25(
|
|
2808
|
+
helper && /* @__PURE__ */ jsxs25(Fragment3, { children: [
|
|
2565
2809
|
/* @__PURE__ */ jsx27("p", { className: "text-dense text-text-secondary", children: helper }),
|
|
2566
2810
|
/* @__PURE__ */ jsx27("hr", { className: "-mx-5 -mt-2 border-border-default sm:-mx-6" })
|
|
2567
2811
|
] }),
|
|
@@ -2666,7 +2910,7 @@ function SelectionPicker({
|
|
|
2666
2910
|
checked: isSel,
|
|
2667
2911
|
onChange: () => toggleRow(row),
|
|
2668
2912
|
ariaLabel: row.name,
|
|
2669
|
-
testId: testIdPrefix && `${testIdPrefix}-row-${
|
|
2913
|
+
testId: testIdPrefix && `${testIdPrefix}-row-${slug5(row.id)}`
|
|
2670
2914
|
}
|
|
2671
2915
|
),
|
|
2672
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)) }),
|
|
@@ -2716,7 +2960,7 @@ function SelectionPicker({
|
|
|
2716
2960
|
kidSel ? "text-text-tertiary" : "text-text-link hover:bg-subtle"
|
|
2717
2961
|
),
|
|
2718
2962
|
children: [
|
|
2719
|
-
kidSel ? /* @__PURE__ */ jsx27(Check6, { size: 13 }) : /* @__PURE__ */ jsx27(
|
|
2963
|
+
kidSel ? /* @__PURE__ */ jsx27(Check6, { size: 13 }) : /* @__PURE__ */ jsx27(Plus2, { size: 13 }),
|
|
2720
2964
|
kidSel ? "Added" : "Add"
|
|
2721
2965
|
]
|
|
2722
2966
|
}
|
|
@@ -2746,7 +2990,7 @@ function SelectionPicker({
|
|
|
2746
2990
|
] }),
|
|
2747
2991
|
source === "lists" && /* @__PURE__ */ jsxs25("div", { className: "flex min-w-0 flex-col gap-3", children: [
|
|
2748
2992
|
/* @__PURE__ */ jsx27("p", { className: "text-dense text-text-secondary", children: "Select an account list to add all of its accounts at once. Your workspace stays in sync as the list is updated." }),
|
|
2749
|
-
accountLists && accountLists.length > 0 ? /* @__PURE__ */ jsxs25(
|
|
2993
|
+
accountLists && accountLists.length > 0 ? /* @__PURE__ */ jsxs25(Fragment3, { children: [
|
|
2750
2994
|
/* @__PURE__ */ jsx27(ScrollFade, { className: "flex max-h-99 flex-col gap-2 overflow-y-auto pr-0.5", children: accountLists.map((list) => {
|
|
2751
2995
|
const on = (selectedListIds ?? []).includes(list.id);
|
|
2752
2996
|
return /* @__PURE__ */ jsxs25(
|
|
@@ -2768,7 +3012,7 @@ function SelectionPicker({
|
|
|
2768
3012
|
"flex h-5 w-5 shrink-0 items-center justify-center rounded-full",
|
|
2769
3013
|
on ? "text-brand-primaryAction" : "text-text-secondary"
|
|
2770
3014
|
),
|
|
2771
|
-
children: on ? /* @__PURE__ */ jsx27(Check6, { size: 16 }) : /* @__PURE__ */ jsx27(
|
|
3015
|
+
children: on ? /* @__PURE__ */ jsx27(Check6, { size: 16 }) : /* @__PURE__ */ jsx27(Plus2, { size: 16 })
|
|
2772
3016
|
}
|
|
2773
3017
|
),
|
|
2774
3018
|
/* @__PURE__ */ jsxs25("span", { className: "min-w-0 flex-1", children: [
|
|
@@ -2857,7 +3101,7 @@ function FilterDropdown({
|
|
|
2857
3101
|
const [pos, setPos] = useState9(null);
|
|
2858
3102
|
const searchable = filter.options.length > 8;
|
|
2859
3103
|
const shownOptions = searchable && q.trim() ? filter.options.filter((o) => o.toLowerCase().includes(q.trim().toLowerCase())) : filter.options;
|
|
2860
|
-
|
|
3104
|
+
useLayoutEffect5(() => {
|
|
2861
3105
|
if (!open || !btnRef.current) return;
|
|
2862
3106
|
const r = btnRef.current.getBoundingClientRect();
|
|
2863
3107
|
setPos({ top: r.bottom + 6, left: r.left });
|
|
@@ -2884,7 +3128,7 @@ function FilterDropdown({
|
|
|
2884
3128
|
}, [open]);
|
|
2885
3129
|
const count = active.size;
|
|
2886
3130
|
const label = count === 0 ? filter.label : count === 1 ? [...active][0] : "Multiple";
|
|
2887
|
-
const filterSlug =
|
|
3131
|
+
const filterSlug = slug5(filter.label);
|
|
2888
3132
|
return /* @__PURE__ */ jsxs25("div", { className: "relative", children: [
|
|
2889
3133
|
/* @__PURE__ */ jsxs25(
|
|
2890
3134
|
"button",
|
|
@@ -2937,7 +3181,7 @@ function FilterDropdown({
|
|
|
2937
3181
|
checked: on,
|
|
2938
3182
|
onChange: () => onToggle(opt),
|
|
2939
3183
|
ariaLabel: opt,
|
|
2940
|
-
testId: testIdPrefix && `${testIdPrefix}-filter-${filterSlug}-${
|
|
3184
|
+
testId: testIdPrefix && `${testIdPrefix}-filter-${filterSlug}-${slug5(opt)}`
|
|
2941
3185
|
}
|
|
2942
3186
|
),
|
|
2943
3187
|
opt
|
|
@@ -3892,7 +4136,7 @@ function DateRangePicker({
|
|
|
3892
4136
|
// src/MultiSelectFilter.tsx
|
|
3893
4137
|
import { useCallback as useCallback4, useEffect as useEffect13, useRef as useRef15, useState as useState14 } from "react";
|
|
3894
4138
|
import { ChevronDown as ChevronDown10, Search as Search5, X as X5 } from "lucide-react";
|
|
3895
|
-
import { Fragment as
|
|
4139
|
+
import { Fragment as Fragment4, jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
3896
4140
|
function MultiSelectFilter({
|
|
3897
4141
|
caption,
|
|
3898
4142
|
options = [],
|
|
@@ -4017,7 +4261,7 @@ function MultiSelectFilter({
|
|
|
4017
4261
|
),
|
|
4018
4262
|
role: "dialog",
|
|
4019
4263
|
"aria-label": caption,
|
|
4020
|
-
children: loading ? /* @__PURE__ */ jsx40(MenuLoading, {}) : error ? /* @__PURE__ */ jsx40(MenuError, { onRetry }) : /* @__PURE__ */ jsxs36(
|
|
4264
|
+
children: loading ? /* @__PURE__ */ jsx40(MenuLoading, {}) : error ? /* @__PURE__ */ jsx40(MenuError, { onRetry }) : /* @__PURE__ */ jsxs36(Fragment4, { children: [
|
|
4021
4265
|
searchable && /* @__PURE__ */ jsx40("div", { className: "border-b border-border-default p-2", children: /* @__PURE__ */ jsxs36("div", { className: "flex h-8 items-center gap-2 rounded-control border border-border-strong bg-input px-2.5 focus-within:outline-2 focus-within:outline-offset-1 focus-within:outline-border-focus", children: [
|
|
4022
4266
|
/* @__PURE__ */ jsx40(Search5, { size: 14, className: "text-text-secondary", "aria-hidden": "true" }),
|
|
4023
4267
|
/* @__PURE__ */ jsx40(
|
|
@@ -4155,10 +4399,10 @@ function Toggle({ checked, onChange, label, size = "md", disabled, className, te
|
|
|
4155
4399
|
// src/AISpark.tsx
|
|
4156
4400
|
import { useId as useId6 } from "react";
|
|
4157
4401
|
import { Sparkles } from "lucide-react";
|
|
4158
|
-
import { Fragment as
|
|
4402
|
+
import { Fragment as Fragment5, jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
4159
4403
|
function AISpark({ size = 16, className }) {
|
|
4160
4404
|
const id = useId6();
|
|
4161
|
-
return /* @__PURE__ */ jsxs37(
|
|
4405
|
+
return /* @__PURE__ */ jsxs37(Fragment5, { children: [
|
|
4162
4406
|
/* @__PURE__ */ jsx42("svg", { width: "0", height: "0", "aria-hidden": "true", style: { position: "absolute" }, children: /* @__PURE__ */ jsx42("defs", { children: /* @__PURE__ */ jsxs37("linearGradient", { id, x1: "0", y1: "0", x2: "1", y2: "1", children: [
|
|
4163
4407
|
/* @__PURE__ */ jsx42("stop", { offset: "0%", stopColor: "var(--mr-color-brand-primary)" }),
|
|
4164
4408
|
/* @__PURE__ */ jsx42("stop", { offset: "100%", className: "[stop-color:#9474ff] in-data-[theme=dark]:[stop-color:#a488ff]" })
|