@cjlapao/ui-kit 0.2.32 → 0.2.33
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/{CodeBlock-Dm0yAxf-.d.cts → CodeBlock-QDW3hqU0.d.cts} +1 -1
- package/dist/{CodeBlock-Dm0yAxf-.d.ts → CodeBlock-QDW3hqU0.d.ts} +1 -1
- package/dist/index.cjs +546 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +675 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +122 -6
- package/dist/index.d.ts +122 -6
- package/dist/index.js +529 -107
- package/dist/index.js.map +1 -1
- package/dist/markdown.cjs +102 -3
- package/dist/markdown.cjs.map +1 -1
- package/dist/markdown.d.cts +2 -2
- package/dist/markdown.d.ts +2 -2
- package/dist/markdown.js +102 -3
- package/dist/markdown.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -154,6 +154,7 @@ __export(src_exports, {
|
|
|
154
154
|
FR_KIT_CATALOG: () => FR_KIT_CATALOG,
|
|
155
155
|
FUNNEL_MAX_STAGES: () => FUNNEL_MAX_STAGES,
|
|
156
156
|
FileUpload: () => FileUpload,
|
|
157
|
+
FilterBar: () => FilterBar,
|
|
157
158
|
FormField: () => FormField_default,
|
|
158
159
|
FormLayout: () => FormLayout_default,
|
|
159
160
|
FormSection: () => FormSection_default,
|
|
@@ -8749,6 +8750,13 @@ function getLocalizedParseNames(locale, catalog) {
|
|
|
8749
8750
|
// ../common/i18n/builtIn/de.ts
|
|
8750
8751
|
var DE_KIT_CATALOG = {
|
|
8751
8752
|
kit: {
|
|
8753
|
+
codeBlock: {
|
|
8754
|
+
code: "Code",
|
|
8755
|
+
edit: "Code bearbeiten",
|
|
8756
|
+
copy: "Code kopieren",
|
|
8757
|
+
copied: "Kopiert",
|
|
8758
|
+
copyFailed: "Kopieren fehlgeschlagen. Code ausw\xE4hlen und manuell kopieren."
|
|
8759
|
+
},
|
|
8752
8760
|
knowledge: {
|
|
8753
8761
|
"library": "Erinnerungsbibliothek",
|
|
8754
8762
|
"map": "Wissenskarte",
|
|
@@ -9021,6 +9029,20 @@ var DE_KIT_CATALOG = {
|
|
|
9021
9029
|
progressspinner: {
|
|
9022
9030
|
loading: "Wird geladen"
|
|
9023
9031
|
},
|
|
9032
|
+
filterbar: {
|
|
9033
|
+
filters: "Filter",
|
|
9034
|
+
search: "Suchen",
|
|
9035
|
+
empty: "Keine Filter angewendet",
|
|
9036
|
+
add: "Filter hinzuf\xFCgen",
|
|
9037
|
+
filterBy: "Filtern nach",
|
|
9038
|
+
back: "Zur\xFCck",
|
|
9039
|
+
clear: "Leeren",
|
|
9040
|
+
done: "Fertig",
|
|
9041
|
+
clearAll: "Alle l\xF6schen",
|
|
9042
|
+
items: "Eintr\xE4ge",
|
|
9043
|
+
summary: "{filtered} von {total} {items}",
|
|
9044
|
+
remove: "Filter {label} entfernen"
|
|
9045
|
+
},
|
|
9024
9046
|
searchbar: {
|
|
9025
9047
|
clearAria: "Suche l\xF6schen",
|
|
9026
9048
|
placeholder: "Suchen..."
|
|
@@ -9524,6 +9546,20 @@ var EN_KIT_CATALOG = {
|
|
|
9524
9546
|
progressspinner: {
|
|
9525
9547
|
loading: "Loading"
|
|
9526
9548
|
},
|
|
9549
|
+
filterbar: {
|
|
9550
|
+
filters: "Filters",
|
|
9551
|
+
search: "Search",
|
|
9552
|
+
empty: "No filters applied",
|
|
9553
|
+
add: "Add filter",
|
|
9554
|
+
filterBy: "Filter by",
|
|
9555
|
+
back: "Back",
|
|
9556
|
+
clear: "Clear",
|
|
9557
|
+
done: "Done",
|
|
9558
|
+
clearAll: "Clear all",
|
|
9559
|
+
items: "items",
|
|
9560
|
+
summary: "{filtered} of {total} {items}",
|
|
9561
|
+
remove: "Remove {label} filter"
|
|
9562
|
+
},
|
|
9527
9563
|
searchbar: {
|
|
9528
9564
|
clearAria: "Clear search",
|
|
9529
9565
|
placeholder: "Search..."
|
|
@@ -9748,6 +9784,13 @@ var EN_KIT_CATALOG = {
|
|
|
9748
9784
|
// ../common/i18n/builtIn/es.ts
|
|
9749
9785
|
var ES_KIT_CATALOG = {
|
|
9750
9786
|
kit: {
|
|
9787
|
+
codeBlock: {
|
|
9788
|
+
code: "C\xF3digo",
|
|
9789
|
+
edit: "Editar c\xF3digo",
|
|
9790
|
+
copy: "Copiar c\xF3digo",
|
|
9791
|
+
copied: "Copiado",
|
|
9792
|
+
copyFailed: "No se pudo copiar. Selecciona y copia el c\xF3digo manualmente."
|
|
9793
|
+
},
|
|
9751
9794
|
knowledge: {
|
|
9752
9795
|
"library": "Biblioteca de memorias",
|
|
9753
9796
|
"map": "Mapa de conocimiento",
|
|
@@ -10020,6 +10063,20 @@ var ES_KIT_CATALOG = {
|
|
|
10020
10063
|
progressspinner: {
|
|
10021
10064
|
loading: "Cargando"
|
|
10022
10065
|
},
|
|
10066
|
+
filterbar: {
|
|
10067
|
+
filters: "Filtros",
|
|
10068
|
+
search: "Buscar",
|
|
10069
|
+
empty: "Sin filtros aplicados",
|
|
10070
|
+
add: "A\xF1adir filtro",
|
|
10071
|
+
filterBy: "Filtrar por",
|
|
10072
|
+
back: "Volver",
|
|
10073
|
+
clear: "Limpiar",
|
|
10074
|
+
done: "Listo",
|
|
10075
|
+
clearAll: "Borrar todos",
|
|
10076
|
+
items: "elementos",
|
|
10077
|
+
summary: "{filtered} de {total} {items}",
|
|
10078
|
+
remove: "Eliminar filtro {label}"
|
|
10079
|
+
},
|
|
10023
10080
|
searchbar: {
|
|
10024
10081
|
clearAria: "Borrar b\xFAsqueda",
|
|
10025
10082
|
placeholder: "Buscar..."
|
|
@@ -10244,6 +10301,13 @@ var ES_KIT_CATALOG = {
|
|
|
10244
10301
|
// ../common/i18n/builtIn/fr.ts
|
|
10245
10302
|
var FR_KIT_CATALOG = {
|
|
10246
10303
|
kit: {
|
|
10304
|
+
codeBlock: {
|
|
10305
|
+
code: "Code",
|
|
10306
|
+
edit: "Modifier le code",
|
|
10307
|
+
copy: "Copier le code",
|
|
10308
|
+
copied: "Copi\xE9",
|
|
10309
|
+
copyFailed: "Copie impossible. S\xE9lectionnez et copiez le code manuellement."
|
|
10310
|
+
},
|
|
10247
10311
|
knowledge: {
|
|
10248
10312
|
"library": "Biblioth\xE8que de m\xE9moires",
|
|
10249
10313
|
"map": "Carte des connaissances",
|
|
@@ -10516,6 +10580,20 @@ var FR_KIT_CATALOG = {
|
|
|
10516
10580
|
progressspinner: {
|
|
10517
10581
|
loading: "Chargement"
|
|
10518
10582
|
},
|
|
10583
|
+
filterbar: {
|
|
10584
|
+
filters: "Filtres",
|
|
10585
|
+
search: "Rechercher",
|
|
10586
|
+
empty: "Aucun filtre appliqu\xE9",
|
|
10587
|
+
add: "Ajouter un filtre",
|
|
10588
|
+
filterBy: "Filtrer par",
|
|
10589
|
+
back: "Retour",
|
|
10590
|
+
clear: "Effacer",
|
|
10591
|
+
done: "Termin\xE9",
|
|
10592
|
+
clearAll: "Tout effacer",
|
|
10593
|
+
items: "\xE9l\xE9ments",
|
|
10594
|
+
summary: "{filtered} sur {total} {items}",
|
|
10595
|
+
remove: "Supprimer le filtre {label}"
|
|
10596
|
+
},
|
|
10519
10597
|
searchbar: {
|
|
10520
10598
|
clearAria: "Effacer la recherche",
|
|
10521
10599
|
placeholder: "Rechercher..."
|
|
@@ -10740,6 +10818,13 @@ var FR_KIT_CATALOG = {
|
|
|
10740
10818
|
// ../common/i18n/builtIn/pt.ts
|
|
10741
10819
|
var PT_KIT_CATALOG = {
|
|
10742
10820
|
kit: {
|
|
10821
|
+
codeBlock: {
|
|
10822
|
+
code: "C\xF3digo",
|
|
10823
|
+
edit: "Editar c\xF3digo",
|
|
10824
|
+
copy: "Copiar c\xF3digo",
|
|
10825
|
+
copied: "Copiado",
|
|
10826
|
+
copyFailed: "N\xE3o foi poss\xEDvel copiar. Selecione e copie o c\xF3digo manualmente."
|
|
10827
|
+
},
|
|
10743
10828
|
knowledge: {
|
|
10744
10829
|
"library": "Biblioteca de mem\xF3rias",
|
|
10745
10830
|
"map": "Mapa de conhecimento",
|
|
@@ -11012,6 +11097,20 @@ var PT_KIT_CATALOG = {
|
|
|
11012
11097
|
progressspinner: {
|
|
11013
11098
|
loading: "Carregando"
|
|
11014
11099
|
},
|
|
11100
|
+
filterbar: {
|
|
11101
|
+
filters: "Filtros",
|
|
11102
|
+
search: "Pesquisar",
|
|
11103
|
+
empty: "Nenhum filtro aplicado",
|
|
11104
|
+
add: "Adicionar filtro",
|
|
11105
|
+
filterBy: "Filtrar por",
|
|
11106
|
+
back: "Voltar",
|
|
11107
|
+
clear: "Limpar",
|
|
11108
|
+
done: "Conclu\xEDdo",
|
|
11109
|
+
clearAll: "Limpar todos",
|
|
11110
|
+
items: "itens",
|
|
11111
|
+
summary: "{filtered} de {total} {items}",
|
|
11112
|
+
remove: "Remover filtro {label}"
|
|
11113
|
+
},
|
|
11015
11114
|
searchbar: {
|
|
11016
11115
|
clearAria: "Limpar busca",
|
|
11017
11116
|
placeholder: "Buscar..."
|
|
@@ -12353,7 +12452,7 @@ var Panel = import_react158.default.forwardRef(function Panel2({
|
|
|
12353
12452
|
if (specularHighlight === false) return "none";
|
|
12354
12453
|
return "classic";
|
|
12355
12454
|
})();
|
|
12356
|
-
const effectiveHoverColor = hoverColor ?? (
|
|
12455
|
+
const effectiveHoverColor = hoverColor ?? (resolvedTone !== "none" && resolvedTone !== "neutral" ? resolvedTone : void 0);
|
|
12357
12456
|
const hoverColorName = effectiveHoverColor ? effectiveHoverColor : void 0;
|
|
12358
12457
|
const borderPalette = borderColor ? getPanelToneStyles(borderColor) : void 0;
|
|
12359
12458
|
const effectiveBorderClass = borderPalette?.border;
|
|
@@ -15928,7 +16027,7 @@ var ExpandableButton = (0, import_react171.forwardRef)(
|
|
|
15928
16027
|
fadeDuration,
|
|
15929
16028
|
labelGap,
|
|
15930
16029
|
labelSlide,
|
|
15931
|
-
elevate =
|
|
16030
|
+
elevate = false,
|
|
15932
16031
|
iconMotion = "pop-tilt",
|
|
15933
16032
|
squish = true,
|
|
15934
16033
|
labelPlacement = "after",
|
|
@@ -18887,6 +18986,7 @@ var Combobox = import_react184.default.forwardRef(
|
|
|
18887
18986
|
leadingIcon,
|
|
18888
18987
|
visibleRows = 6,
|
|
18889
18988
|
panelVariant = "auto",
|
|
18989
|
+
panelTone = "auto",
|
|
18890
18990
|
panelCorner = "auto",
|
|
18891
18991
|
className,
|
|
18892
18992
|
listClassName,
|
|
@@ -19032,7 +19132,7 @@ var Combobox = import_react184.default.forwardRef(
|
|
|
19032
19132
|
Panel_default,
|
|
19033
19133
|
{
|
|
19034
19134
|
variant: resolvedPanelVariant,
|
|
19035
|
-
tone: PANEL_TONE_FOR_FIELD,
|
|
19135
|
+
tone: panelTone === "auto" ? PANEL_TONE_FOR_FIELD : panelTone,
|
|
19036
19136
|
corner: panelCorner,
|
|
19037
19137
|
padding: "none",
|
|
19038
19138
|
scrollable: false,
|
|
@@ -19261,6 +19361,7 @@ var Picker = ({
|
|
|
19261
19361
|
glowIntensity = DEFAULT_GLOW_INTENSITY,
|
|
19262
19362
|
validationStatus = "none",
|
|
19263
19363
|
panelVariant = "auto",
|
|
19364
|
+
panelTone = "auto",
|
|
19264
19365
|
panelCorner = "auto",
|
|
19265
19366
|
disabled = false,
|
|
19266
19367
|
multi = false,
|
|
@@ -19491,7 +19592,7 @@ var Picker = ({
|
|
|
19491
19592
|
Panel_default,
|
|
19492
19593
|
{
|
|
19493
19594
|
variant: resolvedPanelVariant,
|
|
19494
|
-
tone: PANEL_TONE_FOR_FIELD,
|
|
19595
|
+
tone: panelTone === "auto" ? PANEL_TONE_FOR_FIELD : panelTone,
|
|
19495
19596
|
corner: panelCorner,
|
|
19496
19597
|
padding: "none",
|
|
19497
19598
|
scrollable: false,
|
|
@@ -19593,14 +19694,19 @@ var Picker = ({
|
|
|
19593
19694
|
}
|
|
19594
19695
|
)
|
|
19595
19696
|
] }),
|
|
19596
|
-
multi &&
|
|
19697
|
+
multi && /* @__PURE__ */ (0, import_jsx_runtime191.jsxs)(
|
|
19597
19698
|
"button",
|
|
19598
19699
|
{
|
|
19599
19700
|
type: "button",
|
|
19701
|
+
disabled: effectiveSelectedIds.length === 0,
|
|
19600
19702
|
onMouseDown: (e) => e.preventDefault(),
|
|
19601
19703
|
onClick: handleClearMulti,
|
|
19602
19704
|
className: (0, import_classnames38.default)(
|
|
19603
|
-
|
|
19705
|
+
// Always rendered: mounting it on the first pick pushed the
|
|
19706
|
+
// list down and resized the popup (flicker). Hidden, not
|
|
19707
|
+
// removed, while nothing is selected.
|
|
19708
|
+
"flex w-full select-none items-center justify-between border-b border-black/5 px-4 py-1.5 text-xs dark:border-white/10",
|
|
19709
|
+
effectiveSelectedIds.length > 0 ? "cursor-pointer hover:bg-neutral-50 dark:hover:bg-neutral-800/60" : "invisible",
|
|
19604
19710
|
popupText.muted
|
|
19605
19711
|
),
|
|
19606
19712
|
children: [
|
|
@@ -20179,6 +20285,7 @@ var TagPicker = ({
|
|
|
20179
20285
|
glowIntensity = DEFAULT_GLOW_INTENSITY,
|
|
20180
20286
|
validationStatus = "none",
|
|
20181
20287
|
panelVariant = "auto",
|
|
20288
|
+
panelTone = "auto",
|
|
20182
20289
|
panelCorner = "auto",
|
|
20183
20290
|
tagLimit = 3,
|
|
20184
20291
|
highlightNew = true,
|
|
@@ -20362,7 +20469,7 @@ var TagPicker = ({
|
|
|
20362
20469
|
const idx = filtered.findIndex((item) => selectedSet.has(item.id));
|
|
20363
20470
|
setFocusedIndex(idx >= 0 ? idx : multi || filtered.length === 0 ? -1 : 0);
|
|
20364
20471
|
}, [open]);
|
|
20365
|
-
const
|
|
20472
|
+
const normalize2 = (0, import_react186.useCallback)(
|
|
20366
20473
|
(v) => normalizeValue ? normalizeValue(v) : v,
|
|
20367
20474
|
[normalizeValue]
|
|
20368
20475
|
);
|
|
@@ -20372,7 +20479,7 @@ var TagPicker = ({
|
|
|
20372
20479
|
filtered.findIndex((candidate) => candidate.id === item.id)
|
|
20373
20480
|
);
|
|
20374
20481
|
setCursorByKeyboard(fromKeyboard);
|
|
20375
|
-
const id =
|
|
20482
|
+
const id = normalize2(item.id);
|
|
20376
20483
|
if (!multi) {
|
|
20377
20484
|
onChange([id]);
|
|
20378
20485
|
setOpen(false);
|
|
@@ -20385,14 +20492,14 @@ var TagPicker = ({
|
|
|
20385
20492
|
onChange([...value, id]);
|
|
20386
20493
|
}
|
|
20387
20494
|
},
|
|
20388
|
-
[multi,
|
|
20495
|
+
[multi, normalize2, onChange, selectedSet, value, filtered]
|
|
20389
20496
|
);
|
|
20390
20497
|
const handleRemove = (0, import_react186.useCallback)(
|
|
20391
20498
|
(v) => onChange(value.filter((x) => x !== v)),
|
|
20392
20499
|
[onChange, value]
|
|
20393
20500
|
);
|
|
20394
20501
|
const handleCreate = (0, import_react186.useCallback)(() => {
|
|
20395
|
-
const label =
|
|
20502
|
+
const label = normalize2(query.trim());
|
|
20396
20503
|
if (!label) return;
|
|
20397
20504
|
if (onCreateItem) {
|
|
20398
20505
|
onCreateItem(label);
|
|
@@ -20403,7 +20510,7 @@ var TagPicker = ({
|
|
|
20403
20510
|
}
|
|
20404
20511
|
if (!multi) setOpen(false);
|
|
20405
20512
|
setQuery("");
|
|
20406
|
-
}, [query,
|
|
20513
|
+
}, [query, normalize2, onCreateItem, multi, onChange, value]);
|
|
20407
20514
|
const handleKeyDown = (e) => {
|
|
20408
20515
|
if (e.key === "ArrowDown") {
|
|
20409
20516
|
e.preventDefault();
|
|
@@ -20439,7 +20546,7 @@ var TagPicker = ({
|
|
|
20439
20546
|
Panel_default,
|
|
20440
20547
|
{
|
|
20441
20548
|
variant: resolvedPanelVariant,
|
|
20442
|
-
tone: PANEL_TONE_FOR_FIELD,
|
|
20549
|
+
tone: panelTone === "auto" ? PANEL_TONE_FOR_FIELD : panelTone,
|
|
20443
20550
|
corner: panelCorner,
|
|
20444
20551
|
padding: "none",
|
|
20445
20552
|
scrollable: false,
|
|
@@ -22140,8 +22247,8 @@ function StackCarousel({
|
|
|
22140
22247
|
setExpanded(true);
|
|
22141
22248
|
}, Math.max(0, Number.isFinite(hoverExpandDelay) ? hoverExpandDelay : 2e3));
|
|
22142
22249
|
};
|
|
22143
|
-
const
|
|
22144
|
-
const index =
|
|
22250
|
+
const normalize2 = (0, import_react190.useCallback)((value) => loop ? wrap(value, items.length) : Math.max(0, Math.min(items.length - 1, Math.trunc(value))), [loop, items.length]);
|
|
22251
|
+
const index = normalize2(Number.isFinite(activeIndex ?? internalIndex) ? activeIndex ?? internalIndex : 0);
|
|
22145
22252
|
const layers = Math.min(loop ? items.length : items.length - index, Math.max(1, Math.min(3, Math.trunc(visibleCount) || 1)));
|
|
22146
22253
|
const offset = Math.max(0, Number.isFinite(stackOffset) ? stackOffset : 12);
|
|
22147
22254
|
const rootRef = (0, import_react190.useRef)(null);
|
|
@@ -22159,14 +22266,14 @@ function StackCarousel({
|
|
|
22159
22266
|
}, [isExpanded]);
|
|
22160
22267
|
const navigate = (0, import_react190.useCallback)((next, focus = false) => {
|
|
22161
22268
|
if (items.length < 2) return;
|
|
22162
|
-
const normalized =
|
|
22269
|
+
const normalized = normalize2(next);
|
|
22163
22270
|
if (normalized === index) return;
|
|
22164
22271
|
if (focus || measureRef.current?.contains(document.activeElement)) {
|
|
22165
22272
|
rootRef.current?.focus({ preventScroll: true });
|
|
22166
22273
|
}
|
|
22167
22274
|
if (activeIndex === void 0) setInternalIndex(normalized);
|
|
22168
22275
|
onActiveIndexChange?.(normalized);
|
|
22169
|
-
}, [items.length, index, activeIndex, onActiveIndexChange,
|
|
22276
|
+
}, [items.length, index, activeIndex, onActiveIndexChange, normalize2]);
|
|
22170
22277
|
(0, import_react190.useLayoutEffect)(() => {
|
|
22171
22278
|
const old = previousIndex.current;
|
|
22172
22279
|
previousIndex.current = index;
|
|
@@ -22229,7 +22336,7 @@ function StackCarousel({
|
|
|
22229
22336
|
root.addEventListener("wheel", handleWheel, { passive: false });
|
|
22230
22337
|
return () => root.removeEventListener("wheel", handleWheel);
|
|
22231
22338
|
}, [wheel, isExpanded, items.length, index, navigate, canScrollInside]);
|
|
22232
|
-
const visible = isExpanded ? items.map((_, i) => i) : Array.from({ length: layers }, (_, rank) =>
|
|
22339
|
+
const visible = isExpanded ? items.map((_, i) => i) : Array.from({ length: layers }, (_, rank) => normalize2(index + rank));
|
|
22233
22340
|
const rendered = [...visible];
|
|
22234
22341
|
const transitionFrom = previousIndex.current !== index ? previousIndex.current : outgoing;
|
|
22235
22342
|
if (!isExpanded && transitionFrom !== null && transitionFrom < items.length && !rendered.includes(transitionFrom)) rendered.push(transitionFrom);
|
|
@@ -40752,7 +40859,7 @@ var HelpButton = ({
|
|
|
40752
40859
|
window.removeEventListener("resize", recompute);
|
|
40753
40860
|
};
|
|
40754
40861
|
}, [open, recompute]);
|
|
40755
|
-
const palette = getPanelToneStyles(
|
|
40862
|
+
const palette = getPanelToneStyles(tone);
|
|
40756
40863
|
const surfaceText = getSurfaceTextTokens(variant);
|
|
40757
40864
|
const isMarkdown = typeof content === "string";
|
|
40758
40865
|
return /* @__PURE__ */ (0, import_jsx_runtime253.jsxs)("span", { className: (0, import_classnames69.default)("inline-flex items-center", className), children: [
|
|
@@ -42835,7 +42942,7 @@ var Popover = ({
|
|
|
42835
42942
|
"aria-hidden": "true",
|
|
42836
42943
|
className: (0, import_classnames73.default)(
|
|
42837
42944
|
"absolute block h-4 w-4 rotate-45",
|
|
42838
|
-
ARROW_SIDE_BORDERS[position.placement.side],
|
|
42945
|
+
variant !== "none" && ARROW_SIDE_BORDERS[position.placement.side],
|
|
42839
42946
|
chrome.border,
|
|
42840
42947
|
chrome.fill,
|
|
42841
42948
|
chrome.backdrop
|
|
@@ -42861,7 +42968,8 @@ var Popover = ({
|
|
|
42861
42968
|
"aria-hidden": "true",
|
|
42862
42969
|
"data-popover-bubble": true,
|
|
42863
42970
|
className: (0, import_classnames73.default)(
|
|
42864
|
-
"pointer-events-none absolute z-20 block rounded-full
|
|
42971
|
+
"pointer-events-none absolute z-20 block rounded-full",
|
|
42972
|
+
variant !== "none" && "border",
|
|
42865
42973
|
chrome.border,
|
|
42866
42974
|
chrome.fill,
|
|
42867
42975
|
chrome.backdrop
|
|
@@ -46298,6 +46406,7 @@ var SideMenuCtaCard = ({
|
|
|
46298
46406
|
);
|
|
46299
46407
|
};
|
|
46300
46408
|
var SideMenuDetailPanel = ({
|
|
46409
|
+
variant,
|
|
46301
46410
|
items,
|
|
46302
46411
|
tone,
|
|
46303
46412
|
menuTone,
|
|
@@ -46336,11 +46445,11 @@ var SideMenuDetailPanel = ({
|
|
|
46336
46445
|
},
|
|
46337
46446
|
item.slug
|
|
46338
46447
|
));
|
|
46339
|
-
if (glass) {
|
|
46448
|
+
if (glass || variant) {
|
|
46340
46449
|
return /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
46341
46450
|
Panel_default,
|
|
46342
46451
|
{
|
|
46343
|
-
variant: "glass",
|
|
46452
|
+
variant: variant ?? "glass",
|
|
46344
46453
|
tone,
|
|
46345
46454
|
corner: "rounded-sm",
|
|
46346
46455
|
padding: "none",
|
|
@@ -46383,6 +46492,7 @@ var SideMenu = ({
|
|
|
46383
46492
|
ctas,
|
|
46384
46493
|
footerDetails,
|
|
46385
46494
|
footerDetailsTone,
|
|
46495
|
+
footerDetailsVariant,
|
|
46386
46496
|
noise = false,
|
|
46387
46497
|
noiseScale,
|
|
46388
46498
|
loading = false,
|
|
@@ -46959,6 +47069,7 @@ var SideMenu = ({
|
|
|
46959
47069
|
!contentCollapsed2 && footerDetails && footerDetails.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime266.jsx)("div", { className: "shrink-0 px-3 pb-1", children: /* @__PURE__ */ (0, import_jsx_runtime266.jsx)(
|
|
46960
47070
|
SideMenuDetailPanel,
|
|
46961
47071
|
{
|
|
47072
|
+
variant: footerDetailsVariant,
|
|
46962
47073
|
items: footerDetails,
|
|
46963
47074
|
tone: footerDetailsTone ?? "none",
|
|
46964
47075
|
menuTone: color2,
|
|
@@ -52008,7 +52119,7 @@ var SplitView = ({
|
|
|
52008
52119
|
const border = headerProps.border ?? true;
|
|
52009
52120
|
const detailsVariant = headerDetails?.variant ?? headerDetails?.variants ?? "subtle";
|
|
52010
52121
|
const detailsDecoration = headerDetails?.decoration ?? headerDetails?.decorations ?? "none";
|
|
52011
|
-
const detailsTone = headerDetails?.tone ?? "
|
|
52122
|
+
const detailsTone = headerDetails?.tone ?? "none";
|
|
52012
52123
|
const hasCustomHeaderBody = headerDetails?.headerBody !== void 0 && headerDetails?.headerBody !== null;
|
|
52013
52124
|
const hasHeaderDetailsContent = Boolean(
|
|
52014
52125
|
hasCustomHeaderBody || headerDetails?.title || headerDetails?.subtitle || headerDetails?.description || headerDetails?.tags
|
|
@@ -52951,6 +53062,7 @@ var VariablePicker = ({
|
|
|
52951
53062
|
tone = "blue",
|
|
52952
53063
|
size = "md",
|
|
52953
53064
|
variant = "elevated",
|
|
53065
|
+
panelTone = "auto",
|
|
52954
53066
|
corner = "auto",
|
|
52955
53067
|
initialSearch = "",
|
|
52956
53068
|
title,
|
|
@@ -53026,7 +53138,7 @@ var VariablePicker = ({
|
|
|
53026
53138
|
Panel_default,
|
|
53027
53139
|
{
|
|
53028
53140
|
variant,
|
|
53029
|
-
tone: PANEL_TONE_FOR_FIELD,
|
|
53141
|
+
tone: panelTone === "auto" ? PANEL_TONE_FOR_FIELD : panelTone,
|
|
53030
53142
|
corner,
|
|
53031
53143
|
padding: "none",
|
|
53032
53144
|
scrollable: false,
|
|
@@ -53124,6 +53236,7 @@ var SmartInput = ({
|
|
|
53124
53236
|
gradientTo,
|
|
53125
53237
|
glowIntensity = DEFAULT_GLOW_INTENSITY,
|
|
53126
53238
|
panelVariant = "auto",
|
|
53239
|
+
panelTone = "auto",
|
|
53127
53240
|
panelCorner = "auto",
|
|
53128
53241
|
defaultViewMode = "token",
|
|
53129
53242
|
autocomplete = true,
|
|
@@ -53454,6 +53567,7 @@ var SmartInput = ({
|
|
|
53454
53567
|
tone,
|
|
53455
53568
|
size,
|
|
53456
53569
|
variant: resolvedPanelVariant,
|
|
53570
|
+
panelTone,
|
|
53457
53571
|
corner: panelCorner,
|
|
53458
53572
|
initialSearch: pickerFilter,
|
|
53459
53573
|
onSelect: handleSelect,
|
|
@@ -77413,6 +77527,7 @@ function MenuSurface({ state, children, root = false }) {
|
|
|
77413
77527
|
transparency: props.transparency,
|
|
77414
77528
|
vibrancy: props.vibrancy,
|
|
77415
77529
|
specularMode: props.specularMode,
|
|
77530
|
+
style: root ? props.style : void 0,
|
|
77416
77531
|
className: (0, import_classnames144.default)(
|
|
77417
77532
|
root ? props.className : void 0,
|
|
77418
77533
|
(!root || props.popup || props.trigger || props.anchorRef) && "backdrop-blur-xl"
|
|
@@ -77914,7 +78029,7 @@ function IdentityPicker({
|
|
|
77914
78029
|
});
|
|
77915
78030
|
const previewClass = (0, import_classnames146.default)("flex shrink-0 items-center justify-center overflow-hidden border border-neutral-200 dark:border-neutral-600", density.preview, getSurfaceCornerClass(surface.corner ?? "rounded-md"), tokens.bg);
|
|
77916
78031
|
const preview = selected?.type === "image" ? /* @__PURE__ */ (0, import_jsx_runtime349.jsx)(ImagePreview, { file: selected.file, src: selected.src, alt: labels.preview, className: "h-full w-full object-contain" }) : /* @__PURE__ */ (0, import_jsx_runtime349.jsx)("span", { style: { fontFamily }, "aria-hidden": "true", children: selected?.type === "emoji" ? selected.emoji : selected?.type === "monogram" ? selected.text : automatic });
|
|
77917
|
-
return /* @__PURE__ */ (0, import_jsx_runtime349.jsxs)(Panel_default, { ...surface, variant: surface.variant ?? "outlined", tone, padding: surface.padding ?? (compact2 ? "xs" : "sm"), className, "aria-busy": loading || void 0, children: [
|
|
78032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime349.jsxs)(Panel_default, { ...surface, variant: surface.variant ?? "outlined", tone: surface.tone ?? "none", padding: surface.padding ?? (compact2 ? "xs" : "sm"), className, "aria-busy": loading || void 0, children: [
|
|
77918
78033
|
/* @__PURE__ */ (0, import_jsx_runtime349.jsxs)("div", { className: (0, import_classnames146.default)("flex items-start", density.headerGap), children: [
|
|
77919
78034
|
/* @__PURE__ */ (0, import_jsx_runtime349.jsx)("div", { className: previewClass, role: selected?.type === "image" ? void 0 : "img", "aria-label": selected?.type === "image" ? void 0 : `${labels.preview}: ${selected?.type === "emoji" ? selected.emoji : selected?.type === "monogram" ? selected.text : automatic}`, children: preview }),
|
|
77920
78035
|
/* @__PURE__ */ (0, import_jsx_runtime349.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
@@ -77988,7 +78103,7 @@ function IdentityPicker({
|
|
|
77988
78103
|
embedded: true,
|
|
77989
78104
|
compact: compact2,
|
|
77990
78105
|
variant: surface.variant,
|
|
77991
|
-
tone,
|
|
78106
|
+
tone: surface.tone ?? "none",
|
|
77992
78107
|
corner: surface.corner,
|
|
77993
78108
|
padding: "none",
|
|
77994
78109
|
size,
|
|
@@ -79006,12 +79121,319 @@ function CodeBlock({
|
|
|
79006
79121
|
] }) });
|
|
79007
79122
|
}
|
|
79008
79123
|
|
|
79009
|
-
// src/
|
|
79124
|
+
// src/components/FilterBar.tsx
|
|
79010
79125
|
var import_react331 = require("react");
|
|
79011
|
-
var import_react_dom21 = require("react-dom");
|
|
79012
79126
|
var import_classnames149 = __toESM(require("classnames"), 1);
|
|
79013
79127
|
var import_jsx_runtime359 = require("react/jsx-runtime");
|
|
79014
|
-
|
|
79128
|
+
function normalize(filters, value) {
|
|
79129
|
+
return Object.assign(/* @__PURE__ */ Object.create(null), Object.fromEntries(filters.flatMap((filter) => {
|
|
79130
|
+
const selected = new Set(Object.prototype.hasOwnProperty.call(value, filter.id) ? value[filter.id] : []);
|
|
79131
|
+
const values = filter.options.filter((option) => selected.has(option.value)).map((option) => option.value);
|
|
79132
|
+
return values.length ? [[filter.id, values]] : [];
|
|
79133
|
+
})));
|
|
79134
|
+
}
|
|
79135
|
+
function FilterBar({
|
|
79136
|
+
searchProps,
|
|
79137
|
+
filters,
|
|
79138
|
+
value,
|
|
79139
|
+
defaultValue = {},
|
|
79140
|
+
onChange,
|
|
79141
|
+
filteredCount,
|
|
79142
|
+
totalCount,
|
|
79143
|
+
itemLabel,
|
|
79144
|
+
size = "md",
|
|
79145
|
+
color: color2 = "blue",
|
|
79146
|
+
showSearch = true,
|
|
79147
|
+
showFilterLabel = true,
|
|
79148
|
+
showEmptyState = true,
|
|
79149
|
+
showClearAll = true,
|
|
79150
|
+
showResultCount = true,
|
|
79151
|
+
showMenuCounts = true,
|
|
79152
|
+
variant = "outlined",
|
|
79153
|
+
tone = "neutral",
|
|
79154
|
+
corner = "rounded-sm",
|
|
79155
|
+
padding = "xs",
|
|
79156
|
+
transparency,
|
|
79157
|
+
glassOpacity = "frosted",
|
|
79158
|
+
vibrancy = "medium",
|
|
79159
|
+
buttonVariant = "outline",
|
|
79160
|
+
secondaryButtonVariant = "ghost",
|
|
79161
|
+
applyButtonVariant = "solid",
|
|
79162
|
+
buttonTone = color2,
|
|
79163
|
+
buttonSize = size,
|
|
79164
|
+
buttonCorner,
|
|
79165
|
+
buttonWeight = "normal",
|
|
79166
|
+
buttonDashed = true,
|
|
79167
|
+
menuVariant = "outlined",
|
|
79168
|
+
menuTone = "none",
|
|
79169
|
+
menuCorner,
|
|
79170
|
+
menuPadding: menuPadding2,
|
|
79171
|
+
chipVariant = "soft",
|
|
79172
|
+
chipTone = color2,
|
|
79173
|
+
spring = "snappy",
|
|
79174
|
+
disabled = false,
|
|
79175
|
+
className,
|
|
79176
|
+
"aria-label": ariaLabel
|
|
79177
|
+
}) {
|
|
79178
|
+
const t = useKitT();
|
|
79179
|
+
const buttonStyle = buttonCorner === void 0 ? void 0 : { borderRadius: getSurfaceCornerRem(buttonCorner) };
|
|
79180
|
+
const actionStyle = { color: buttonTone, size: buttonSize, weight: buttonWeight, style: buttonStyle };
|
|
79181
|
+
const surfaceClasses = getSurfaceVariantClasses(variant, tone, {
|
|
79182
|
+
transparency,
|
|
79183
|
+
liquidExtras: (0, import_classnames149.default)(getGlassVibrancyClass(vibrancy), getSurfaceGlassFillClass(tone, glassOpacity))
|
|
79184
|
+
});
|
|
79185
|
+
const [internal, setInternal] = (0, import_react331.useState)(defaultValue);
|
|
79186
|
+
const applied = normalize(filters, value ?? internal);
|
|
79187
|
+
const [open, setOpen] = (0, import_react331.useState)(false);
|
|
79188
|
+
const [category, setCategory] = (0, import_react331.useState)(null);
|
|
79189
|
+
const [draft, setDraft] = (0, import_react331.useState)([]);
|
|
79190
|
+
const anchor = (0, import_react331.useRef)(null);
|
|
79191
|
+
const searchRegion = (0, import_react331.useRef)(null);
|
|
79192
|
+
const searchId = (0, import_react331.useId)();
|
|
79193
|
+
const [expanded, setExpanded] = (0, import_react331.useState)(Boolean(searchProps.initialValue));
|
|
79194
|
+
const searchDisabled = disabled || searchProps.disabled;
|
|
79195
|
+
const active = filters.find((filter) => filter.id === category);
|
|
79196
|
+
const motion = CONTROL_SPRING_TOKENS[spring];
|
|
79197
|
+
const style = { "--fb-duration": `${motion.duration}ms`, "--fb-easing": motion.easing };
|
|
79198
|
+
const commit = (next) => {
|
|
79199
|
+
const normalized = normalize(filters, next);
|
|
79200
|
+
if (value === void 0) setInternal(normalized);
|
|
79201
|
+
onChange?.(normalized);
|
|
79202
|
+
};
|
|
79203
|
+
const close = (restore = false) => {
|
|
79204
|
+
setOpen(false);
|
|
79205
|
+
setCategory(null);
|
|
79206
|
+
setDraft([]);
|
|
79207
|
+
if (restore) anchor.current?.focus();
|
|
79208
|
+
};
|
|
79209
|
+
const edit = (filter) => {
|
|
79210
|
+
setDraft([...applied[filter.id] ?? []]);
|
|
79211
|
+
setCategory(filter.id);
|
|
79212
|
+
setOpen(true);
|
|
79213
|
+
};
|
|
79214
|
+
const previouslyExpanded = (0, import_react331.useRef)(expanded);
|
|
79215
|
+
(0, import_react331.useLayoutEffect)(() => {
|
|
79216
|
+
if (showSearch && expanded && !previouslyExpanded.current && !searchDisabled) searchRegion.current?.querySelector("input")?.focus();
|
|
79217
|
+
previouslyExpanded.current = expanded;
|
|
79218
|
+
}, [expanded, searchDisabled, showSearch]);
|
|
79219
|
+
(0, import_react331.useEffect)(() => {
|
|
79220
|
+
if (disabled || category !== null && (!active || active.disabled)) {
|
|
79221
|
+
setOpen(false);
|
|
79222
|
+
setCategory(null);
|
|
79223
|
+
setDraft([]);
|
|
79224
|
+
}
|
|
79225
|
+
}, [disabled, category, active]);
|
|
79226
|
+
const items = active ? active.options.map((option) => ({
|
|
79227
|
+
id: option.value,
|
|
79228
|
+
label: option.label,
|
|
79229
|
+
type: "checkbox",
|
|
79230
|
+
checked: draft.includes(option.value),
|
|
79231
|
+
disabled: option.disabled,
|
|
79232
|
+
badge: showMenuCounts ? option.count : void 0,
|
|
79233
|
+
onCheckedChange: (checked) => setDraft((current) => checked ? [.../* @__PURE__ */ new Set([...current, option.value])] : current.filter((entry) => entry !== option.value))
|
|
79234
|
+
})) : filters.map((filter) => ({
|
|
79235
|
+
id: filter.id,
|
|
79236
|
+
label: filter.label,
|
|
79237
|
+
badge: showMenuCounts ? filter.count ?? filter.options.length : void 0,
|
|
79238
|
+
disabled: filter.disabled,
|
|
79239
|
+
trailing: /* @__PURE__ */ (0, import_jsx_runtime359.jsx)(CustomIcon_default, { icon: "ChevronRight", size: "sm" }),
|
|
79240
|
+
closeOnSelect: false,
|
|
79241
|
+
command: () => edit(filter)
|
|
79242
|
+
}));
|
|
79243
|
+
const chips = filters.filter((filter) => applied[filter.id]?.length).map((filter) => ({
|
|
79244
|
+
id: filter.id,
|
|
79245
|
+
label: `${filter.label}: ${filter.options.filter((option) => applied[filter.id].includes(option.value)).map((option) => option.label).join(", ")}`,
|
|
79246
|
+
disabled: disabled || filter.disabled,
|
|
79247
|
+
edit: () => edit(filter),
|
|
79248
|
+
remove: () => {
|
|
79249
|
+
const next = { ...applied };
|
|
79250
|
+
delete next[filter.id];
|
|
79251
|
+
commit(next);
|
|
79252
|
+
anchor.current?.focus();
|
|
79253
|
+
}
|
|
79254
|
+
}));
|
|
79255
|
+
return /* @__PURE__ */ (0, import_jsx_runtime359.jsxs)(
|
|
79256
|
+
"div",
|
|
79257
|
+
{
|
|
79258
|
+
role: "group",
|
|
79259
|
+
"aria-label": ariaLabel ?? t("kit.filterbar.filters"),
|
|
79260
|
+
className: (0, import_classnames149.default)("kit-filter-bar flex min-w-0 flex-wrap items-center gap-2 text-sm", surfaceClasses, getSurfaceCornerClass(corner), getSurfacePaddingClass(padding), className),
|
|
79261
|
+
style,
|
|
79262
|
+
onBlurCapture: (event) => {
|
|
79263
|
+
const menu = event.target.closest("[data-menu-owner]");
|
|
79264
|
+
const next = event.relatedTarget;
|
|
79265
|
+
if (open && menu && !menu.contains(next) && !event.currentTarget.contains(next)) close();
|
|
79266
|
+
},
|
|
79267
|
+
onKeyDownCapture: (event) => {
|
|
79268
|
+
if (open && active && event.key === "Tab") event.stopPropagation();
|
|
79269
|
+
if (open && category && event.key === "ArrowLeft") {
|
|
79270
|
+
event.preventDefault();
|
|
79271
|
+
event.stopPropagation();
|
|
79272
|
+
setCategory(null);
|
|
79273
|
+
setDraft([]);
|
|
79274
|
+
}
|
|
79275
|
+
if (open && event.key === "Escape") {
|
|
79276
|
+
event.preventDefault();
|
|
79277
|
+
event.stopPropagation();
|
|
79278
|
+
close(true);
|
|
79279
|
+
}
|
|
79280
|
+
},
|
|
79281
|
+
children: [
|
|
79282
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsxs)(
|
|
79283
|
+
"div",
|
|
79284
|
+
{
|
|
79285
|
+
ref: searchRegion,
|
|
79286
|
+
className: "fb-search",
|
|
79287
|
+
"data-expanded": expanded,
|
|
79288
|
+
hidden: !showSearch,
|
|
79289
|
+
inert: !showSearch,
|
|
79290
|
+
onBlur: (event) => {
|
|
79291
|
+
if (!event.currentTarget.contains(event.relatedTarget) && !event.currentTarget.querySelector("input")?.value) setExpanded(false);
|
|
79292
|
+
},
|
|
79293
|
+
children: [
|
|
79294
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)(
|
|
79295
|
+
Button_default,
|
|
79296
|
+
{
|
|
79297
|
+
...actionStyle,
|
|
79298
|
+
variant: "icon",
|
|
79299
|
+
leadingIcon: "Search",
|
|
79300
|
+
"aria-label": t("kit.filterbar.search"),
|
|
79301
|
+
"aria-expanded": expanded,
|
|
79302
|
+
"aria-controls": searchId,
|
|
79303
|
+
disabled: searchDisabled,
|
|
79304
|
+
className: "fb-search-trigger",
|
|
79305
|
+
hidden: expanded,
|
|
79306
|
+
onClick: () => setExpanded(true)
|
|
79307
|
+
}
|
|
79308
|
+
),
|
|
79309
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)("div", { id: searchId, className: "fb-search-input", inert: !expanded, "aria-hidden": !expanded, children: /* @__PURE__ */ (0, import_jsx_runtime359.jsx)(SearchBar_default, { size, color: color2, ...searchProps, disabled: searchDisabled }) })
|
|
79310
|
+
]
|
|
79311
|
+
}
|
|
79312
|
+
),
|
|
79313
|
+
showSearch && (showFilterLabel || chips.length > 0 || showEmptyState) && /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("span", { "aria-hidden": "true", className: "h-5 border-l border-neutral-200 dark:border-neutral-700" }),
|
|
79314
|
+
showFilterLabel && /* @__PURE__ */ (0, import_jsx_runtime359.jsxs)("span", { className: "flex items-center gap-1.5 text-neutral-600 dark:text-neutral-300", children: [
|
|
79315
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)("svg", { "aria-hidden": "true", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.7", children: /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("path", { d: "M3 4h18l-7 8v8l-4-2v-6Z" }) }),
|
|
79316
|
+
t("kit.filterbar.filters")
|
|
79317
|
+
] }),
|
|
79318
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)(FilterChips, { chips, color: chipTone, variant: chipVariant, size, buttonTone, buttonStyle, removeLabel: (label) => t("kit.filterbar.remove", { label }) }),
|
|
79319
|
+
showEmptyState && !chips.length && /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("span", { className: "text-neutral-400", children: t("kit.filterbar.empty") }),
|
|
79320
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsxs)("div", { className: "flex flex-1 flex-wrap items-center justify-end gap-2", children: [
|
|
79321
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)(
|
|
79322
|
+
Button_default,
|
|
79323
|
+
{
|
|
79324
|
+
...actionStyle,
|
|
79325
|
+
ref: anchor,
|
|
79326
|
+
variant: buttonVariant,
|
|
79327
|
+
leadingIcon: "Add",
|
|
79328
|
+
disabled: disabled || !filters.length,
|
|
79329
|
+
className: (0, import_classnames149.default)(buttonCorner === void 0 && "rounded-full", buttonDashed && buttonVariant === "outline" && "border-dashed"),
|
|
79330
|
+
"aria-haspopup": "menu",
|
|
79331
|
+
"aria-expanded": open,
|
|
79332
|
+
onClick: () => {
|
|
79333
|
+
if (open) close();
|
|
79334
|
+
else {
|
|
79335
|
+
setCategory(null);
|
|
79336
|
+
setOpen(true);
|
|
79337
|
+
}
|
|
79338
|
+
},
|
|
79339
|
+
onKeyDown: (event) => {
|
|
79340
|
+
if (event.key === "ArrowDown") {
|
|
79341
|
+
event.preventDefault();
|
|
79342
|
+
setCategory(null);
|
|
79343
|
+
setOpen(true);
|
|
79344
|
+
}
|
|
79345
|
+
},
|
|
79346
|
+
children: t("kit.filterbar.add")
|
|
79347
|
+
}
|
|
79348
|
+
),
|
|
79349
|
+
showClearAll && chips.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime359.jsx)(Button_default, { ...actionStyle, variant: secondaryButtonVariant, disabled, onClick: () => {
|
|
79350
|
+
commit({});
|
|
79351
|
+
anchor.current?.focus();
|
|
79352
|
+
}, children: t("kit.filterbar.clearAll") }),
|
|
79353
|
+
showResultCount && /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("span", { className: "border-l border-neutral-200 pl-2 text-neutral-400 dark:border-neutral-700", role: "status", children: t("kit.filterbar.summary", { filtered: filteredCount, total: totalCount, items: itemLabel ?? t("kit.filterbar.items") }) })
|
|
79354
|
+
] }),
|
|
79355
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)(
|
|
79356
|
+
Menu,
|
|
79357
|
+
{
|
|
79358
|
+
popup: true,
|
|
79359
|
+
anchorRef: anchor,
|
|
79360
|
+
open: open && !disabled,
|
|
79361
|
+
onOpenChange: (next) => {
|
|
79362
|
+
if (!next) close();
|
|
79363
|
+
},
|
|
79364
|
+
items,
|
|
79365
|
+
width: 320,
|
|
79366
|
+
size,
|
|
79367
|
+
variant: menuVariant,
|
|
79368
|
+
tone: menuTone,
|
|
79369
|
+
corner: menuCorner,
|
|
79370
|
+
padding: menuPadding2,
|
|
79371
|
+
className: "fb-menu",
|
|
79372
|
+
style,
|
|
79373
|
+
"aria-label": active?.label ?? t("kit.filterbar.filterBy"),
|
|
79374
|
+
renderItem: active ? (item) => /* @__PURE__ */ (0, import_jsx_runtime359.jsxs)(import_jsx_runtime359.Fragment, { children: [
|
|
79375
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)("span", { "aria-hidden": "true", className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded border border-neutral-300 dark:border-neutral-600", children: item.checked && /* @__PURE__ */ (0, import_jsx_runtime359.jsx)(CustomIcon_default, { icon: "Check", size: "xs" }) }),
|
|
79376
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)("span", { className: "min-w-0 flex-1 truncate", children: item.label }),
|
|
79377
|
+
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("span", { className: "shrink-0 text-xs text-neutral-400", children: item.badge })
|
|
79378
|
+
] }) : void 0,
|
|
79379
|
+
header: active ? /* @__PURE__ */ (0, import_jsx_runtime359.jsx)(Button_default, { ...actionStyle, variant: secondaryButtonVariant, leadingIcon: "ChevronLeft", onClick: () => {
|
|
79380
|
+
setCategory(null);
|
|
79381
|
+
setDraft([]);
|
|
79382
|
+
}, "aria-label": t("kit.filterbar.back"), children: /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("span", { className: "uppercase tracking-wide", children: active.label }) }) : /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("span", { className: "px-3 text-xs uppercase tracking-wide text-neutral-400", children: t("kit.filterbar.filterBy") }),
|
|
79383
|
+
footer: active ? /* @__PURE__ */ (0, import_jsx_runtime359.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
79384
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)(Button_default, { ...actionStyle, variant: secondaryButtonVariant, onClick: () => setDraft((current) => current.filter((entry) => active.options.some((option) => option.value === entry && option.disabled))), children: t("kit.filterbar.clear") }),
|
|
79385
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)(Button_default, { ...actionStyle, variant: applyButtonVariant, onClick: () => {
|
|
79386
|
+
commit({ ...applied, [active.id]: draft });
|
|
79387
|
+
close(true);
|
|
79388
|
+
}, children: t("kit.filterbar.done") })
|
|
79389
|
+
] }) : void 0
|
|
79390
|
+
},
|
|
79391
|
+
category ?? "categories"
|
|
79392
|
+
)
|
|
79393
|
+
]
|
|
79394
|
+
}
|
|
79395
|
+
);
|
|
79396
|
+
}
|
|
79397
|
+
function FilterChips({ chips, color: color2, variant, size, buttonTone, buttonStyle, removeLabel }) {
|
|
79398
|
+
const [visible, setVisible] = (0, import_react331.useState)(chips);
|
|
79399
|
+
const region = (0, import_react331.useRef)(null);
|
|
79400
|
+
const positions = (0, import_react331.useRef)(/* @__PURE__ */ new Map());
|
|
79401
|
+
const signature = chips.map((chip) => chip.id).join("\0");
|
|
79402
|
+
(0, import_react331.useEffect)(() => {
|
|
79403
|
+
const timer = setTimeout(() => setVisible((current) => current.filter((chip) => signature.split("\0").includes(chip.id))), 900);
|
|
79404
|
+
return () => clearTimeout(timer);
|
|
79405
|
+
}, [signature]);
|
|
79406
|
+
(0, import_react331.useLayoutEffect)(() => {
|
|
79407
|
+
setVisible((current) => [...chips, ...current.filter((chip) => !chips.some((next) => next.id === chip.id))]);
|
|
79408
|
+
}, [signature]);
|
|
79409
|
+
(0, import_react331.useLayoutEffect)(() => {
|
|
79410
|
+
if (typeof matchMedia === "undefined" || matchMedia("(prefers-reduced-motion: reduce)").matches) return;
|
|
79411
|
+
const next = /* @__PURE__ */ new Map();
|
|
79412
|
+
region.current?.querySelectorAll("[data-chip]").forEach((element) => {
|
|
79413
|
+
const key = element.dataset.chip;
|
|
79414
|
+
const left = element.getBoundingClientRect().left;
|
|
79415
|
+
const previous = positions.current.get(key);
|
|
79416
|
+
if (previous !== void 0 && previous !== left) element.animate?.([{ transform: `translateX(${previous - left}px)` }, { transform: "translateX(0)" }], { duration: 320, easing: "ease-out" });
|
|
79417
|
+
next.set(key, left);
|
|
79418
|
+
});
|
|
79419
|
+
positions.current = next;
|
|
79420
|
+
});
|
|
79421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("div", { ref: region, className: "contents", children: visible.map((old) => {
|
|
79422
|
+
const chip = chips.find((current) => current.id === old.id);
|
|
79423
|
+
const entry = chip ?? old;
|
|
79424
|
+
return /* @__PURE__ */ (0, import_jsx_runtime359.jsx)("span", { "data-chip": entry.id, className: "fb-chip", "data-exiting": !chip, inert: !chip, "aria-hidden": !chip, children: /* @__PURE__ */ (0, import_jsx_runtime359.jsx)(Badge_default, { tone: color2, variant, size, ring: false, className: "max-w-full py-1", children: /* @__PURE__ */ (0, import_jsx_runtime359.jsxs)("span", { className: "flex min-w-0 items-center gap-1", children: [
|
|
79425
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)("button", { type: "button", disabled: entry.disabled, className: "min-w-0 truncate rounded-full px-1 py-1 focus-visible:outline focus-visible:outline-2 disabled:opacity-50", onClick: entry.edit, children: entry.label }),
|
|
79426
|
+
/* @__PURE__ */ (0, import_jsx_runtime359.jsx)(Button_default, { variant: "icon", size: "xs", color: buttonTone, style: buttonStyle, leadingIcon: "Close", disabled: entry.disabled, "aria-label": removeLabel(entry.label), onClick: entry.remove })
|
|
79427
|
+
] }) }) }, entry.id);
|
|
79428
|
+
}) });
|
|
79429
|
+
}
|
|
79430
|
+
|
|
79431
|
+
// src/contexts/BottomSheetContext.tsx
|
|
79432
|
+
var import_react332 = require("react");
|
|
79433
|
+
var import_react_dom21 = require("react-dom");
|
|
79434
|
+
var import_classnames150 = __toESM(require("classnames"), 1);
|
|
79435
|
+
var import_jsx_runtime360 = require("react/jsx-runtime");
|
|
79436
|
+
var BottomSheetContext = (0, import_react332.createContext)(null);
|
|
79015
79437
|
var TRANSITION_MS2 = 260;
|
|
79016
79438
|
var renderSlot = (slot, controls) => {
|
|
79017
79439
|
if (!slot) {
|
|
@@ -79022,13 +79444,13 @@ var renderSlot = (slot, controls) => {
|
|
|
79022
79444
|
var BottomSheetProvider = ({
|
|
79023
79445
|
children
|
|
79024
79446
|
}) => {
|
|
79025
|
-
const [sheet, setSheet] = (0,
|
|
79026
|
-
const [isVisible, setIsVisible] = (0,
|
|
79027
|
-
const pendingCloseRef = (0,
|
|
79028
|
-
const dismissSheet = (0,
|
|
79447
|
+
const [sheet, setSheet] = (0, import_react332.useState)(null);
|
|
79448
|
+
const [isVisible, setIsVisible] = (0, import_react332.useState)(false);
|
|
79449
|
+
const pendingCloseRef = (0, import_react332.useRef)(null);
|
|
79450
|
+
const dismissSheet = (0, import_react332.useCallback)(() => {
|
|
79029
79451
|
setIsVisible(false);
|
|
79030
79452
|
}, []);
|
|
79031
|
-
const presentSheet = (0,
|
|
79453
|
+
const presentSheet = (0, import_react332.useCallback)((options) => {
|
|
79032
79454
|
if (pendingCloseRef.current) {
|
|
79033
79455
|
clearTimeout(pendingCloseRef.current);
|
|
79034
79456
|
pendingCloseRef.current = null;
|
|
@@ -79041,7 +79463,7 @@ var BottomSheetProvider = ({
|
|
|
79041
79463
|
setTimeout(animateIn, 0);
|
|
79042
79464
|
}
|
|
79043
79465
|
}, []);
|
|
79044
|
-
(0,
|
|
79466
|
+
(0, import_react332.useEffect)(() => {
|
|
79045
79467
|
if (!isVisible && sheet) {
|
|
79046
79468
|
pendingCloseRef.current = setTimeout(() => {
|
|
79047
79469
|
sheet.onClose?.();
|
|
@@ -79056,7 +79478,7 @@ var BottomSheetProvider = ({
|
|
|
79056
79478
|
}
|
|
79057
79479
|
return void 0;
|
|
79058
79480
|
}, [isVisible, sheet]);
|
|
79059
|
-
(0,
|
|
79481
|
+
(0, import_react332.useEffect)(
|
|
79060
79482
|
() => () => {
|
|
79061
79483
|
if (pendingCloseRef.current) {
|
|
79062
79484
|
clearTimeout(pendingCloseRef.current);
|
|
@@ -79064,13 +79486,13 @@ var BottomSheetProvider = ({
|
|
|
79064
79486
|
},
|
|
79065
79487
|
[]
|
|
79066
79488
|
);
|
|
79067
|
-
const controls = (0,
|
|
79489
|
+
const controls = (0, import_react332.useMemo)(
|
|
79068
79490
|
() => ({
|
|
79069
79491
|
dismiss: dismissSheet
|
|
79070
79492
|
}),
|
|
79071
79493
|
[dismissSheet]
|
|
79072
79494
|
);
|
|
79073
|
-
const contextValue = (0,
|
|
79495
|
+
const contextValue = (0, import_react332.useMemo)(
|
|
79074
79496
|
() => ({
|
|
79075
79497
|
presentSheet,
|
|
79076
79498
|
dismissSheet,
|
|
@@ -79080,11 +79502,11 @@ var BottomSheetProvider = ({
|
|
|
79080
79502
|
[presentSheet, dismissSheet, sheet, isVisible]
|
|
79081
79503
|
);
|
|
79082
79504
|
const overlayNode = typeof document !== "undefined" && sheet ? (0, import_react_dom21.createPortal)(
|
|
79083
|
-
/* @__PURE__ */ (0,
|
|
79084
|
-
/* @__PURE__ */ (0,
|
|
79505
|
+
/* @__PURE__ */ (0, import_jsx_runtime360.jsxs)("div", { className: "pointer-events-none fixed inset-0 z-[70] flex items-end justify-center", children: [
|
|
79506
|
+
/* @__PURE__ */ (0, import_jsx_runtime360.jsx)(
|
|
79085
79507
|
"div",
|
|
79086
79508
|
{
|
|
79087
|
-
className: (0,
|
|
79509
|
+
className: (0, import_classnames150.default)(
|
|
79088
79510
|
"absolute inset-0 bg-neutral-900/40 transition-opacity duration-300",
|
|
79089
79511
|
isVisible ? "opacity-100 pointer-events-auto" : "opacity-0"
|
|
79090
79512
|
),
|
|
@@ -79094,24 +79516,24 @@ var BottomSheetProvider = ({
|
|
|
79094
79516
|
}
|
|
79095
79517
|
}
|
|
79096
79518
|
),
|
|
79097
|
-
/* @__PURE__ */ (0,
|
|
79519
|
+
/* @__PURE__ */ (0, import_jsx_runtime360.jsx)("div", { className: "relative w-full max-w-4xl px-4 pb-4 sm:px-8", children: /* @__PURE__ */ (0, import_jsx_runtime360.jsxs)(
|
|
79098
79520
|
"section",
|
|
79099
79521
|
{
|
|
79100
79522
|
role: "dialog",
|
|
79101
79523
|
"aria-modal": "true",
|
|
79102
|
-
className: (0,
|
|
79524
|
+
className: (0, import_classnames150.default)(
|
|
79103
79525
|
"pointer-events-auto ml-auto flex w-full flex-col rounded-t-3xl border border-slate-200 bg-white shadow-2xl transition-transform duration-300 dark:border-slate-700 dark:bg-slate-900",
|
|
79104
79526
|
sheet.className,
|
|
79105
79527
|
isVisible ? "translate-y-0" : "translate-y-full"
|
|
79106
79528
|
),
|
|
79107
79529
|
style: { minHeight: "25vh", maxHeight: "85vh" },
|
|
79108
79530
|
children: [
|
|
79109
|
-
/* @__PURE__ */ (0,
|
|
79110
|
-
/* @__PURE__ */ (0,
|
|
79111
|
-
sheet.title && /* @__PURE__ */ (0,
|
|
79112
|
-
sheet.description && /* @__PURE__ */ (0,
|
|
79531
|
+
/* @__PURE__ */ (0, import_jsx_runtime360.jsxs)("header", { className: "flex items-start justify-between gap-3 border-b border-slate-200 px-6 py-4 dark:border-slate-800", children: [
|
|
79532
|
+
/* @__PURE__ */ (0, import_jsx_runtime360.jsxs)("div", { className: "space-y-1", children: [
|
|
79533
|
+
sheet.title && /* @__PURE__ */ (0, import_jsx_runtime360.jsx)("div", { className: "text-base font-semibold text-slate-900 dark:text-slate-100", children: sheet.title }),
|
|
79534
|
+
sheet.description && /* @__PURE__ */ (0, import_jsx_runtime360.jsx)("p", { className: "text-sm text-slate-500 dark:text-slate-300", children: sheet.description })
|
|
79113
79535
|
] }),
|
|
79114
|
-
(sheet.showCloseButton ?? true) && /* @__PURE__ */ (0,
|
|
79536
|
+
(sheet.showCloseButton ?? true) && /* @__PURE__ */ (0, import_jsx_runtime360.jsx)(
|
|
79115
79537
|
IconButton_default,
|
|
79116
79538
|
{
|
|
79117
79539
|
icon: "Close",
|
|
@@ -79123,21 +79545,21 @@ var BottomSheetProvider = ({
|
|
|
79123
79545
|
}
|
|
79124
79546
|
)
|
|
79125
79547
|
] }),
|
|
79126
|
-
/* @__PURE__ */ (0,
|
|
79127
|
-
sheet.actions && /* @__PURE__ */ (0,
|
|
79548
|
+
/* @__PURE__ */ (0, import_jsx_runtime360.jsx)("div", { className: "flex-1 overflow-y-auto px-6 py-4", children: renderSlot(sheet.content, controls) ?? /* @__PURE__ */ (0, import_jsx_runtime360.jsx)("p", { className: "text-sm text-slate-500", children: "No content provided." }) }),
|
|
79549
|
+
sheet.actions && /* @__PURE__ */ (0, import_jsx_runtime360.jsx)("div", { className: "flex flex-wrap items-center justify-end gap-3 border-t border-slate-200 px-6 py-4 dark:border-slate-800", children: renderSlot(sheet.actions, controls) })
|
|
79128
79550
|
]
|
|
79129
79551
|
}
|
|
79130
79552
|
) })
|
|
79131
79553
|
] }),
|
|
79132
79554
|
document.body
|
|
79133
79555
|
) : null;
|
|
79134
|
-
return /* @__PURE__ */ (0,
|
|
79556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime360.jsxs)(BottomSheetContext.Provider, { value: contextValue, children: [
|
|
79135
79557
|
children,
|
|
79136
79558
|
overlayNode
|
|
79137
79559
|
] });
|
|
79138
79560
|
};
|
|
79139
79561
|
var useBottomSheet = () => {
|
|
79140
|
-
const context = (0,
|
|
79562
|
+
const context = (0, import_react332.useContext)(BottomSheetContext);
|
|
79141
79563
|
if (!context) {
|
|
79142
79564
|
throw new Error("useBottomSheet must be used within a BottomSheetProvider");
|
|
79143
79565
|
}
|
|
@@ -79771,8 +80193,8 @@ var SYSTEM_VARIABLES = [
|
|
|
79771
80193
|
];
|
|
79772
80194
|
|
|
79773
80195
|
// src/components/MetricBar.tsx
|
|
79774
|
-
var
|
|
79775
|
-
var
|
|
80196
|
+
var import_classnames151 = __toESM(require("classnames"), 1);
|
|
80197
|
+
var import_jsx_runtime361 = require("react/jsx-runtime");
|
|
79776
80198
|
var MetricBar = ({
|
|
79777
80199
|
label,
|
|
79778
80200
|
value,
|
|
@@ -79782,7 +80204,7 @@ var MetricBar = ({
|
|
|
79782
80204
|
size = "sm",
|
|
79783
80205
|
className,
|
|
79784
80206
|
...rest
|
|
79785
|
-
}) => /* @__PURE__ */ (0,
|
|
80207
|
+
}) => /* @__PURE__ */ (0, import_jsx_runtime361.jsx)(
|
|
79786
80208
|
Progress_default,
|
|
79787
80209
|
{
|
|
79788
80210
|
...rest,
|
|
@@ -79792,13 +80214,13 @@ var MetricBar = ({
|
|
|
79792
80214
|
formatValue: value !== void 0 ? () => String(value) : void 0,
|
|
79793
80215
|
size,
|
|
79794
80216
|
color: tone ?? color2 ?? "blue",
|
|
79795
|
-
className: (0,
|
|
80217
|
+
className: (0, import_classnames151.default)("w-full", className)
|
|
79796
80218
|
}
|
|
79797
80219
|
);
|
|
79798
80220
|
MetricBar.displayName = "MetricBar";
|
|
79799
80221
|
|
|
79800
80222
|
// src/components/NetworkGraph/NetworkGraph.tsx
|
|
79801
|
-
var
|
|
80223
|
+
var import_react334 = require("react");
|
|
79802
80224
|
|
|
79803
80225
|
// src/components/NetworkGraph/model.ts
|
|
79804
80226
|
var CELL = 64;
|
|
@@ -79942,17 +80364,17 @@ function findNetworkPath(edges, source, target) {
|
|
|
79942
80364
|
}
|
|
79943
80365
|
|
|
79944
80366
|
// src/components/NetworkGraph/useNetworkCanvas.ts
|
|
79945
|
-
var
|
|
80367
|
+
var import_react333 = require("react");
|
|
79946
80368
|
function useNetworkCanvas(options) {
|
|
79947
|
-
const canvasRef = (0,
|
|
79948
|
-
const view = (0,
|
|
79949
|
-
const size = (0,
|
|
79950
|
-
const latest = (0,
|
|
79951
|
-
const frame = (0,
|
|
79952
|
-
const [zoom, setZoom] = (0,
|
|
79953
|
-
const colors3 = (0,
|
|
79954
|
-
const textColor = (0,
|
|
79955
|
-
const draw = (0,
|
|
80369
|
+
const canvasRef = (0, import_react333.useRef)(null);
|
|
80370
|
+
const view = (0, import_react333.useRef)({ x: 0, y: 0, zoom: 1 });
|
|
80371
|
+
const size = (0, import_react333.useRef)({ width: 1, height: 1 });
|
|
80372
|
+
const latest = (0, import_react333.useRef)(options);
|
|
80373
|
+
const frame = (0, import_react333.useRef)(null);
|
|
80374
|
+
const [zoom, setZoom] = (0, import_react333.useState)(1);
|
|
80375
|
+
const colors3 = (0, import_react333.useRef)(/* @__PURE__ */ new Map());
|
|
80376
|
+
const textColor = (0, import_react333.useRef)("#737373");
|
|
80377
|
+
const draw = (0, import_react333.useCallback)(() => {
|
|
79956
80378
|
const canvas = canvasRef.current;
|
|
79957
80379
|
const ctx = canvas?.getContext("2d");
|
|
79958
80380
|
if (!canvas || !ctx) return;
|
|
@@ -80052,14 +80474,14 @@ function useNetworkCanvas(options) {
|
|
|
80052
80474
|
}
|
|
80053
80475
|
ctx.globalAlpha = 1;
|
|
80054
80476
|
}, []);
|
|
80055
|
-
const requestDraw = (0,
|
|
80477
|
+
const requestDraw = (0, import_react333.useCallback)(() => {
|
|
80056
80478
|
if (frame.current !== null) return;
|
|
80057
80479
|
frame.current = requestAnimationFrame(() => {
|
|
80058
80480
|
frame.current = null;
|
|
80059
80481
|
draw();
|
|
80060
80482
|
});
|
|
80061
80483
|
}, [draw]);
|
|
80062
|
-
const update = (0,
|
|
80484
|
+
const update = (0, import_react333.useCallback)(
|
|
80063
80485
|
(next) => {
|
|
80064
80486
|
view.current = next;
|
|
80065
80487
|
setZoom(next.zoom);
|
|
@@ -80068,7 +80490,7 @@ function useNetworkCanvas(options) {
|
|
|
80068
80490
|
},
|
|
80069
80491
|
[requestDraw]
|
|
80070
80492
|
);
|
|
80071
|
-
const fit = (0,
|
|
80493
|
+
const fit = (0, import_react333.useCallback)(
|
|
80072
80494
|
() => update(
|
|
80073
80495
|
fitNetwork(
|
|
80074
80496
|
latest.current.nodes,
|
|
@@ -80078,11 +80500,11 @@ function useNetworkCanvas(options) {
|
|
|
80078
80500
|
),
|
|
80079
80501
|
[update]
|
|
80080
80502
|
);
|
|
80081
|
-
const zoomBy = (0,
|
|
80503
|
+
const zoomBy = (0, import_react333.useCallback)(
|
|
80082
80504
|
(factor, x = size.current.width / 2, y = size.current.height / 2) => update(zoomAt(view.current, factor, x, y)),
|
|
80083
80505
|
[update]
|
|
80084
80506
|
);
|
|
80085
|
-
const focusNode = (0,
|
|
80507
|
+
const focusNode = (0, import_react333.useCallback)(
|
|
80086
80508
|
(node) => {
|
|
80087
80509
|
update({
|
|
80088
80510
|
...view.current,
|
|
@@ -80092,14 +80514,14 @@ function useNetworkCanvas(options) {
|
|
|
80092
80514
|
},
|
|
80093
80515
|
[update]
|
|
80094
80516
|
);
|
|
80095
|
-
(0,
|
|
80517
|
+
(0, import_react333.useEffect)(() => {
|
|
80096
80518
|
latest.current = options;
|
|
80097
80519
|
requestDraw();
|
|
80098
80520
|
}, [options, requestDraw]);
|
|
80099
|
-
(0,
|
|
80521
|
+
(0, import_react333.useEffect)(() => {
|
|
80100
80522
|
fit();
|
|
80101
80523
|
}, [options.model, fit]);
|
|
80102
|
-
(0,
|
|
80524
|
+
(0, import_react333.useEffect)(() => {
|
|
80103
80525
|
const canvas = canvasRef.current;
|
|
80104
80526
|
if (!canvas) return;
|
|
80105
80527
|
const measure = () => {
|
|
@@ -80152,7 +80574,7 @@ function useNetworkCanvas(options) {
|
|
|
80152
80574
|
}
|
|
80153
80575
|
|
|
80154
80576
|
// src/components/NetworkGraph/NetworkGraph.tsx
|
|
80155
|
-
var
|
|
80577
|
+
var import_jsx_runtime362 = require("react/jsx-runtime");
|
|
80156
80578
|
var NO_COMMUNITIES = [];
|
|
80157
80579
|
var NO_HIGHLIGHTS = [];
|
|
80158
80580
|
function NetworkGraph({
|
|
@@ -80184,11 +80606,11 @@ function NetworkGraph({
|
|
|
80184
80606
|
}) {
|
|
80185
80607
|
const tone = getSurfaceAccentColor(surfaceTone);
|
|
80186
80608
|
const t = useKitT();
|
|
80187
|
-
const helpId = (0,
|
|
80188
|
-
const layoutRef = (0,
|
|
80189
|
-
const [hasLegendSpace, setHasLegendSpace] = (0,
|
|
80609
|
+
const helpId = (0, import_react334.useId)();
|
|
80610
|
+
const layoutRef = (0, import_react334.useRef)(null);
|
|
80611
|
+
const [hasLegendSpace, setHasLegendSpace] = (0, import_react334.useState)(true);
|
|
80190
80612
|
const legendOnRight = legendPosition === "right" || legendPosition === "auto" && hasLegendSpace;
|
|
80191
|
-
(0,
|
|
80613
|
+
(0, import_react334.useEffect)(() => {
|
|
80192
80614
|
const element = layoutRef.current;
|
|
80193
80615
|
if (!element || legendPosition !== "auto") return;
|
|
80194
80616
|
const measure = () => setHasLegendSpace(element.getBoundingClientRect().width >= 600);
|
|
@@ -80197,38 +80619,38 @@ function NetworkGraph({
|
|
|
80197
80619
|
observer.observe(element);
|
|
80198
80620
|
return () => observer.disconnect();
|
|
80199
80621
|
}, [legendPosition, loading]);
|
|
80200
|
-
const model = (0,
|
|
80622
|
+
const model = (0, import_react334.useMemo)(
|
|
80201
80623
|
() => buildNetwork(nodes, edges, communities),
|
|
80202
80624
|
[nodes, edges, communities]
|
|
80203
80625
|
);
|
|
80204
|
-
const [internalSelected, setInternalSelected] = (0,
|
|
80626
|
+
const [internalSelected, setInternalSelected] = (0, import_react334.useState)(
|
|
80205
80627
|
defaultSelectedNodeId
|
|
80206
80628
|
);
|
|
80207
|
-
const [hidden, setHidden] = (0,
|
|
80208
|
-
const [focused, setFocused] = (0,
|
|
80209
|
-
const [query, setQuery] = (0,
|
|
80210
|
-
const enabled = (0,
|
|
80629
|
+
const [hidden, setHidden] = (0, import_react334.useState)(() => /* @__PURE__ */ new Set());
|
|
80630
|
+
const [focused, setFocused] = (0, import_react334.useState)(null);
|
|
80631
|
+
const [query, setQuery] = (0, import_react334.useState)("");
|
|
80632
|
+
const enabled = (0, import_react334.useMemo)(
|
|
80211
80633
|
() => new Set(
|
|
80212
80634
|
visibleCommunityIds ?? model.groups.filter((g) => !hidden.has(g.id)).map((g) => g.id)
|
|
80213
80635
|
),
|
|
80214
80636
|
[visibleCommunityIds, model, hidden]
|
|
80215
80637
|
);
|
|
80216
|
-
const visibleNodes = (0,
|
|
80638
|
+
const visibleNodes = (0, import_react334.useMemo)(
|
|
80217
80639
|
() => model.nodes.filter((n) => !n.community || enabled.has(n.community)),
|
|
80218
80640
|
[model, enabled]
|
|
80219
80641
|
);
|
|
80220
|
-
const visible = (0,
|
|
80642
|
+
const visible = (0, import_react334.useMemo)(
|
|
80221
80643
|
() => new Set(visibleNodes.map((n) => n.id)),
|
|
80222
80644
|
[visibleNodes]
|
|
80223
80645
|
);
|
|
80224
80646
|
const selection = selectedNodeId === void 0 ? internalSelected : selectedNodeId;
|
|
80225
80647
|
const selected = selection !== null && visible.has(selection) ? selection : null;
|
|
80226
80648
|
const activeFocus = focused !== null && visible.has(focused) ? focused : null;
|
|
80227
|
-
const highlighted = (0,
|
|
80649
|
+
const highlighted = (0, import_react334.useMemo)(
|
|
80228
80650
|
() => new Set(highlightedEdgeIds),
|
|
80229
80651
|
[highlightedEdgeIds]
|
|
80230
80652
|
);
|
|
80231
|
-
const counts = (0,
|
|
80653
|
+
const counts = (0, import_react334.useMemo)(() => {
|
|
80232
80654
|
const result = /* @__PURE__ */ new Map();
|
|
80233
80655
|
for (const n of model.nodes)
|
|
80234
80656
|
if (n.community)
|
|
@@ -80248,7 +80670,7 @@ function NetworkGraph({
|
|
|
80248
80670
|
onViewportChange
|
|
80249
80671
|
});
|
|
80250
80672
|
const locked = disabled || loading;
|
|
80251
|
-
const drag = (0,
|
|
80673
|
+
const drag = (0, import_react334.useRef)(null);
|
|
80252
80674
|
const select = (id) => {
|
|
80253
80675
|
if (locked) return;
|
|
80254
80676
|
if (selectedNodeId === void 0) setInternalSelected(id);
|
|
@@ -80264,7 +80686,7 @@ function NetworkGraph({
|
|
|
80264
80686
|
);
|
|
80265
80687
|
onVisibleCommunitiesChange?.(ids);
|
|
80266
80688
|
};
|
|
80267
|
-
(0,
|
|
80689
|
+
(0, import_react334.useEffect)(() => {
|
|
80268
80690
|
const element = canvas.canvasRef.current;
|
|
80269
80691
|
if (!element || locked) return;
|
|
80270
80692
|
const wheel = (event) => {
|
|
@@ -80313,13 +80735,13 @@ function NetworkGraph({
|
|
|
80313
80735
|
}
|
|
80314
80736
|
};
|
|
80315
80737
|
const focusedNode = model.byId.get(activeFocus ?? selected ?? "");
|
|
80316
|
-
const matchingNodes = (0,
|
|
80738
|
+
const matchingNodes = (0, import_react334.useMemo)(() => {
|
|
80317
80739
|
const search = query.toLocaleLowerCase();
|
|
80318
80740
|
return visibleNodes.filter((n) => (n.label ?? n.id).toLocaleLowerCase().includes(search)).slice(0, 50).map((n) => ({ value: n.id, label: n.label ?? n.id }));
|
|
80319
80741
|
}, [visibleNodes, query]);
|
|
80320
80742
|
const graphHeight = Number.isFinite(height) ? Math.max(160, height) : 480;
|
|
80321
80743
|
const resolvedLegendTone = legendTone === "auto" ? surfaceTone : legendTone;
|
|
80322
|
-
const legendContent = /* @__PURE__ */ (0,
|
|
80744
|
+
const legendContent = /* @__PURE__ */ (0, import_jsx_runtime362.jsxs)(
|
|
80323
80745
|
"fieldset",
|
|
80324
80746
|
{
|
|
80325
80747
|
disabled: locked,
|
|
@@ -80328,8 +80750,8 @@ function NetworkGraph({
|
|
|
80328
80750
|
maxHeight: legendPanel ? Math.max(96, graphHeight - 64) : graphHeight
|
|
80329
80751
|
},
|
|
80330
80752
|
children: [
|
|
80331
|
-
/* @__PURE__ */ (0,
|
|
80332
|
-
/* @__PURE__ */ (0,
|
|
80753
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)("legend", { className: "mb-3 text-xs font-semibold uppercase tracking-widest", children: t("kit.networkGraph.communities") }),
|
|
80754
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80333
80755
|
Checkbox_default,
|
|
80334
80756
|
{
|
|
80335
80757
|
size: "sm",
|
|
@@ -80340,8 +80762,8 @@ function NetworkGraph({
|
|
|
80340
80762
|
onChange: (event) => filter(event.target.checked ? model.groups.map((g) => g.id) : [])
|
|
80341
80763
|
}
|
|
80342
80764
|
),
|
|
80343
|
-
model.groups.map((group) => /* @__PURE__ */ (0,
|
|
80344
|
-
/* @__PURE__ */ (0,
|
|
80765
|
+
model.groups.map((group) => /* @__PURE__ */ (0, import_jsx_runtime362.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
80766
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80345
80767
|
Checkbox_default,
|
|
80346
80768
|
{
|
|
80347
80769
|
size: "sm",
|
|
@@ -80353,12 +80775,12 @@ function NetworkGraph({
|
|
|
80353
80775
|
)
|
|
80354
80776
|
}
|
|
80355
80777
|
),
|
|
80356
|
-
/* @__PURE__ */ (0,
|
|
80778
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)("span", { className: "text-xs tabular-nums opacity-60", children: counts.get(group.id) ?? 0 })
|
|
80357
80779
|
] }, group.id))
|
|
80358
80780
|
]
|
|
80359
80781
|
}
|
|
80360
80782
|
);
|
|
80361
|
-
return /* @__PURE__ */ (0,
|
|
80783
|
+
return /* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80362
80784
|
Panel_default,
|
|
80363
80785
|
{
|
|
80364
80786
|
...panelProps,
|
|
@@ -80369,7 +80791,7 @@ function NetworkGraph({
|
|
|
80369
80791
|
loading,
|
|
80370
80792
|
clickable: false,
|
|
80371
80793
|
scrollable: false,
|
|
80372
|
-
children: /* @__PURE__ */ (0,
|
|
80794
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime362.jsxs)(
|
|
80373
80795
|
"div",
|
|
80374
80796
|
{
|
|
80375
80797
|
className: "flex min-w-0 flex-col gap-3",
|
|
@@ -80377,7 +80799,7 @@ function NetworkGraph({
|
|
|
80377
80799
|
"aria-label": ariaLabel ?? t("kit.networkGraph.name"),
|
|
80378
80800
|
"aria-disabled": locked || void 0,
|
|
80379
80801
|
children: [
|
|
80380
|
-
showControls && /* @__PURE__ */ (0,
|
|
80802
|
+
showControls && /* @__PURE__ */ (0, import_jsx_runtime362.jsx)("div", { className: "flex flex-wrap items-center gap-2", children: /* @__PURE__ */ (0, import_jsx_runtime362.jsx)("div", { className: "min-w-40 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80381
80803
|
Combobox_default,
|
|
80382
80804
|
{
|
|
80383
80805
|
size: "sm",
|
|
@@ -80399,7 +80821,7 @@ function NetworkGraph({
|
|
|
80399
80821
|
}
|
|
80400
80822
|
}
|
|
80401
80823
|
) }) }),
|
|
80402
|
-
/* @__PURE__ */ (0,
|
|
80824
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsxs)(
|
|
80403
80825
|
"div",
|
|
80404
80826
|
{
|
|
80405
80827
|
ref: layoutRef,
|
|
@@ -80407,13 +80829,13 @@ function NetworkGraph({
|
|
|
80407
80829
|
style: { flexDirection: legendOnRight ? "row" : "column" },
|
|
80408
80830
|
"data-legend-position": legendOnRight ? "right" : "bottom",
|
|
80409
80831
|
children: [
|
|
80410
|
-
/* @__PURE__ */ (0,
|
|
80832
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsxs)(
|
|
80411
80833
|
"div",
|
|
80412
80834
|
{
|
|
80413
80835
|
className: "relative min-w-0 flex-1",
|
|
80414
80836
|
style: { height: graphHeight, minHeight: graphHeight },
|
|
80415
80837
|
children: [
|
|
80416
|
-
/* @__PURE__ */ (0,
|
|
80838
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80417
80839
|
"canvas",
|
|
80418
80840
|
{
|
|
80419
80841
|
ref: canvas.canvasRef,
|
|
@@ -80482,11 +80904,11 @@ function NetworkGraph({
|
|
|
80482
80904
|
}
|
|
80483
80905
|
}
|
|
80484
80906
|
),
|
|
80485
|
-
showControls && /* @__PURE__ */ (0,
|
|
80486
|
-
/* @__PURE__ */ (0,
|
|
80907
|
+
showControls && /* @__PURE__ */ (0, import_jsx_runtime362.jsxs)("div", { className: "absolute bottom-3 right-3 z-10 flex items-center gap-0.5 rounded-lg border border-neutral-200 bg-white/90 p-1 shadow-sm backdrop-blur dark:border-neutral-700 dark:bg-neutral-900/90", children: [
|
|
80908
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80487
80909
|
IconButton_default,
|
|
80488
80910
|
{
|
|
80489
|
-
icon: /* @__PURE__ */ (0,
|
|
80911
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime362.jsxs)(
|
|
80490
80912
|
"svg",
|
|
80491
80913
|
{
|
|
80492
80914
|
viewBox: "0 0 24 24",
|
|
@@ -80497,10 +80919,10 @@ function NetworkGraph({
|
|
|
80497
80919
|
strokeLinejoin: "round",
|
|
80498
80920
|
"aria-hidden": "true",
|
|
80499
80921
|
children: [
|
|
80500
|
-
/* @__PURE__ */ (0,
|
|
80501
|
-
/* @__PURE__ */ (0,
|
|
80502
|
-
/* @__PURE__ */ (0,
|
|
80503
|
-
/* @__PURE__ */ (0,
|
|
80922
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)("path", { d: "M4 9V5a1 1 0 0 1 1-1h4" }),
|
|
80923
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)("path", { d: "M15 4h4a1 1 0 0 1 1 1v4" }),
|
|
80924
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)("path", { d: "M20 15v4a1 1 0 0 1-1 1h-4" }),
|
|
80925
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)("path", { d: "M9 20H5a1 1 0 0 1-1-1v-4" })
|
|
80504
80926
|
]
|
|
80505
80927
|
}
|
|
80506
80928
|
),
|
|
@@ -80513,10 +80935,10 @@ function NetworkGraph({
|
|
|
80513
80935
|
onClick: canvas.fit
|
|
80514
80936
|
}
|
|
80515
80937
|
),
|
|
80516
|
-
/* @__PURE__ */ (0,
|
|
80938
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80517
80939
|
IconButton_default,
|
|
80518
80940
|
{
|
|
80519
|
-
icon: /* @__PURE__ */ (0,
|
|
80941
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80520
80942
|
"svg",
|
|
80521
80943
|
{
|
|
80522
80944
|
viewBox: "0 0 24 24",
|
|
@@ -80525,7 +80947,7 @@ function NetworkGraph({
|
|
|
80525
80947
|
strokeWidth: 2,
|
|
80526
80948
|
strokeLinecap: "round",
|
|
80527
80949
|
"aria-hidden": "true",
|
|
80528
|
-
children: /* @__PURE__ */ (0,
|
|
80950
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime362.jsx)("path", { d: "M6 12h12" })
|
|
80529
80951
|
}
|
|
80530
80952
|
),
|
|
80531
80953
|
size: "xs",
|
|
@@ -80537,7 +80959,7 @@ function NetworkGraph({
|
|
|
80537
80959
|
onClick: () => canvas.zoomBy(0.8)
|
|
80538
80960
|
}
|
|
80539
80961
|
),
|
|
80540
|
-
/* @__PURE__ */ (0,
|
|
80962
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsxs)(
|
|
80541
80963
|
"span",
|
|
80542
80964
|
{
|
|
80543
80965
|
className: "min-w-[3.5ch] px-1 text-center text-[11px] tabular-nums text-neutral-500 dark:text-neutral-400",
|
|
@@ -80548,7 +80970,7 @@ function NetworkGraph({
|
|
|
80548
80970
|
]
|
|
80549
80971
|
}
|
|
80550
80972
|
),
|
|
80551
|
-
/* @__PURE__ */ (0,
|
|
80973
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80552
80974
|
IconButton_default,
|
|
80553
80975
|
{
|
|
80554
80976
|
icon: "Add",
|
|
@@ -80561,7 +80983,7 @@ function NetworkGraph({
|
|
|
80561
80983
|
onClick: () => canvas.zoomBy(1.25)
|
|
80562
80984
|
}
|
|
80563
80985
|
),
|
|
80564
|
-
/* @__PURE__ */ (0,
|
|
80986
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80565
80987
|
IconButton_default,
|
|
80566
80988
|
{
|
|
80567
80989
|
icon: "Reset",
|
|
@@ -80579,18 +81001,18 @@ function NetworkGraph({
|
|
|
80579
81001
|
}
|
|
80580
81002
|
)
|
|
80581
81003
|
] }),
|
|
80582
|
-
!visibleNodes.length && /* @__PURE__ */ (0,
|
|
81004
|
+
!visibleNodes.length && /* @__PURE__ */ (0, import_jsx_runtime362.jsx)("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center text-sm", children: emptyMessage ?? t("kit.networkGraph.empty") })
|
|
80583
81005
|
]
|
|
80584
81006
|
}
|
|
80585
81007
|
),
|
|
80586
|
-
showCommunities && model.groups.length > 0 && /* @__PURE__ */ (0,
|
|
81008
|
+
showCommunities && model.groups.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80587
81009
|
"div",
|
|
80588
81010
|
{
|
|
80589
81011
|
className: "min-w-0 shrink-0",
|
|
80590
81012
|
style: {
|
|
80591
81013
|
width: legendOnRight ? legendPanel ? 224 : 192 : "100%"
|
|
80592
81014
|
},
|
|
80593
|
-
children: legendPanel ? /* @__PURE__ */ (0,
|
|
81015
|
+
children: legendPanel ? /* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80594
81016
|
Panel_default,
|
|
80595
81017
|
{
|
|
80596
81018
|
variant: legendVariant === "auto" ? variant : legendVariant,
|
|
@@ -80609,8 +81031,8 @@ function NetworkGraph({
|
|
|
80609
81031
|
]
|
|
80610
81032
|
}
|
|
80611
81033
|
),
|
|
80612
|
-
/* @__PURE__ */ (0,
|
|
80613
|
-
/* @__PURE__ */ (0,
|
|
81034
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)("p", { id: helpId, className: "text-xs opacity-70", children: t("kit.networkGraph.instructions") }),
|
|
81035
|
+
/* @__PURE__ */ (0, import_jsx_runtime362.jsx)(
|
|
80614
81036
|
"p",
|
|
80615
81037
|
{
|
|
80616
81038
|
role: "status",
|
|
@@ -80758,6 +81180,7 @@ function NetworkGraph({
|
|
|
80758
81180
|
FR_KIT_CATALOG,
|
|
80759
81181
|
FUNNEL_MAX_STAGES,
|
|
80760
81182
|
FileUpload,
|
|
81183
|
+
FilterBar,
|
|
80761
81184
|
FormField,
|
|
80762
81185
|
FormLayout,
|
|
80763
81186
|
FormSection,
|