@genspectrum/dashboard-components 0.11.2 → 0.11.3

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.
@@ -1221,7 +1221,10 @@ declare global {
1221
1221
 
1222
1222
  declare global {
1223
1223
  interface HTMLElementTagNameMap {
1224
- 'gs-mutation-comparison-component': MutationComparisonComponent;
1224
+ 'gs-location-filter': LocationFilterComponent;
1225
+ }
1226
+ interface HTMLElementEventMap {
1227
+ 'gs-location-changed': CustomEvent<Record<string, string>>;
1225
1228
  }
1226
1229
  }
1227
1230
 
@@ -1229,7 +1232,7 @@ declare global {
1229
1232
  declare global {
1230
1233
  namespace JSX {
1231
1234
  interface IntrinsicElements {
1232
- 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1235
+ 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1233
1236
  }
1234
1237
  }
1235
1238
  }
@@ -1237,7 +1240,11 @@ declare global {
1237
1240
 
1238
1241
  declare global {
1239
1242
  interface HTMLElementTagNameMap {
1240
- 'gs-mutations-component': MutationsComponent;
1243
+ 'gs-date-range-selector': DateRangeSelectorComponent;
1244
+ }
1245
+ interface HTMLElementEventMap {
1246
+ 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1247
+ 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1241
1248
  }
1242
1249
  }
1243
1250
 
@@ -1245,7 +1252,7 @@ declare global {
1245
1252
  declare global {
1246
1253
  namespace JSX {
1247
1254
  interface IntrinsicElements {
1248
- 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1255
+ 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1249
1256
  }
1250
1257
  }
1251
1258
  }
@@ -1253,7 +1260,10 @@ declare global {
1253
1260
 
1254
1261
  declare global {
1255
1262
  interface HTMLElementTagNameMap {
1256
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1263
+ 'gs-text-input': TextInputComponent;
1264
+ }
1265
+ interface HTMLElementEventMap {
1266
+ 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1257
1267
  }
1258
1268
  }
1259
1269
 
@@ -1261,7 +1271,7 @@ declare global {
1261
1271
  declare global {
1262
1272
  namespace JSX {
1263
1273
  interface IntrinsicElements {
1264
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1274
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1265
1275
  }
1266
1276
  }
1267
1277
  }
@@ -1269,7 +1279,10 @@ declare global {
1269
1279
 
1270
1280
  declare global {
1271
1281
  interface HTMLElementTagNameMap {
1272
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1282
+ 'gs-mutation-filter': MutationFilterComponent;
1283
+ }
1284
+ interface HTMLElementEventMap {
1285
+ 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1273
1286
  }
1274
1287
  }
1275
1288
 
@@ -1277,7 +1290,7 @@ declare global {
1277
1290
  declare global {
1278
1291
  namespace JSX {
1279
1292
  interface IntrinsicElements {
1280
- 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1293
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1281
1294
  }
1282
1295
  }
1283
1296
  }
@@ -1285,7 +1298,10 @@ declare global {
1285
1298
 
1286
1299
  declare global {
1287
1300
  interface HTMLElementTagNameMap {
1288
- 'gs-aggregate': AggregateComponent;
1301
+ 'gs-lineage-filter': LineageFilterComponent;
1302
+ }
1303
+ interface HTMLElementEventMap {
1304
+ 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1289
1305
  }
1290
1306
  }
1291
1307
 
@@ -1293,7 +1309,7 @@ declare global {
1293
1309
  declare global {
1294
1310
  namespace JSX {
1295
1311
  interface IntrinsicElements {
1296
- 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1312
+ 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1297
1313
  }
1298
1314
  }
1299
1315
  }
@@ -1301,7 +1317,7 @@ declare global {
1301
1317
 
1302
1318
  declare global {
1303
1319
  interface HTMLElementTagNameMap {
1304
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1320
+ 'gs-mutation-comparison-component': MutationComparisonComponent;
1305
1321
  }
1306
1322
  }
1307
1323
 
@@ -1309,7 +1325,7 @@ declare global {
1309
1325
  declare global {
1310
1326
  namespace JSX {
1311
1327
  interface IntrinsicElements {
1312
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1328
+ 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1313
1329
  }
1314
1330
  }
1315
1331
  }
@@ -1317,7 +1333,7 @@ declare global {
1317
1333
 
1318
1334
  declare global {
1319
1335
  interface HTMLElementTagNameMap {
1320
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1336
+ 'gs-mutations-component': MutationsComponent;
1321
1337
  }
1322
1338
  }
1323
1339
 
@@ -1325,7 +1341,7 @@ declare global {
1325
1341
  declare global {
1326
1342
  namespace JSX {
1327
1343
  interface IntrinsicElements {
1328
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1344
+ 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1329
1345
  }
1330
1346
  }
1331
1347
  }
@@ -1333,7 +1349,7 @@ declare global {
1333
1349
 
1334
1350
  declare global {
1335
1351
  interface HTMLElementTagNameMap {
1336
- 'gs-sequences-by-location': SequencesByLocationComponent;
1352
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1337
1353
  }
1338
1354
  }
1339
1355
 
@@ -1341,7 +1357,7 @@ declare global {
1341
1357
  declare global {
1342
1358
  namespace JSX {
1343
1359
  interface IntrinsicElements {
1344
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1360
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1345
1361
  }
1346
1362
  }
1347
1363
  }
@@ -1349,7 +1365,7 @@ declare global {
1349
1365
 
1350
1366
  declare global {
1351
1367
  interface HTMLElementTagNameMap {
1352
- 'gs-statistics': StatisticsComponent;
1368
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1353
1369
  }
1354
1370
  }
1355
1371
 
@@ -1357,7 +1373,7 @@ declare global {
1357
1373
  declare global {
1358
1374
  namespace JSX {
1359
1375
  interface IntrinsicElements {
1360
- 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1376
+ 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1361
1377
  }
1362
1378
  }
1363
1379
  }
@@ -1365,11 +1381,7 @@ declare global {
1365
1381
 
1366
1382
  declare global {
1367
1383
  interface HTMLElementTagNameMap {
1368
- 'gs-date-range-selector': DateRangeSelectorComponent;
1369
- }
1370
- interface HTMLElementEventMap {
1371
- 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1372
- 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1384
+ 'gs-aggregate': AggregateComponent;
1373
1385
  }
1374
1386
  }
1375
1387
 
@@ -1377,7 +1389,7 @@ declare global {
1377
1389
  declare global {
1378
1390
  namespace JSX {
1379
1391
  interface IntrinsicElements {
1380
- 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1392
+ 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1381
1393
  }
1382
1394
  }
1383
1395
  }
@@ -1385,10 +1397,7 @@ declare global {
1385
1397
 
1386
1398
  declare global {
1387
1399
  interface HTMLElementTagNameMap {
1388
- 'gs-location-filter': LocationFilterComponent;
1389
- }
1390
- interface HTMLElementEventMap {
1391
- 'gs-location-changed': CustomEvent<Record<string, string>>;
1400
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1392
1401
  }
1393
1402
  }
1394
1403
 
@@ -1396,7 +1405,7 @@ declare global {
1396
1405
  declare global {
1397
1406
  namespace JSX {
1398
1407
  interface IntrinsicElements {
1399
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1408
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1400
1409
  }
1401
1410
  }
1402
1411
  }
@@ -1404,10 +1413,7 @@ declare global {
1404
1413
 
1405
1414
  declare global {
1406
1415
  interface HTMLElementTagNameMap {
1407
- 'gs-text-input': TextInputComponent;
1408
- }
1409
- interface HTMLElementEventMap {
1410
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1416
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1411
1417
  }
1412
1418
  }
1413
1419
 
@@ -1415,7 +1421,7 @@ declare global {
1415
1421
  declare global {
1416
1422
  namespace JSX {
1417
1423
  interface IntrinsicElements {
1418
- 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1424
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1419
1425
  }
1420
1426
  }
1421
1427
  }
@@ -1423,10 +1429,7 @@ declare global {
1423
1429
 
1424
1430
  declare global {
1425
1431
  interface HTMLElementTagNameMap {
1426
- 'gs-mutation-filter': MutationFilterComponent;
1427
- }
1428
- interface HTMLElementEventMap {
1429
- 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1432
+ 'gs-sequences-by-location': SequencesByLocationComponent;
1430
1433
  }
1431
1434
  }
1432
1435
 
@@ -1434,7 +1437,7 @@ declare global {
1434
1437
  declare global {
1435
1438
  namespace JSX {
1436
1439
  interface IntrinsicElements {
1437
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1440
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1438
1441
  }
1439
1442
  }
1440
1443
  }
@@ -1442,10 +1445,7 @@ declare global {
1442
1445
 
1443
1446
  declare global {
1444
1447
  interface HTMLElementTagNameMap {
1445
- 'gs-lineage-filter': LineageFilterComponent;
1446
- }
1447
- interface HTMLElementEventMap {
1448
- 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1448
+ 'gs-statistics': StatisticsComponent;
1449
1449
  }
1450
1450
  }
1451
1451
 
@@ -1453,7 +1453,7 @@ declare global {
1453
1453
  declare global {
1454
1454
  namespace JSX {
1455
1455
  interface IntrinsicElements {
1456
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1456
+ 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1457
1457
  }
1458
1458
  }
1459
1459
  }
@@ -1242,6 +1242,109 @@ const CsvDownloadButton = ({
1242
1242
  };
1243
1243
  return /* @__PURE__ */ u$1("button", { className, onClick: download, children: label });
1244
1244
  };
1245
+ function useModalRef() {
1246
+ return A(null);
1247
+ }
1248
+ const Modal = ({ children, modalRef }) => {
1249
+ return /* @__PURE__ */ u$1("dialog", { ref: modalRef, className: "modal modal-bottom sm:modal-middle", children: [
1250
+ /* @__PURE__ */ u$1("div", { className: "modal-box sm:max-w-5xl", children: [
1251
+ /* @__PURE__ */ u$1("form", { method: "dialog", children: /* @__PURE__ */ u$1("button", { className: "btn btn-sm btn-circle btn-ghost absolute right-2 top-2", children: "✕" }) }),
1252
+ /* @__PURE__ */ u$1("div", { className: "flex flex-col", children }),
1253
+ /* @__PURE__ */ u$1("div", { className: "modal-action", children: /* @__PURE__ */ u$1("form", { method: "dialog", children: /* @__PURE__ */ u$1("button", { className: "float-right underline text-sm hover:text-blue-700 mr-2", children: "Close" }) }) })
1254
+ ] }),
1255
+ /* @__PURE__ */ u$1("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ u$1("button", { children: "Helper to close when clicked outside" }) })
1256
+ ] });
1257
+ };
1258
+ const Info = ({ children }) => {
1259
+ const modalRef = useModalRef();
1260
+ const toggleHelp = () => {
1261
+ var _a;
1262
+ (_a = modalRef.current) == null ? void 0 : _a.showModal();
1263
+ };
1264
+ return /* @__PURE__ */ u$1("div", { className: "relative", children: [
1265
+ /* @__PURE__ */ u$1("button", { type: "button", className: "btn btn-xs", onClick: toggleHelp, children: "?" }),
1266
+ /* @__PURE__ */ u$1(Modal, { modalRef, children })
1267
+ ] });
1268
+ };
1269
+ const InfoHeadline1 = ({ children }) => {
1270
+ return /* @__PURE__ */ u$1("h1", { className: "text-lg font-bold", children });
1271
+ };
1272
+ const InfoHeadline2 = ({ children }) => {
1273
+ return /* @__PURE__ */ u$1("h2", { className: "text-base font-bold mt-4", children });
1274
+ };
1275
+ const InfoParagraph = ({ children }) => {
1276
+ return /* @__PURE__ */ u$1("p", { className: "text-justify my-1", children });
1277
+ };
1278
+ const InfoLink = ({ children, href }) => {
1279
+ return /* @__PURE__ */ u$1("a", { className: "text-blue-600 hover:text-blue-800", href, target: "_blank", rel: "noopener noreferrer", children });
1280
+ };
1281
+ const InfoComponentCode = ({ componentName, params, lapisUrl }) => {
1282
+ const componentCode = componentParametersToCode(componentName, params, lapisUrl);
1283
+ const codePenData = {
1284
+ title: "GenSpectrum dashboard component",
1285
+ html: generateFullExampleCode(componentCode, componentName),
1286
+ layout: "left",
1287
+ editors: "100"
1288
+ };
1289
+ return /* @__PURE__ */ u$1(Fragment, { children: [
1290
+ /* @__PURE__ */ u$1(InfoHeadline2, { children: "Use this component yourself" }),
1291
+ /* @__PURE__ */ u$1(InfoParagraph, { children: [
1292
+ "This component was created using the following parameters:",
1293
+ /* @__PURE__ */ u$1("div", { className: "p-4 border border-gray-200 rounded-lg overflow-x-auto", children: /* @__PURE__ */ u$1("pre", { children: /* @__PURE__ */ u$1("code", { children: componentCode }) }) })
1294
+ ] }),
1295
+ /* @__PURE__ */ u$1(InfoParagraph, { children: [
1296
+ "You can add this component to your own website using the",
1297
+ " ",
1298
+ /* @__PURE__ */ u$1(InfoLink, { href: "https://github.com/GenSpectrum/dashboard-components", children: "GenSpectrum dashboard components library" }),
1299
+ " ",
1300
+ "and the code from above."
1301
+ ] }),
1302
+ /* @__PURE__ */ u$1(InfoParagraph, { children: /* @__PURE__ */ u$1("form", { action: "https://codepen.io/pen/define", method: "POST", target: "_blank", children: [
1303
+ /* @__PURE__ */ u$1(
1304
+ "input",
1305
+ {
1306
+ type: "hidden",
1307
+ name: "data",
1308
+ value: JSON.stringify(codePenData).replace(/"/g, "&quot;").replace(/'/g, "&apos;")
1309
+ }
1310
+ ),
1311
+ /* @__PURE__ */ u$1("button", { className: "text-blue-600 hover:text-blue-800", type: "submit", children: "Click here to try it out on CodePen." })
1312
+ ] }) })
1313
+ ] });
1314
+ };
1315
+ function componentParametersToCode(componentName, params, lapisUrl) {
1316
+ const stringifyIfNeeded = (value) => {
1317
+ return typeof value === "object" ? JSON.stringify(value) : value;
1318
+ };
1319
+ const attributes = indentLines(
1320
+ Object.entries(params).map(([key, value]) => `${key}='${stringifyIfNeeded(value)}'`).join("\n"),
1321
+ 4
1322
+ );
1323
+ return `<gs-app lapis="${lapisUrl}">
1324
+ <gs-${componentName}
1325
+ ${attributes}
1326
+ />
1327
+ </gs-app>`;
1328
+ }
1329
+ function generateFullExampleCode(componentCode, componentName) {
1330
+ const storyBookPath = `/docs/visualization-${componentName}--docs`;
1331
+ return `<html>
1332
+ <head>
1333
+ <script type="module" src="https://unpkg.com/@genspectrum/dashboard-components@latest/standalone-bundle/dashboard-components.js"><\/script>
1334
+ <link rel="stylesheet" href="https://unpkg.com/@genspectrum/dashboard-components@latest/dist/style.css" />
1335
+ </head>
1336
+
1337
+ <body>
1338
+ <!-- Component documentation: https://genspectrum.github.io/dashboard-components/?path=${storyBookPath} -->
1339
+ ${indentLines(componentCode, 2)}
1340
+ </body>
1341
+ </html>
1342
+ `;
1343
+ }
1344
+ function indentLines(text, numberSpaces) {
1345
+ const spaces = " ".repeat(numberSpaces);
1346
+ return text.split("\n").map((line) => spaces + line).join("\n");
1347
+ }
1245
1348
  const GS_ERROR_EVENT_TYPE = "gs-error";
1246
1349
  class ErrorEvent extends Event {
1247
1350
  constructor(error) {
@@ -1270,7 +1373,7 @@ class InvalidPropsError extends Error {
1270
1373
  const ErrorDisplay = ({ error, resetError, layout }) => {
1271
1374
  console.error(error);
1272
1375
  const containerRef = A(null);
1273
- const ref = A(null);
1376
+ const modalRef = useModalRef();
1274
1377
  y(() => {
1275
1378
  var _a;
1276
1379
  (_a = containerRef.current) == null ? void 0 : _a.dispatchEvent(new ErrorEvent(error));
@@ -1288,17 +1391,20 @@ const ErrorDisplay = ({ error, resetError, layout }) => {
1288
1391
  "Oops! Something went wrong.",
1289
1392
  details !== void 0 && /* @__PURE__ */ u$1(Fragment, { children: [
1290
1393
  " ",
1291
- /* @__PURE__ */ u$1("button", { className: "underline hover:text-gray-400", onClick: () => {
1292
- var _a;
1293
- return (_a = ref.current) == null ? void 0 : _a.showModal();
1294
- }, children: "Show details." }),
1295
- /* @__PURE__ */ u$1("dialog", { ref, class: "modal", children: [
1296
- /* @__PURE__ */ u$1("div", { class: "modal-box", children: [
1297
- /* @__PURE__ */ u$1("form", { method: "dialog", children: /* @__PURE__ */ u$1("button", { className: "btn btn-sm btn-circle btn-ghost absolute right-2 top-2", children: "✕" }) }),
1298
- /* @__PURE__ */ u$1("h1", { class: "text-lg", children: details.headline }),
1299
- /* @__PURE__ */ u$1("div", { class: "py-4", children: details.message })
1300
- ] }),
1301
- /* @__PURE__ */ u$1("form", { method: "dialog", class: "modal-backdrop", children: /* @__PURE__ */ u$1("button", { children: "close" }) })
1394
+ /* @__PURE__ */ u$1(
1395
+ "button",
1396
+ {
1397
+ className: "underline hover:text-gray-400",
1398
+ onClick: () => {
1399
+ var _a;
1400
+ return (_a = modalRef.current) == null ? void 0 : _a.showModal();
1401
+ },
1402
+ children: "Show details."
1403
+ }
1404
+ ),
1405
+ /* @__PURE__ */ u$1(Modal, { modalRef, children: [
1406
+ /* @__PURE__ */ u$1(InfoHeadline1, { children: details.headline }),
1407
+ /* @__PURE__ */ u$1(InfoParagraph, { children: details.message })
1302
1408
  ] })
1303
1409
  ] })
1304
1410
  ] })
@@ -1465,103 +1571,6 @@ function useFullscreenStatus() {
1465
1571
  }, []);
1466
1572
  return isFullscreen;
1467
1573
  }
1468
- const Info = ({ children }) => {
1469
- const dialogRef = A(null);
1470
- const toggleHelp = () => {
1471
- var _a;
1472
- (_a = dialogRef.current) == null ? void 0 : _a.showModal();
1473
- };
1474
- return /* @__PURE__ */ u$1("div", { className: "relative", children: [
1475
- /* @__PURE__ */ u$1("button", { type: "button", className: "btn btn-xs", onClick: toggleHelp, children: "?" }),
1476
- /* @__PURE__ */ u$1("dialog", { ref: dialogRef, className: "modal modal-bottom sm:modal-middle", children: [
1477
- /* @__PURE__ */ u$1("div", { className: "modal-box sm:max-w-5xl", children: [
1478
- /* @__PURE__ */ u$1("form", { method: "dialog", children: /* @__PURE__ */ u$1("button", { className: "btn btn-sm btn-circle btn-ghost absolute right-2 top-2", children: "✕" }) }),
1479
- /* @__PURE__ */ u$1("div", { className: "flex flex-col", children }),
1480
- /* @__PURE__ */ u$1("div", { className: "modal-action", children: /* @__PURE__ */ u$1("form", { method: "dialog", children: /* @__PURE__ */ u$1("button", { className: "float-right underline text-sm hover:text-blue-700 mr-2", children: "Close" }) }) })
1481
- ] }),
1482
- /* @__PURE__ */ u$1("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ u$1("button", { children: "Helper to close when clicked outside" }) })
1483
- ] })
1484
- ] });
1485
- };
1486
- const InfoHeadline1 = ({ children }) => {
1487
- return /* @__PURE__ */ u$1("h1", { className: "text-lg font-bold", children });
1488
- };
1489
- const InfoHeadline2 = ({ children }) => {
1490
- return /* @__PURE__ */ u$1("h2", { className: "text-base font-bold mt-4", children });
1491
- };
1492
- const InfoParagraph = ({ children }) => {
1493
- return /* @__PURE__ */ u$1("p", { className: "text-justify my-1", children });
1494
- };
1495
- const InfoLink = ({ children, href }) => {
1496
- return /* @__PURE__ */ u$1("a", { className: "text-blue-600 hover:text-blue-800", href, target: "_blank", rel: "noopener noreferrer", children });
1497
- };
1498
- const InfoComponentCode = ({ componentName, params, lapisUrl }) => {
1499
- const componentCode = componentParametersToCode(componentName, params, lapisUrl);
1500
- const codePenData = {
1501
- title: "GenSpectrum dashboard component",
1502
- html: generateFullExampleCode(componentCode, componentName),
1503
- layout: "left",
1504
- editors: "100"
1505
- };
1506
- return /* @__PURE__ */ u$1(Fragment, { children: [
1507
- /* @__PURE__ */ u$1(InfoHeadline2, { children: "Use this component yourself" }),
1508
- /* @__PURE__ */ u$1(InfoParagraph, { children: [
1509
- "This component was created using the following parameters:",
1510
- /* @__PURE__ */ u$1("div", { className: "p-4 border border-gray-200 rounded-lg overflow-x-auto", children: /* @__PURE__ */ u$1("pre", { children: /* @__PURE__ */ u$1("code", { children: componentCode }) }) })
1511
- ] }),
1512
- /* @__PURE__ */ u$1(InfoParagraph, { children: [
1513
- "You can add this component to your own website using the",
1514
- " ",
1515
- /* @__PURE__ */ u$1(InfoLink, { href: "https://github.com/GenSpectrum/dashboard-components", children: "GenSpectrum dashboard components library" }),
1516
- " ",
1517
- "and the code from above."
1518
- ] }),
1519
- /* @__PURE__ */ u$1(InfoParagraph, { children: /* @__PURE__ */ u$1("form", { action: "https://codepen.io/pen/define", method: "POST", target: "_blank", children: [
1520
- /* @__PURE__ */ u$1(
1521
- "input",
1522
- {
1523
- type: "hidden",
1524
- name: "data",
1525
- value: JSON.stringify(codePenData).replace(/"/g, "&quot;").replace(/'/g, "&apos;")
1526
- }
1527
- ),
1528
- /* @__PURE__ */ u$1("button", { className: "text-blue-600 hover:text-blue-800", type: "submit", children: "Click here to try it out on CodePen." })
1529
- ] }) })
1530
- ] });
1531
- };
1532
- function componentParametersToCode(componentName, params, lapisUrl) {
1533
- const stringifyIfNeeded = (value) => {
1534
- return typeof value === "object" ? JSON.stringify(value) : value;
1535
- };
1536
- const attributes = indentLines(
1537
- Object.entries(params).map(([key, value]) => `${key}='${stringifyIfNeeded(value)}'`).join("\n"),
1538
- 4
1539
- );
1540
- return `<gs-app lapis="${lapisUrl}">
1541
- <gs-${componentName}
1542
- ${attributes}
1543
- />
1544
- </gs-app>`;
1545
- }
1546
- function generateFullExampleCode(componentCode, componentName) {
1547
- const storyBookPath = `/docs/visualization-${componentName}--docs`;
1548
- return `<html>
1549
- <head>
1550
- <script type="module" src="https://unpkg.com/@genspectrum/dashboard-components@latest/standalone-bundle/dashboard-components.js"><\/script>
1551
- <link rel="stylesheet" href="https://unpkg.com/@genspectrum/dashboard-components@latest/dist/style.css" />
1552
- </head>
1553
-
1554
- <body>
1555
- <!-- Component documentation: https://genspectrum.github.io/dashboard-components/?path=${storyBookPath} -->
1556
- ${indentLines(componentCode, 2)}
1557
- </body>
1558
- </html>
1559
- `;
1560
- }
1561
- function indentLines(text, numberSpaces) {
1562
- const spaces = " ".repeat(numberSpaces);
1563
- return text.split("\n").map((line) => spaces + line).join("\n");
1564
- }
1565
1574
  const LoadingDisplay = () => {
1566
1575
  return /* @__PURE__ */ u$1(
1567
1576
  "div",
@@ -4486,9 +4495,6 @@ input.tab:checked + .tab-content,
4486
4495
  border-end-end-radius: inherit;
4487
4496
  border-start-end-radius: inherit;
4488
4497
  }
4489
- .modal-middle {
4490
- place-items: center;
4491
- }
4492
4498
  .modal-bottom {
4493
4499
  place-items: end;
4494
4500
  }
@@ -4933,9 +4939,6 @@ input.tab:checked + .tab-content,
4933
4939
  .min-w-\\[7\\.5rem\\] {
4934
4940
  min-width: 7.5rem;
4935
4941
  }
4936
- .max-w-3xl {
4937
- max-width: 48rem;
4938
- }
4939
4942
  .max-w-screen-lg {
4940
4943
  max-width: 1024px;
4941
4944
  }
@@ -5109,10 +5112,6 @@ input.tab:checked + .tab-content,
5109
5112
  padding-top: 0.5rem;
5110
5113
  padding-bottom: 0.5rem;
5111
5114
  }
5112
- .py-4 {
5113
- padding-top: 1rem;
5114
- padding-bottom: 1rem;
5115
- }
5116
5115
  .pl-2 {
5117
5116
  padding-left: 0.5rem;
5118
5117
  }
@@ -10199,7 +10198,7 @@ const SequencesByLocationMapInner$1 = ({
10199
10198
  return {
10200
10199
  fillColor: getColor((_a2 = feature == null ? void 0 : feature.properties.data) == null ? void 0 : _a2.proportion),
10201
10200
  fillOpacity: 1,
10202
- color: "grey",
10201
+ color: "#666666",
10203
10202
  weight: 1
10204
10203
  };
10205
10204
  }
@@ -10230,7 +10229,7 @@ const DataMatchInformation = ({
10230
10229
  nullCount,
10231
10230
  hasTableView
10232
10231
  }) => {
10233
- const dialogRef = A(null);
10232
+ const modalRef = useModalRef();
10234
10233
  const proportion = formatProportion(countOfMatchedLocationData / totalCount);
10235
10234
  return /* @__PURE__ */ u$1(Fragment, { children: [
10236
10235
  /* @__PURE__ */ u$1(
@@ -10238,7 +10237,7 @@ const DataMatchInformation = ({
10238
10237
  {
10239
10238
  onClick: () => {
10240
10239
  var _a;
10241
- return (_a = dialogRef.current) == null ? void 0 : _a.showModal();
10240
+ return (_a = modalRef.current) == null ? void 0 : _a.showModal();
10242
10241
  },
10243
10242
  className: "text-sm absolute bottom-0 px-1 z-[1001] bg-white rounded border cursor-pointer tooltip",
10244
10243
  "data-tip": "Click for detailed information",
@@ -10249,32 +10248,28 @@ const DataMatchInformation = ({
10249
10248
  ]
10250
10249
  }
10251
10250
  ),
10252
- /* @__PURE__ */ u$1("dialog", { ref: dialogRef, className: "modal modal-middle", children: [
10253
- /* @__PURE__ */ u$1("div", { className: "modal-box max-w-3xl", children: [
10254
- /* @__PURE__ */ u$1(InfoHeadline1, { children: "Sequences By Location - Map View" }),
10255
- /* @__PURE__ */ u$1(InfoParagraph, { children: [
10256
- "The current filter has matched ",
10257
- totalCount.toLocaleString("en-us"),
10258
- " sequences. From these sequences, we were able to match ",
10259
- countOfMatchedLocationData.toLocaleString("en-us"),
10260
- " (",
10261
- proportion,
10262
- ") on locations on the map."
10263
- ] }),
10264
- /* @__PURE__ */ u$1(InfoParagraph, { children: [
10265
- unmatchedLocations.length > 0 && /* @__PURE__ */ u$1(Fragment, { children: [
10266
- "The following locations from the data could not be matched on the map:",
10267
- " ",
10268
- unmatchedLocations.map((it) => `"${it}"`).join(", "),
10269
- ".",
10270
- " "
10271
- ] }),
10272
- nullCount > 0 && `${nullCount.toLocaleString("en-us")} matching sequences have no location information. `,
10273
- hasTableView && "You can check the table view for more detailed information."
10274
- ] }),
10275
- /* @__PURE__ */ u$1("div", { className: "modal-action", children: /* @__PURE__ */ u$1("form", { method: "dialog", children: /* @__PURE__ */ u$1("button", { className: "float-right underline text-sm hover:text-blue-700 mr-2", children: "Close" }) }) })
10251
+ /* @__PURE__ */ u$1(Modal, { modalRef, children: [
10252
+ /* @__PURE__ */ u$1(InfoHeadline1, { children: "Sequences By Location - Map View" }),
10253
+ /* @__PURE__ */ u$1(InfoParagraph, { children: [
10254
+ "The current filter has matched ",
10255
+ totalCount.toLocaleString("en-us"),
10256
+ " sequences. From these sequences, we were able to match ",
10257
+ countOfMatchedLocationData.toLocaleString("en-us"),
10258
+ " (",
10259
+ proportion,
10260
+ ") on locations on the map."
10276
10261
  ] }),
10277
- /* @__PURE__ */ u$1("form", { method: "dialog", className: "modal-backdrop", children: /* @__PURE__ */ u$1("button", { children: "Helper to close when clicked outside" }) })
10262
+ /* @__PURE__ */ u$1(InfoParagraph, { children: [
10263
+ unmatchedLocations.length > 0 && /* @__PURE__ */ u$1(Fragment, { children: [
10264
+ "The following locations from the data could not be matched on the map:",
10265
+ " ",
10266
+ unmatchedLocations.map((it) => `"${it}"`).join(", "),
10267
+ ".",
10268
+ " "
10269
+ ] }),
10270
+ nullCount > 0 && `${nullCount.toLocaleString("en-us")} matching sequences have no location information. `,
10271
+ hasTableView && "You can check the table view for more detailed information."
10272
+ ] })
10278
10273
  ] })
10279
10274
  ] });
10280
10275
  };
@@ -10318,7 +10313,7 @@ function matchLocationDataAndGeoJsonFeatures(geojsonData, countAndProportionByCo
10318
10313
  }
10319
10314
  function getColor(value) {
10320
10315
  if (value === void 0) {
10321
- return "#888888";
10316
+ return "#DDDDDD";
10322
10317
  }
10323
10318
  const thresholds = [
10324
10319
  { limit: 0.4, color: "#662506" },