@stackone/malachite 2.91.0 → 2.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPONENTS.md +1 -1
- package/dist/components/Accordion.js +52 -49
- package/dist/components/Accordion.js.map +1 -1
- package/dist/components/FilterSearch.js +318 -282
- package/dist/components/FilterSearch.js.map +1 -1
- package/dist/components/Modal.js +58 -59
- package/dist/components/Modal.js.map +1 -1
- package/dist/components/SidePanel.js +47 -48
- package/dist/components/SidePanel.js.map +1 -1
- package/dist/components/afterNextPaint.js +11 -0
- package/dist/components/afterNextPaint.js.map +1 -0
- package/dist/components/filterSearchModel.js +32 -31
- package/dist/components/filterSearchModel.js.map +1 -1
- package/dist/components/frameStyles.js +6 -5
- package/dist/components/frameStyles.js.map +1 -1
- package/dist/index.d.ts +10 -3
- package/package.json +1 -1
|
@@ -1,66 +1,66 @@
|
|
|
1
|
-
const w = (e, t) => e !== null ? "items" : t.trim().length > 0 ? "search" : "filters",
|
|
1
|
+
const w = (e, t) => e !== null ? "items" : t.trim().length > 0 ? "search" : "filters", m = (e, t) => {
|
|
2
2
|
const s = t.trim().toLowerCase();
|
|
3
3
|
return e.label.toLowerCase().includes(s) || e.value.toLowerCase().includes(s);
|
|
4
|
-
},
|
|
4
|
+
}, d = (e, t) => {
|
|
5
5
|
var s;
|
|
6
6
|
return new Set(((s = e.find((l) => l.filter === t)) == null ? void 0 : s.items) ?? []);
|
|
7
7
|
}, p = (e, t) => e.flatMap((s) => {
|
|
8
|
-
const l =
|
|
8
|
+
const l = d(t, s.value);
|
|
9
9
|
return s.items.map((o) => ({ item: o, filter: s, selected: l.has(o.value) }));
|
|
10
10
|
}), g = (e, t) => {
|
|
11
|
-
const s = e.filter((n) =>
|
|
11
|
+
const s = e.filter((n) => m(n.item, t));
|
|
12
12
|
if (!s.some((n) => !n.item.disabled)) return null;
|
|
13
13
|
const l = e.every((n) => n.item.disabled || n.selected), o = t.trim().length > 0 && s.filter((n) => !n.item.disabled).every((n) => n.selected);
|
|
14
14
|
return l || o ? "deselect" : "select";
|
|
15
15
|
}, v = (e, t) => ({
|
|
16
16
|
toggle: g(e, t),
|
|
17
|
-
items: e.filter((s) =>
|
|
17
|
+
items: e.filter((s) => m(s.item, t))
|
|
18
18
|
}), S = (e, t, s, l) => {
|
|
19
19
|
var f;
|
|
20
20
|
if (e === null) return;
|
|
21
21
|
const o = t.find((i) => i.value === e), n = s == null ? void 0 : s.find((i) => i.value === e);
|
|
22
22
|
if (!o || !n) return o ?? n;
|
|
23
|
-
const r = new Set((f = l.find((i) => i.filter === e)) == null ? void 0 : f.items),
|
|
24
|
-
return
|
|
25
|
-
}, y = (e, t, s) => e ? v(p([e], t), s) : { toggle: null, items: [] },
|
|
23
|
+
const r = new Set((f = l.find((i) => i.filter === e)) == null ? void 0 : f.items), u = new Set(o.items.map((i) => i.value)), a = n.items.filter((i) => r.has(i.value) && !u.has(i.value));
|
|
24
|
+
return a.length ? { ...o, items: [...o.items, ...a] } : o;
|
|
25
|
+
}, y = (e, t, s) => e ? v(p([e], t), s) : { toggle: null, items: [] }, x = (e, t, s) => v(p(e, t), s), h = (e, t) => {
|
|
26
26
|
const s = new Set(t);
|
|
27
27
|
return e.length === s.size && e.every((l) => s.has(l));
|
|
28
|
-
},
|
|
28
|
+
}, c = (e, t) => {
|
|
29
29
|
const s = t.filter(
|
|
30
|
-
(r) => !h(r.items, [...
|
|
30
|
+
(r) => !h(r.items, [...d(e, r.filter)])
|
|
31
31
|
), l = new Map(s.map((r) => [r.filter, r.items])), o = e.map((r) => ({
|
|
32
32
|
filter: r.filter,
|
|
33
33
|
items: l.get(r.filter) ?? r.items
|
|
34
34
|
})).filter((r) => r.items.length > 0), n = s.filter(
|
|
35
|
-
(r) => r.items.length > 0 && !e.some((
|
|
35
|
+
(r) => r.items.length > 0 && !e.some((u) => u.filter === r.filter)
|
|
36
36
|
);
|
|
37
37
|
return { next: [...o, ...n], changes: s };
|
|
38
|
-
},
|
|
39
|
-
const l = [...
|
|
40
|
-
return
|
|
41
|
-
},
|
|
38
|
+
}, C = (e, t, s) => {
|
|
39
|
+
const l = [...d(e, t)], o = l.includes(s) ? l.filter((n) => n !== s) : [...l, s];
|
|
40
|
+
return c(e, [{ filter: t, items: o }]);
|
|
41
|
+
}, M = (e, t, s) => c(
|
|
42
42
|
t,
|
|
43
43
|
e.map((l) => {
|
|
44
|
-
const o =
|
|
45
|
-
(r) => !o.has(r.value) && !r.disabled &&
|
|
44
|
+
const o = d(t, l.value), n = l.items.filter(
|
|
45
|
+
(r) => !o.has(r.value) && !r.disabled && m(r, s)
|
|
46
46
|
).map((r) => r.value);
|
|
47
47
|
return { filter: l.value, items: [...o, ...n] };
|
|
48
48
|
})
|
|
49
|
-
),
|
|
49
|
+
), $ = (e, t, s) => c(
|
|
50
50
|
t,
|
|
51
51
|
e.map((l) => {
|
|
52
|
-
const o =
|
|
53
|
-
l.items.filter((r) => !r.disabled &&
|
|
52
|
+
const o = d(t, l.value), n = new Set(
|
|
53
|
+
l.items.filter((r) => !r.disabled && m(r, s)).map((r) => r.value)
|
|
54
54
|
);
|
|
55
55
|
return {
|
|
56
56
|
filter: l.value,
|
|
57
57
|
items: [...o].filter((r) => !n.has(r))
|
|
58
58
|
};
|
|
59
59
|
})
|
|
60
|
-
),
|
|
60
|
+
), b = (e, t) => c(e, [{ filter: t, items: [] }]), k = (e) => c(
|
|
61
61
|
e,
|
|
62
62
|
e.map((t) => ({ filter: t.filter, items: [] }))
|
|
63
|
-
), A = (e, t) => t.length === 0 ? e : t.length === 1 ? `${e}: ${t[0]}` : `${e}: (${t.join(", ")})`,
|
|
63
|
+
), A = (e, t, s) => c(e, [{ filter: t, items: [s] }]), R = (e, t) => t.length === 0 ? e : t.length === 1 ? `${e}: ${t[0]}` : `${e}: (${t.join(", ")})`, T = (e, t, s = null) => {
|
|
64
64
|
const l = new Set(e.map((n) => n.filter)), o = t.filter((n) => l.has(n) || n === s);
|
|
65
65
|
return [
|
|
66
66
|
...o,
|
|
@@ -68,17 +68,18 @@ const w = (e, t) => e !== null ? "items" : t.trim().length > 0 ? "search" : "fil
|
|
|
68
68
|
];
|
|
69
69
|
};
|
|
70
70
|
export {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
R as chipText,
|
|
72
|
+
k as clearAll,
|
|
73
|
+
A as commitText,
|
|
74
|
+
$ as deselectAll,
|
|
74
75
|
y as filterRows,
|
|
75
|
-
|
|
76
|
+
m as matchesQuery,
|
|
76
77
|
S as openFilterOf,
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
T as orderSelections,
|
|
79
|
+
b as removeFilter,
|
|
79
80
|
w as resolveMode,
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
x as searchRows,
|
|
82
|
+
M as selectAll,
|
|
83
|
+
C as toggleValue
|
|
83
84
|
};
|
|
84
85
|
//# sourceMappingURL=filterSearchModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"filterSearchModel.js","sources":["../../src/components/filterSearchModel.ts"],"sourcesContent":["export interface FilterSearchItem {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface FilterSearchFilter {\n value: string;\n label: string;\n /** Shown beside the filter's name in the menu, and beside its values in a cross-filter search. */\n info?: string;\n /** Right-aligned hint on the filter's row, e.g. `e.g. Attio, Ashby`. */\n example?: string;\n items: FilterSearchItem[];\n}\n\nexport interface FilterSearchSelection {\n filter: string;\n items: string[];\n}\n\n/** One filter's new values. An empty `items` means the filter was removed. */\nexport interface FilterSearchChange {\n filter: string;\n items: string[];\n}\n\nexport interface FilterSearchUpdate {\n next: FilterSearchSelection[];\n changes: FilterSearchChange[];\n}\n\nexport type FilterSearchMode = 'filters' | 'items' | 'search';\n\nexport type FilterSearchToggle = 'select' | 'deselect';\n\nexport interface FilterSearchItemRow {\n item: FilterSearchItem;\n filter: FilterSearchFilter;\n selected: boolean;\n}\n\nexport interface FilterSearchRows {\n /** The Select All / Deselect All row, absent when no enabled value matches. */\n toggle: FilterSearchToggle | null;\n items: FilterSearchItemRow[];\n}\n\nexport const resolveMode = (activeFilter: string | null, query: string): FilterSearchMode => {\n if (activeFilter !== null) return 'items';\n return query.trim().length > 0 ? 'search' : 'filters';\n};\n\nexport const matchesQuery = (item: FilterSearchItem, query: string): boolean => {\n const needle = query.trim().toLowerCase();\n return item.label.toLowerCase().includes(needle) || item.value.toLowerCase().includes(needle);\n};\n\nconst selectedValues = (selections: FilterSearchSelection[], filter: string): Set<string> =>\n new Set(selections.find((selection) => selection.filter === filter)?.items ?? []);\n\nconst toRows = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n): FilterSearchItemRow[] =>\n filters.flatMap((filter) => {\n const selected = selectedValues(selections, filter.value);\n return filter.items.map((item) => ({ item, filter, selected: selected.has(item.value) }));\n });\n\n/**\n * \"Deselect All\" replaces \"Select All\" once every enabled value is chosen, or once every value\n * the query matches is.\n */\nconst toggleFor = (all: FilterSearchItemRow[], query: string): FilterSearchToggle | null => {\n const matched = all.filter((row) => matchesQuery(row.item, query));\n if (!matched.some((row) => !row.item.disabled)) return null;\n\n const everyEnabledSelected = all.every((row) => row.item.disabled || row.selected);\n const everyMatchSelected =\n query.trim().length > 0 &&\n matched.filter((row) => !row.item.disabled).every((row) => row.selected);\n\n return everyEnabledSelected || everyMatchSelected ? 'deselect' : 'select';\n};\n\nconst rowsFor = (all: FilterSearchItemRow[], query: string): FilterSearchRows => ({\n toggle: toggleFor(all, query),\n items: all.filter((row) => matchesQuery(row.item, query)),\n});\n\n/** The values of one filter, as the menu lists them once that filter is picked. */\n/**\n * The open filter as its menu lists it: `filters`' entry, with any picked value only\n * `searchFilters` holds added back, so a value picked through search can be unticked from its\n * own chip. A filter only `searchFilters` holds is listed from there.\n */\nexport const openFilterOf = (\n active: string | null,\n filters: FilterSearchFilter[],\n searchFilters: FilterSearchFilter[] | undefined,\n selections: FilterSearchSelection[],\n): FilterSearchFilter | undefined => {\n if (active === null) return undefined;\n const narrowed = filters.find((filter) => filter.value === active);\n const wide = searchFilters?.find((filter) => filter.value === active);\n if (!narrowed || !wide) return narrowed ?? wide;\n const picked = new Set(selections.find((selection) => selection.filter === active)?.items);\n const listed = new Set(narrowed.items.map((item) => item.value));\n const missing = wide.items.filter((item) => picked.has(item.value) && !listed.has(item.value));\n return missing.length ? { ...narrowed, items: [...narrowed.items, ...missing] } : narrowed;\n};\n\nexport const filterRows = (\n filter: FilterSearchFilter | undefined,\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchRows =>\n filter ? rowsFor(toRows([filter], selections), query) : { toggle: null, items: [] };\n\n/** The values of every filter that match a query typed before any filter was picked. */\nexport const searchRows = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchRows => rowsFor(toRows(filters, selections), query);\n\n// As sets: a Select All that adds nothing returns the values in item order, not the order chosen.\nconst sameItems = (a: string[], b: string[]) => {\n const set = new Set(b);\n return a.length === set.size && a.every((value) => set.has(value));\n};\n\n/** Applies per-filter changes, keeping each filter where it already was and dropping the emptied. */\nconst applyChanges = (\n selections: FilterSearchSelection[],\n proposed: FilterSearchChange[],\n): FilterSearchUpdate => {\n const changes = proposed.filter(\n (change) => !sameItems(change.items, [...selectedValues(selections, change.filter)]),\n );\n const byFilter = new Map(changes.map((change) => [change.filter, change.items]));\n const kept = selections\n .map((selection) => ({\n filter: selection.filter,\n items: byFilter.get(selection.filter) ?? selection.items,\n }))\n .filter((selection) => selection.items.length > 0);\n const added = changes.filter(\n (change) =>\n change.items.length > 0 &&\n !selections.some((selection) => selection.filter === change.filter),\n );\n\n return { next: [...kept, ...added], changes };\n};\n\nexport const toggleValue = (\n selections: FilterSearchSelection[],\n filter: string,\n value: string,\n): FilterSearchUpdate => {\n const current = [...selectedValues(selections, filter)];\n const items = current.includes(value)\n ? current.filter((item) => item !== value)\n : [...current, value];\n\n return applyChanges(selections, [{ filter, items }]);\n};\n\n/** Select All keeps what is already chosen and adds every enabled value the query matches. */\nexport const selectAll = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchUpdate =>\n applyChanges(\n selections,\n filters.map((filter) => {\n const selected = selectedValues(selections, filter.value);\n const added = filter.items\n .filter(\n (item) =>\n !selected.has(item.value) && !item.disabled && matchesQuery(item, query),\n )\n .map((item) => item.value);\n // Chosen values stay even when `items` no longer lists them (a stale or lazy list).\n return { filter: filter.value, items: [...selected, ...added] };\n }),\n );\n\n/** Deselect All drops every enabled value the query matches and keeps the rest. */\nexport const deselectAll = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchUpdate =>\n applyChanges(\n selections,\n filters.map((filter) => {\n const selected = selectedValues(selections, filter.value);\n const dropped = new Set(\n filter.items\n .filter((item) => !item.disabled && matchesQuery(item, query))\n .map((item) => item.value),\n );\n return {\n filter: filter.value,\n items: [...selected].filter((value) => !dropped.has(value)),\n };\n }),\n );\n\nexport const removeFilter = (\n selections: FilterSearchSelection[],\n filter: string,\n): FilterSearchUpdate => applyChanges(selections, [{ filter, items: [] }]);\n\nexport const clearAll = (selections: FilterSearchSelection[]): FilterSearchUpdate =>\n applyChanges(\n selections,\n selections.map((selection) => ({ filter: selection.filter, items: [] })),\n );\n\n/** `Connector: Notion`, or `Connector: (Notion, Attio)` once there is more than one value. */\nexport const chipText = (filterLabel: string, itemLabels: string[]): string => {\n if (itemLabels.length === 0) return filterLabel;\n if (itemLabels.length === 1) return `${filterLabel}: ${itemLabels[0]}`;\n return `${filterLabel}: (${itemLabels.join(', ')})`;\n};\n\n/**\n * The order chips show filters in: when each was first added. A consumer reading its selection back\n * from the URL gets it in a fixed key order, which would reshuffle the chips on every change.\n */\nexport const orderSelections = (\n selections: FilterSearchSelection[],\n order: string[],\n /** A filter to hold its place in `order` while it has no values, e.g. the one being edited. */\n keep: string | null = null,\n): string[] => {\n const present = new Set(selections.map((selection) => selection.filter));\n const kept = order.filter((filter) => present.has(filter) || filter === keep);\n return [\n ...kept,\n ...selections.map((selection) => selection.filter).filter((f) => !kept.includes(f)),\n ];\n};\n"],"names":["resolveMode","activeFilter","query","matchesQuery","item","needle","selectedValues","selections","filter","_a","selection","toRows","filters","selected","toggleFor","all","matched","row","everyEnabledSelected","everyMatchSelected","rowsFor","openFilterOf","active","searchFilters","narrowed","wide","picked","listed","missing","filterRows","searchRows","sameItems","a","b","set","value","applyChanges","proposed","changes","change","byFilter","kept","added","toggleValue","current","items","selectAll","deselectAll","dropped","removeFilter","clearAll","chipText","filterLabel","itemLabels","orderSelections","order","keep","present","f"],"mappings":"AAgDO,MAAMA,IAAc,CAACC,GAA6BC,MACjDD,MAAiB,OAAa,UAC3BC,EAAM,KAAA,EAAO,SAAS,IAAI,WAAW,WAGnCC,IAAe,CAACC,GAAwBF,MAA2B;AAC5E,QAAMG,IAASH,EAAM,KAAA,EAAO,YAAA;AAC5B,SAAOE,EAAK,MAAM,YAAA,EAAc,SAASC,CAAM,KAAKD,EAAK,MAAM,cAAc,SAASC,CAAM;AAChG,GAEMC,IAAiB,CAACC,GAAqCC,MAAA;AAVtD,MAAAC;AAWH,aAAI,MAAIA,IAAAF,EAAW,KAAK,CAACG,MAAcA,EAAU,WAAWF,CAAM,MAA1D,gBAAAC,EAA6D,UAAS,CAAA,CAAE;AAAA,GAE9EE,IAAS,CACXC,GACAL,MAEAK,EAAQ,QAAQ,CAACJ,MAAW;AACxB,QAAMK,IAAWP,EAAeC,GAAYC,EAAO,KAAK;AACxD,SAAOA,EAAO,MAAM,IAAI,CAACJ,OAAU,EAAE,MAAAA,GAAM,QAAAI,GAAQ,UAAUK,EAAS,IAAIT,EAAK,KAAK,IAAI;AAC5F,CAAC,GAMCU,IAAY,CAACC,GAA4Bb,MAA6C;AACxF,QAAMc,IAAUD,EAAI,OAAO,CAACE,MAAQd,EAAac,EAAI,MAAMf,CAAK,CAAC;AACjE,MAAI,CAACc,EAAQ,KAAK,CAACC,MAAQ,CAACA,EAAI,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W,WAAW,IAAUD,IAChCC,EAAW,WAAW,IAAU,GAAGD,CAAW,KAAKC,EAAW,CAAC,CAAC,KAC7D,GAAGD,CAAW,MAAMC,EAAW,KAAK,IAAI,CAAC,KAOvCC,IAAkB,CAC3B/C,GACAgD,GAEAC,IAAsB,SACX;AACX,QAAMC,IAAU,IAAI,IAAIlD,EAAW,IAAI,CAACG,MAAcA,EAAU,MAAM,CAAC,GACjE+B,IAAOc,EAAM,OAAO,CAAC/C,MAAWiD,EAAQ,IAAIjD,CAAM,KAAKA,MAAWgD,CAAI;AAC5E,SAAO;AAAA,IACH,GAAGf;AAAA,IACH,GAAGlC,EAAW,IAAI,CAACG,MAAcA,EAAU,MAAM,EAAE,OAAO,CAACgD,MAAM,CAACjB,EAAK,SAASiB,CAAC,CAAC;AAAA,EAAA;AAE1F;"}
|
|
1
|
+
{"version":3,"file":"filterSearchModel.js","sources":["../../src/components/filterSearchModel.ts"],"sourcesContent":["export interface FilterSearchItem {\n value: string;\n label: string;\n disabled?: boolean;\n}\n\nexport interface FilterSearchFilter {\n value: string;\n label: string;\n /** Shown beside the filter's name in the menu, and beside its values in a cross-filter search. */\n info?: string;\n /** Right-aligned hint on the filter's row, e.g. `e.g. Attio, Ashby`. */\n example?: string;\n items: FilterSearchItem[];\n}\n\nexport interface FilterSearchSelection {\n filter: string;\n items: string[];\n}\n\n/** One filter's new values. An empty `items` means the filter was removed. */\nexport interface FilterSearchChange {\n filter: string;\n items: string[];\n}\n\nexport interface FilterSearchUpdate {\n next: FilterSearchSelection[];\n changes: FilterSearchChange[];\n}\n\nexport type FilterSearchMode = 'filters' | 'items' | 'search';\n\nexport type FilterSearchToggle = 'select' | 'deselect';\n\nexport interface FilterSearchItemRow {\n item: FilterSearchItem;\n filter: FilterSearchFilter;\n selected: boolean;\n}\n\nexport interface FilterSearchRows {\n /** The Select All / Deselect All row, absent when no enabled value matches. */\n toggle: FilterSearchToggle | null;\n items: FilterSearchItemRow[];\n}\n\nexport const resolveMode = (activeFilter: string | null, query: string): FilterSearchMode => {\n if (activeFilter !== null) return 'items';\n return query.trim().length > 0 ? 'search' : 'filters';\n};\n\nexport const matchesQuery = (item: FilterSearchItem, query: string): boolean => {\n const needle = query.trim().toLowerCase();\n return item.label.toLowerCase().includes(needle) || item.value.toLowerCase().includes(needle);\n};\n\nconst selectedValues = (selections: FilterSearchSelection[], filter: string): Set<string> =>\n new Set(selections.find((selection) => selection.filter === filter)?.items ?? []);\n\nconst toRows = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n): FilterSearchItemRow[] =>\n filters.flatMap((filter) => {\n const selected = selectedValues(selections, filter.value);\n return filter.items.map((item) => ({ item, filter, selected: selected.has(item.value) }));\n });\n\n/**\n * \"Deselect All\" replaces \"Select All\" once every enabled value is chosen, or once every value\n * the query matches is.\n */\nconst toggleFor = (all: FilterSearchItemRow[], query: string): FilterSearchToggle | null => {\n const matched = all.filter((row) => matchesQuery(row.item, query));\n if (!matched.some((row) => !row.item.disabled)) return null;\n\n const everyEnabledSelected = all.every((row) => row.item.disabled || row.selected);\n const everyMatchSelected =\n query.trim().length > 0 &&\n matched.filter((row) => !row.item.disabled).every((row) => row.selected);\n\n return everyEnabledSelected || everyMatchSelected ? 'deselect' : 'select';\n};\n\nconst rowsFor = (all: FilterSearchItemRow[], query: string): FilterSearchRows => ({\n toggle: toggleFor(all, query),\n items: all.filter((row) => matchesQuery(row.item, query)),\n});\n\n/** The values of one filter, as the menu lists them once that filter is picked. */\n/**\n * The open filter as its menu lists it: `filters`' entry, with any picked value only\n * `searchFilters` holds added back, so a value picked through search can be unticked from its\n * own chip. A filter only `searchFilters` holds is listed from there.\n */\nexport const openFilterOf = (\n active: string | null,\n filters: FilterSearchFilter[],\n searchFilters: FilterSearchFilter[] | undefined,\n selections: FilterSearchSelection[],\n): FilterSearchFilter | undefined => {\n if (active === null) return undefined;\n const narrowed = filters.find((filter) => filter.value === active);\n const wide = searchFilters?.find((filter) => filter.value === active);\n if (!narrowed || !wide) return narrowed ?? wide;\n const picked = new Set(selections.find((selection) => selection.filter === active)?.items);\n const listed = new Set(narrowed.items.map((item) => item.value));\n const missing = wide.items.filter((item) => picked.has(item.value) && !listed.has(item.value));\n return missing.length ? { ...narrowed, items: [...narrowed.items, ...missing] } : narrowed;\n};\n\nexport const filterRows = (\n filter: FilterSearchFilter | undefined,\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchRows =>\n filter ? rowsFor(toRows([filter], selections), query) : { toggle: null, items: [] };\n\n/** The values of every filter that match a query typed before any filter was picked. */\nexport const searchRows = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchRows => rowsFor(toRows(filters, selections), query);\n\n// As sets: a Select All that adds nothing returns the values in item order, not the order chosen.\nconst sameItems = (a: string[], b: string[]) => {\n const set = new Set(b);\n return a.length === set.size && a.every((value) => set.has(value));\n};\n\n/** Applies per-filter changes, keeping each filter where it already was and dropping the emptied. */\nconst applyChanges = (\n selections: FilterSearchSelection[],\n proposed: FilterSearchChange[],\n): FilterSearchUpdate => {\n const changes = proposed.filter(\n (change) => !sameItems(change.items, [...selectedValues(selections, change.filter)]),\n );\n const byFilter = new Map(changes.map((change) => [change.filter, change.items]));\n const kept = selections\n .map((selection) => ({\n filter: selection.filter,\n items: byFilter.get(selection.filter) ?? selection.items,\n }))\n .filter((selection) => selection.items.length > 0);\n const added = changes.filter(\n (change) =>\n change.items.length > 0 &&\n !selections.some((selection) => selection.filter === change.filter),\n );\n\n return { next: [...kept, ...added], changes };\n};\n\nexport const toggleValue = (\n selections: FilterSearchSelection[],\n filter: string,\n value: string,\n): FilterSearchUpdate => {\n const current = [...selectedValues(selections, filter)];\n const items = current.includes(value)\n ? current.filter((item) => item !== value)\n : [...current, value];\n\n return applyChanges(selections, [{ filter, items }]);\n};\n\n/** Select All keeps what is already chosen and adds every enabled value the query matches. */\nexport const selectAll = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchUpdate =>\n applyChanges(\n selections,\n filters.map((filter) => {\n const selected = selectedValues(selections, filter.value);\n const added = filter.items\n .filter(\n (item) =>\n !selected.has(item.value) && !item.disabled && matchesQuery(item, query),\n )\n .map((item) => item.value);\n // Chosen values stay even when `items` no longer lists them (a stale or lazy list).\n return { filter: filter.value, items: [...selected, ...added] };\n }),\n );\n\n/** Deselect All drops every enabled value the query matches and keeps the rest. */\nexport const deselectAll = (\n filters: FilterSearchFilter[],\n selections: FilterSearchSelection[],\n query: string,\n): FilterSearchUpdate =>\n applyChanges(\n selections,\n filters.map((filter) => {\n const selected = selectedValues(selections, filter.value);\n const dropped = new Set(\n filter.items\n .filter((item) => !item.disabled && matchesQuery(item, query))\n .map((item) => item.value),\n );\n return {\n filter: filter.value,\n items: [...selected].filter((value) => !dropped.has(value)),\n };\n }),\n );\n\nexport const removeFilter = (\n selections: FilterSearchSelection[],\n filter: string,\n): FilterSearchUpdate => applyChanges(selections, [{ filter, items: [] }]);\n\nexport const clearAll = (selections: FilterSearchSelection[]): FilterSearchUpdate =>\n applyChanges(\n selections,\n selections.map((selection) => ({ filter: selection.filter, items: [] })),\n );\n\nexport const commitText = (\n selections: FilterSearchSelection[],\n filter: string,\n text: string,\n): FilterSearchUpdate => applyChanges(selections, [{ filter, items: [text] }]);\n\n/** `Connector: Notion`, or `Connector: (Notion, Attio)` once there is more than one value. */\nexport const chipText = (filterLabel: string, itemLabels: string[]): string => {\n if (itemLabels.length === 0) return filterLabel;\n if (itemLabels.length === 1) return `${filterLabel}: ${itemLabels[0]}`;\n return `${filterLabel}: (${itemLabels.join(', ')})`;\n};\n\n/**\n * The order chips show filters in: when each was first added. A consumer reading its selection back\n * from the URL gets it in a fixed key order, which would reshuffle the chips on every change.\n */\nexport const orderSelections = (\n selections: FilterSearchSelection[],\n order: string[],\n /** A filter to hold its place in `order` while it has no values, e.g. the one being edited. */\n keep: string | null = null,\n): string[] => {\n const present = new Set(selections.map((selection) => selection.filter));\n const kept = order.filter((filter) => present.has(filter) || filter === keep);\n return [\n ...kept,\n ...selections.map((selection) => selection.filter).filter((f) => !kept.includes(f)),\n ];\n};\n"],"names":["resolveMode","activeFilter","query","matchesQuery","item","needle","selectedValues","selections","filter","_a","selection","toRows","filters","selected","toggleFor","all","matched","row","everyEnabledSelected","everyMatchSelected","rowsFor","openFilterOf","active","searchFilters","narrowed","wide","picked","listed","missing","filterRows","searchRows","sameItems","a","b","set","value","applyChanges","proposed","changes","change","byFilter","kept","added","toggleValue","current","items","selectAll","deselectAll","dropped","removeFilter","clearAll","commitText","text","chipText","filterLabel","itemLabels","orderSelections","order","keep","present","f"],"mappings":"AAgDO,MAAMA,IAAc,CAACC,GAA6BC,MACjDD,MAAiB,OAAa,UAC3BC,EAAM,KAAA,EAAO,SAAS,IAAI,WAAW,WAGnCC,IAAe,CAACC,GAAwBF,MAA2B;AAC5E,QAAMG,IAASH,EAAM,KAAA,EAAO,YAAA;AAC5B,SAAOE,EAAK,MAAM,YAAA,EAAc,SAASC,CAAM,KAAKD,EAAK,MAAM,cAAc,SAASC,CAAM;AAChG,GAEMC,IAAiB,CAACC,GAAqCC,MAAA;AAVtD,MAAAC;AAWH,aAAI,MAAIA,IAAAF,EAAW,KAAK,CAACG,MAAcA,EAAU,WAAWF,CAAM,MAA1D,gBAAAC,EAA6D,UAAS,CAAA,CAAE;AAAA,GAE9EE,IAAS,CACXC,GACAL,MAEAK,EAAQ,QAAQ,CAACJ,MAAW;AACxB,QAAMK,IAAWP,EAAeC,GAAYC,EAAO,KAAK;AACxD,SAAOA,EAAO,MAAM,IAAI,CAACJ,OAAU,EAAE,MAAAA,GAAM,QAAAI,GAAQ,UAAUK,EAAS,IAAIT,EAAK,KAAK,IAAI;AAC5F,CAAC,GAMCU,IAAY,CAACC,GAA4Bb,MAA6C;AACxF,QAAMc,IAAUD,EAAI,OAAO,CAACE,MAAQd,EAAac,EAAI,MAAMf,CAAK,CAAC;AACjE,MAAI,CAACc,EAAQ,KAAK,CAACC,MAAQ,CAACA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C,MACqBhB,EAAa7B,GAAY,CAAC,EAAE,QAAAC,GAAQ,OAAO,CAAC4C,CAAI,EAAA,CAAG,CAAC,GAGhEC,IAAW,CAACC,GAAqBC,MACtCA,EAAW,WAAW,IAAUD,IAChCC,EAAW,WAAW,IAAU,GAAGD,CAAW,KAAKC,EAAW,CAAC,CAAC,KAC7D,GAAGD,CAAW,MAAMC,EAAW,KAAK,IAAI,CAAC,KAOvCC,IAAkB,CAC3BjD,GACAkD,GAEAC,IAAsB,SACX;AACX,QAAMC,IAAU,IAAI,IAAIpD,EAAW,IAAI,CAACG,MAAcA,EAAU,MAAM,CAAC,GACjE+B,IAAOgB,EAAM,OAAO,CAACjD,MAAWmD,EAAQ,IAAInD,CAAM,KAAKA,MAAWkD,CAAI;AAC5E,SAAO;AAAA,IACH,GAAGjB;AAAA,IACH,GAAGlC,EAAW,IAAI,CAACG,MAAcA,EAAU,MAAM,EAAE,OAAO,CAACkD,MAAM,CAACnB,EAAK,SAASmB,CAAC,CAAC;AAAA,EAAA;AAE1F;"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
const r = "bg-[var(--malachite-table-background,#f7f7f7)] p-[4px] rounded-xl", o =
|
|
1
|
+
const r = "bg-[var(--malachite-table-background,#f7f7f7)] p-[4px] rounded-xl", o = "var(--malachite-table-background, #f7f7f7)", c = 4, e = "var(--malachite-radius-xl, 12px)", t = 8, a = "1px solid var(--malachite-card-border, #e8e8e8)", R = {
|
|
2
2
|
background: "var(--malachite-table-row-background, #fff)",
|
|
3
3
|
border: a,
|
|
4
4
|
borderRadius: 8
|
|
5
5
|
};
|
|
6
6
|
export {
|
|
7
|
+
o as FRAME_BACKGROUND,
|
|
7
8
|
r as FRAME_CLASS,
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
c as FRAME_PADDING,
|
|
10
|
+
e as FRAME_RADIUS,
|
|
10
11
|
a as FRAME_SECTION_BORDER,
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
t as FRAME_SECTION_RADIUS,
|
|
13
|
+
R as FRAME_SECTION_STYLE
|
|
13
14
|
};
|
|
14
15
|
//# sourceMappingURL=frameStyles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frameStyles.js","sources":["../../src/components/frameStyles.ts"],"sourcesContent":["import type React from 'react';\n\n/**\n * The grey frame the detached Table draws around its header and rows, shared with Card's\n * `framed` variant so a card and the table beside it read as one set in both themes.\n */\nexport const FRAME_CLASS = 'bg-[var(--malachite-table-background,#f7f7f7)] p-[4px] rounded-xl';\n/** The `p-[4px]` in `FRAME_CLASS`, for geometry that has to offset it. */\nexport const FRAME_PADDING = 4;\n/** The radius `rounded-xl` in `FRAME_CLASS` resolves to. Read from the same token, or overriding\n * `radius.xl` pinches the corners of anything drawn to match them. */\nexport const FRAME_RADIUS = 'var(--malachite-radius-xl, 12px)';\n\n/** The bordered section inside the frame is clipped to this radius. The detached Table's first\n * and last rows echo it, so a selected row's accent bar curves into the corner instead of\n * being cut off by the clip. */\nexport const FRAME_SECTION_RADIUS = 8;\nexport const FRAME_SECTION_BORDER = '1px solid var(--malachite-card-border, #e8e8e8)';\n\n/** The bordered section a framed Card's children sit in, as the detached Table's rows do. */\nexport const FRAME_SECTION_STYLE: React.CSSProperties = {\n background: 'var(--malachite-table-row-background, #fff)',\n border: FRAME_SECTION_BORDER,\n borderRadius: FRAME_SECTION_RADIUS,\n};\n"],"names":["FRAME_CLASS","FRAME_PADDING","FRAME_RADIUS","FRAME_SECTION_RADIUS","FRAME_SECTION_BORDER","FRAME_SECTION_STYLE"],"mappings":"AAMO,MAAMA,IAAc,qEAEdC,IAAgB,GAGhBC,IAAe,oCAKfC,IAAuB,GACvBC,IAAuB,mDAGvBC,IAA2C;AAAA,EACpD,YAAY;AAAA,EACZ,QAAQD;AAAA,EACR,cAAc;AAClB;"}
|
|
1
|
+
{"version":3,"file":"frameStyles.js","sources":["../../src/components/frameStyles.ts"],"sourcesContent":["import type React from 'react';\n\n/**\n * The grey frame the detached Table draws around its header and rows, shared with Card's\n * `framed` variant so a card and the table beside it read as one set in both themes.\n */\nexport const FRAME_CLASS = 'bg-[var(--malachite-table-background,#f7f7f7)] p-[4px] rounded-xl';\n/** The colour in `FRAME_CLASS`, for a ground set inline, such as a pinned header over the frame. */\nexport const FRAME_BACKGROUND = 'var(--malachite-table-background, #f7f7f7)';\n/** The `p-[4px]` in `FRAME_CLASS`, for geometry that has to offset it. */\nexport const FRAME_PADDING = 4;\n/** The radius `rounded-xl` in `FRAME_CLASS` resolves to. Read from the same token, or overriding\n * `radius.xl` pinches the corners of anything drawn to match them. */\nexport const FRAME_RADIUS = 'var(--malachite-radius-xl, 12px)';\n\n/** The bordered section inside the frame is clipped to this radius. The detached Table's first\n * and last rows echo it, so a selected row's accent bar curves into the corner instead of\n * being cut off by the clip. */\nexport const FRAME_SECTION_RADIUS = 8;\nexport const FRAME_SECTION_BORDER = '1px solid var(--malachite-card-border, #e8e8e8)';\n\n/** The bordered section a framed Card's children sit in, as the detached Table's rows do. */\nexport const FRAME_SECTION_STYLE: React.CSSProperties = {\n background: 'var(--malachite-table-row-background, #fff)',\n border: FRAME_SECTION_BORDER,\n borderRadius: FRAME_SECTION_RADIUS,\n};\n"],"names":["FRAME_CLASS","FRAME_BACKGROUND","FRAME_PADDING","FRAME_RADIUS","FRAME_SECTION_RADIUS","FRAME_SECTION_BORDER","FRAME_SECTION_STYLE"],"mappings":"AAMO,MAAMA,IAAc,qEAEdC,IAAmB,8CAEnBC,IAAgB,GAGhBC,IAAe,oCAKfC,IAAuB,GACvBC,IAAuB,mDAGvBC,IAA2C;AAAA,EACpD,YAAY;AAAA,EACZ,QAAQD;AAAA,EACR,cAAc;AAClB;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -39,9 +39,9 @@ declare interface AccordionBaseProps {
|
|
|
39
39
|
children?: default_2.ReactNode;
|
|
40
40
|
/**
|
|
41
41
|
* Visual style. `default` is the flat list row (row dividers, hover background).
|
|
42
|
-
* `sunken` draws the section as a sunken card (
|
|
43
|
-
* dividers/hover) — used for stacked detail sections in side panels and
|
|
44
|
-
* pages (see `CollapsibleSection`). Both lead with the arrow: it is the affordance
|
|
42
|
+
* `sunken` draws the section as a sunken card (a rounded container in the table's frame
|
|
43
|
+
* colour, no dividers/hover) — used for stacked detail sections in side panels and
|
|
44
|
+
* detail pages (see `CollapsibleSection`). Both lead with the arrow: it is the affordance
|
|
45
45
|
* that says the section opens, and a reader scanning a stack of them finds it in
|
|
46
46
|
* one column rather than at whatever width each header happens to end.
|
|
47
47
|
*/
|
|
@@ -1941,6 +1941,13 @@ export declare interface FilterSearchProps {
|
|
|
1941
1941
|
onClear?: () => void;
|
|
1942
1942
|
/** The filter whose values are open, or `null` on the filter list — for loading values lazily. */
|
|
1943
1943
|
onActiveFilterChange?: (filter: string | null) => void;
|
|
1944
|
+
/** The text in the field on every change: typed, put back by clicking the text pill, or reset to `''` when a value is picked or the menu closes. */
|
|
1945
|
+
onQueryChange?: (query: string) => void;
|
|
1946
|
+
/** Lets typed text be committed as its own pill, under a `value` no filter uses. Its selection is `{ filter: textFilter.value, items: [text] }`. */
|
|
1947
|
+
textFilter?: {
|
|
1948
|
+
value: string;
|
|
1949
|
+
label: string;
|
|
1950
|
+
};
|
|
1944
1951
|
placeholder?: string;
|
|
1945
1952
|
size?: FilterSearchSize;
|
|
1946
1953
|
width?: ControlWidth;
|
package/package.json
CHANGED