@stackone/malachite 2.105.1 → 2.107.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.
@@ -1 +1 @@
1
- {"version":3,"file":"filterSearchModel.js","sources":["../../src/components/filterSearchModel.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nexport interface FilterSearchItem {\n value: string;\n label: string;\n disabled?: boolean;\n /** Drawn before the label in the menu and in the applied chip: a logo, a status dot. Keep it 12px. */\n icon?: ReactNode;\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 /** `false` drops the filter's name from its chip, for a value that reads alone: `Configured only`. */\n chipLabel?: boolean;\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":"AAsDO,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,KAAK,QAAQ,EAAG,QAAO;AAEvD,QAAMC,IAAuBH,EAAI,MAAM,CAACE,MAAQA,EAAI,KAAK,YAAYA,EAAI,QAAQ,GAC3EE,IACFjB,EAAM,KAAA,EAAO,SAAS,KACtBc,EAAQ,OAAO,CAACC,MAAQ,CAACA,EAAI,KAAK,QAAQ,EAAE,MAAM,CAACA,MAAQA,EAAI,QAAQ;AA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I,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
+ {"version":3,"file":"filterSearchModel.js","sources":["../../src/components/filterSearchModel.ts"],"sourcesContent":["import type { ReactNode } from 'react';\n\nexport interface FilterSearchItem {\n value: string;\n label: string;\n disabled?: boolean;\n /** Drawn before the label in the menu and in the applied chip: a logo, a status dot. Keep it 12px. */\n icon?: ReactNode;\n /** Drawn at the end of the value's row in the Filters panel: how many results it matches. */\n count?: number;\n}\n\nexport type FilterSearchControl = 'list' | 'toggle' | 'segmented';\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 /** `false` drops the filter's name from its chip, for a value that reads alone: `Configured only`. */\n chipLabel?: boolean;\n /** Filters panel control: `list` (default) ticks values, `toggle` switches its first item's value, `segmented` picks one or All. */\n control?: FilterSearchControl;\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/**\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\n/** Removes every filter but `keep`, e.g. the typed text's pill. */\nexport const clearAll = (\n selections: FilterSearchSelection[],\n keep: string | null = null,\n): FilterSearchUpdate =>\n applyChanges(\n selections,\n selections\n .filter((selection) => selection.filter !== keep)\n .map((selection) => ({ filter: selection.filter, items: [] })),\n );\n\nexport const setValues = (\n selections: FilterSearchSelection[],\n filter: string,\n items: string[],\n): FilterSearchUpdate => applyChanges(selections, [{ filter, items }]);\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","keep","setValues","commitText","text","chipText","filterLabel","itemLabels","orderSelections","order","present","f"],"mappings":"AA4DO,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,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AIb,CAAK,CAAC;AAAA,IAAA;AAAA,EAElE,CAAC;AACL,GAESc,IAAe,CACxB1C,GACAC,MACqB4B,EAAa7B,GAAY,CAAC,EAAE,QAAAC,GAAQ,OAAO,CAAA,GAAI,CAAC,GAG5D0C,IAAW,CACpB3C,GACA4C,IAAsB,SAEtBf;AAAA,EACI7B;AAAA,EACAA,EACK,OAAO,CAACG,MAAcA,EAAU,WAAWyC,CAAI,EAC/C,IAAI,CAACzC,OAAe,EAAE,QAAQA,EAAU,QAAQ,OAAO,CAAA,IAAK;AACrE,GAES0C,IAAY,CACrB7C,GACAC,GACAqC,MACqBT,EAAa7B,GAAY,CAAC,EAAE,QAAAC,GAAQ,OAAAqC,GAAO,CAAC,GAExDQ,IAAa,CACtB9C,GACAC,GACA8C,MACqBlB,EAAa7B,GAAY,CAAC,EAAE,QAAAC,GAAQ,OAAO,CAAC8C,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,CAC3BnD,GACAoD,GAEAR,IAAsB,SACX;AACX,QAAMS,IAAU,IAAI,IAAIrD,EAAW,IAAI,CAACG,MAAcA,EAAU,MAAM,CAAC,GACjE+B,IAAOkB,EAAM,OAAO,CAACnD,MAAWoD,EAAQ,IAAIpD,CAAM,KAAKA,MAAW2C,CAAI;AAC5E,SAAO;AAAA,IACH,GAAGV;AAAA,IACH,GAAGlC,EAAW,IAAI,CAACG,MAAcA,EAAU,MAAM,EAAE,OAAO,CAACmD,MAAM,CAACpB,EAAK,SAASoB,CAAC,CAAC;AAAA,EAAA;AAE1F;"}
@@ -0,0 +1,6 @@
1
+ import { createContext as t } from "react";
2
+ const o = t(null);
3
+ export {
4
+ o as SidePanelTabsContext
5
+ };
6
+ //# sourceMappingURL=sidePanelTabsContext.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidePanelTabsContext.js","sources":["../../src/components/sidePanelTabsContext.ts"],"sourcesContent":["import { createContext } from 'react';\n\nexport interface SidePanelTabsContextValue {\n stripSlot: HTMLElement | null;\n scroller: HTMLDivElement | null;\n /** Counts a pinned tab set while mounted; returns the call that uncounts it. */\n registerTabs: () => () => void;\n}\n\nexport const SidePanelTabsContext = createContext<SidePanelTabsContextValue | null>(null);\n"],"names":["SidePanelTabsContext","createContext"],"mappings":";AASO,MAAMA,IAAuBC,EAAgD,IAAI;"}
@@ -0,0 +1,56 @@
1
+ import { jsx as r, Fragment as x } from "react/jsx-runtime";
2
+ import { useId as y, useState as S } from "react";
3
+ import A from "./TabStrip.js";
4
+ const U = ({
5
+ items: o,
6
+ activeKey: e,
7
+ onChange: b,
8
+ trailing: f,
9
+ destroyInactivePanels: a = !1,
10
+ activation: I,
11
+ className: h = "",
12
+ style: k
13
+ }) => {
14
+ const p = y(), s = o.some((n) => n.content !== void 0), [t, m] = S([e]), l = a ? [e] : [
15
+ ...t.filter(
16
+ (n) => n !== e && o.some((d) => d.key === n)
17
+ ),
18
+ e
19
+ ];
20
+ s && (l.length !== t.length || l.some((n) => !t.includes(n))) && m(l);
21
+ const i = (n) => `${p}tab-${encodeURIComponent(n)}`, c = (n) => `${p}panel-${encodeURIComponent(n)}`, u = /* @__PURE__ */ r(
22
+ A,
23
+ {
24
+ items: o,
25
+ activeKey: e,
26
+ onChange: b,
27
+ trailing: f,
28
+ activation: I,
29
+ className: h,
30
+ style: k,
31
+ tabId: s ? i : void 0,
32
+ panelId: s ? c : void 0
33
+ }
34
+ );
35
+ if (!s)
36
+ return { strip: u, panels: null };
37
+ const $ = /* @__PURE__ */ r(x, { children: o.map((n) => {
38
+ const d = n.key === e, g = d || !a && t.includes(n.key);
39
+ return /* @__PURE__ */ r(
40
+ "div",
41
+ {
42
+ id: c(n.key),
43
+ role: "tabpanel",
44
+ "aria-labelledby": i(n.key),
45
+ hidden: !d,
46
+ children: g ? n.content : null
47
+ },
48
+ n.key
49
+ );
50
+ }) });
51
+ return { strip: u, panels: $ };
52
+ };
53
+ export {
54
+ U as useTabStripAndPanels
55
+ };
56
+ //# sourceMappingURL=useTabStripAndPanels.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTabStripAndPanels.js","sources":["../../src/components/useTabStripAndPanels.tsx"],"sourcesContent":["import React, { useId, useState } from 'react';\nimport TabStrip from './TabStrip';\nimport type { TabsProps } from './Tabs';\n\n/** A `Tabs` strip and its panels as two nodes, for a container that places them apart. */\nexport const useTabStripAndPanels = ({\n items,\n activeKey,\n onChange,\n trailing,\n destroyInactivePanels = false,\n activation,\n className = '',\n style,\n}: TabsProps): { strip: React.ReactNode; panels: React.ReactNode } => {\n const baseId = useId();\n const hasPanels = items.some((item) => item.content !== undefined);\n const [visitedKeys, setVisitedKeys] = useState<string[]>([activeKey]);\n // Only what is mounted now, so a removed tab or a stretch of destroyInactivePanels leaves no\n // history to remount from. Recorded during render rather than in an effect, so a newly opened\n // panel and the record of it arrive in the same commit.\n const nextVisitedKeys = destroyInactivePanels\n ? [activeKey]\n : [\n ...visitedKeys.filter(\n (key) => key !== activeKey && items.some((item) => item.key === key),\n ),\n activeKey,\n ];\n if (\n hasPanels &&\n (nextVisitedKeys.length !== visitedKeys.length ||\n nextVisitedKeys.some((key) => !visitedKeys.includes(key)))\n ) {\n setVisitedKeys(nextVisitedKeys);\n }\n // aria-controls and aria-labelledby are space-separated id lists, so a key with a space in it\n // would name two ids.\n const tabId = (key: string) => `${baseId}tab-${encodeURIComponent(key)}`;\n const panelId = (key: string) => `${baseId}panel-${encodeURIComponent(key)}`;\n\n const strip = (\n <TabStrip\n items={items}\n activeKey={activeKey}\n onChange={onChange}\n trailing={trailing}\n activation={activation}\n className={className}\n style={style}\n tabId={hasPanels ? tabId : undefined}\n panelId={hasPanels ? panelId : undefined}\n />\n );\n\n if (!hasPanels) {\n return { strip, panels: null };\n }\n\n // Panels are plain siblings of the strip with no overflow of their own, so a sticky toolbar or\n // table header inside one still pins to the page's scroll container. Every tab gets a panel\n // element, empty until first opened, so each tab's aria-controls always resolves.\n const panels = (\n <>\n {items.map((item) => {\n const isActive = item.key === activeKey;\n const isMounted =\n isActive || (!destroyInactivePanels && visitedKeys.includes(item.key));\n return (\n <div\n key={item.key}\n id={panelId(item.key)}\n role=\"tabpanel\"\n aria-labelledby={tabId(item.key)}\n hidden={!isActive}\n >\n {isMounted ? item.content : null}\n </div>\n );\n })}\n </>\n );\n return { strip, panels };\n};\n"],"names":["useTabStripAndPanels","items","activeKey","onChange","trailing","destroyInactivePanels","activation","className","style","baseId","useId","hasPanels","item","visitedKeys","setVisitedKeys","useState","nextVisitedKeys","key","tabId","panelId","strip","jsx","TabStrip","panels","Fragment","isActive","isMounted"],"mappings":";;;AAKO,MAAMA,IAAuB,CAAC;AAAA,EACjC,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,UAAAC;AAAA,EACA,UAAAC;AAAA,EACA,uBAAAC,IAAwB;AAAA,EACxB,YAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,OAAAC;AACJ,MAAsE;AAClE,QAAMC,IAASC,EAAA,GACTC,IAAYV,EAAM,KAAK,CAACW,MAASA,EAAK,YAAY,MAAS,GAC3D,CAACC,GAAaC,CAAc,IAAIC,EAAmB,CAACb,CAAS,CAAC,GAI9Dc,IAAkBX,IAClB,CAACH,CAAS,IACV;AAAA,IACI,GAAGW,EAAY;AAAA,MACX,CAACI,MAAQA,MAAQf,KAAaD,EAAM,KAAK,CAACW,MAASA,EAAK,QAAQK,CAAG;AAAA,IAAA;AAAA,IAEvEf;AAAA,EAAA;AAEV,EACIS,MACCK,EAAgB,WAAWH,EAAY,UACpCG,EAAgB,KAAK,CAACC,MAAQ,CAACJ,EAAY,SAASI,CAAG,CAAC,MAE5DH,EAAeE,CAAe;AAIlC,QAAME,IAAQ,CAACD,MAAgB,GAAGR,CAAM,OAAO,mBAAmBQ,CAAG,CAAC,IAChEE,IAAU,CAACF,MAAgB,GAAGR,CAAM,SAAS,mBAAmBQ,CAAG,CAAC,IAEpEG,IACF,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACG,OAAArB;AAAA,MACA,WAAAC;AAAA,MACA,UAAAC;AAAA,MACA,UAAAC;AAAA,MACA,YAAAE;AAAA,MACA,WAAAC;AAAA,MACA,OAAAC;AAAA,MACA,OAAOG,IAAYO,IAAQ;AAAA,MAC3B,SAASP,IAAYQ,IAAU;AAAA,IAAA;AAAA,EAAA;AAIvC,MAAI,CAACR;AACD,WAAO,EAAE,OAAAS,GAAO,QAAQ,KAAA;AAM5B,QAAMG,IACF,gBAAAF,EAAAG,GAAA,EACK,UAAAvB,EAAM,IAAI,CAACW,MAAS;AACjB,UAAMa,IAAWb,EAAK,QAAQV,GACxBwB,IACFD,KAAa,CAACpB,KAAyBQ,EAAY,SAASD,EAAK,GAAG;AACxE,WACI,gBAAAS;AAAA,MAAC;AAAA,MAAA;AAAA,QAEG,IAAIF,EAAQP,EAAK,GAAG;AAAA,QACpB,MAAK;AAAA,QACL,mBAAiBM,EAAMN,EAAK,GAAG;AAAA,QAC/B,QAAQ,CAACa;AAAA,QAER,UAAAC,IAAYd,EAAK,UAAU;AAAA,MAAA;AAAA,MANvBA,EAAK;AAAA,IAAA;AAAA,EAStB,CAAC,EAAA,CACL;AAEJ,SAAO,EAAE,OAAAQ,GAAO,QAAAG,EAAA;AACpB;"}
package/dist/index.d.ts CHANGED
@@ -2034,6 +2034,8 @@ export declare interface FilterSearchChange {
2034
2034
  items: string[];
2035
2035
  }
2036
2036
 
2037
+ export declare type FilterSearchControl = 'list' | 'toggle' | 'segmented';
2038
+
2037
2039
  export declare interface FilterSearchFilter {
2038
2040
  value: string;
2039
2041
  label: string;
@@ -2043,6 +2045,8 @@ export declare interface FilterSearchFilter {
2043
2045
  example?: string;
2044
2046
  /** `false` drops the filter's name from its chip, for a value that reads alone: `Configured only`. */
2045
2047
  chipLabel?: boolean;
2048
+ /** Filters panel control: `list` (default) ticks values, `toggle` switches its first item's value, `segmented` picks one or All. */
2049
+ control?: FilterSearchControl;
2046
2050
  items: FilterSearchItem[];
2047
2051
  }
2048
2052
 
@@ -2052,6 +2056,8 @@ export declare interface FilterSearchItem {
2052
2056
  disabled?: boolean;
2053
2057
  /** Drawn before the label in the menu and in the applied chip: a logo, a status dot. Keep it 12px. */
2054
2058
  icon?: ReactNode;
2059
+ /** Drawn at the end of the value's row in the Filters panel: how many results it matches. */
2060
+ count?: number;
2055
2061
  }
2056
2062
 
2057
2063
  export declare interface FilterSearchProps {
@@ -2068,9 +2074,9 @@ export declare interface FilterSearchProps {
2068
2074
  onChange: (next: FilterSearchSelection[], changes: FilterSearchChange[]) => void;
2069
2075
  /** Called when the clear control empties the bar, after `onChange`. */
2070
2076
  onClear?: () => void;
2071
- /** The filter whose values are open, or `null` on the filter list — for loading values lazily. */
2077
+ /** The filter whose values are open, or `null` on the filter list — for loading values lazily. Never called with `filtersButton`, whose panel draws every filter's `items` at once. */
2072
2078
  onActiveFilterChange?: (filter: string | null) => void;
2073
- /** 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. */
2079
+ /** 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 (with `filtersButton`, only by Enter or Escape). */
2074
2080
  onQueryChange?: (query: string) => void;
2075
2081
  /** Lets typed text be committed as its own pill, under a `value` no filter uses. Its selection is `{ filter: textFilter.value, items: [text] }`. */
2076
2082
  textFilter?: {
@@ -2086,8 +2092,8 @@ export declare interface FilterSearchProps {
2086
2092
  /** Chips past this count collapse into `+N`. */
2087
2093
  maxVisibleChips?: number;
2088
2094
  /**
2089
- * Puts a Filters button, with the applied filter count, at the bar's right end. It and the
2090
- * combobox keys open the filter list: clicking the field leaves the menu shut until something is typed.
2095
+ * Puts a Filters button, with the applied filter count, at the bar's right end, and makes it the
2096
+ * only way to filters: the field becomes a plain search box whose Enter pins the text as a `textFilter` pill.
2091
2097
  */
2092
2098
  filtersButton?: boolean;
2093
2099
  className?: string;
@@ -4896,7 +4902,7 @@ export declare const SecurityIcon: React.FC<IconProps_99>;
4896
4902
  * foreground-colour change as well as the thumb, so it does not rest on background
4897
4903
  * colour alone.
4898
4904
  */
4899
- export declare const SegmentedControl: <T extends string = string>({ options, value, onChange, size, fullWidth, disabled, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, }: SegmentedControlProps<T>) => JSX_2.Element;
4905
+ export declare const SegmentedControl: <T extends string = string>({ options, value, onChange, size, fullWidth, disabled, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, className, }: SegmentedControlProps<T>) => JSX_2.Element;
4900
4906
 
4901
4907
  export declare interface SegmentedControlOption<T extends string = string> {
4902
4908
  value: T;
@@ -4922,6 +4928,7 @@ export declare interface SegmentedControlProps<T extends string = string> {
4922
4928
  disabled?: boolean;
4923
4929
  'aria-label'?: string;
4924
4930
  'aria-labelledby'?: string;
4931
+ 'aria-describedby'?: string;
4925
4932
  className?: string;
4926
4933
  }
4927
4934
 
@@ -5179,7 +5186,9 @@ export declare interface SidebarSwitcherProps extends SidebarButtonAttributes {
5179
5186
  * (topmost open overlay only), overlay click or the close button, and exposes header
5180
5187
  * (back/icon/title/subtitle/extra), scrollable body and optional footer slots.
5181
5188
  */
5182
- export declare const SidePanel: default_2.FC<SidePanelProps>;
5189
+ export declare const SidePanel: default_2.FC<SidePanelProps> & {
5190
+ Tabs: typeof SidePanelTabs;
5191
+ };
5183
5192
 
5184
5193
  export declare interface SidePanelAside {
5185
5194
  /** Shown in the aside's header, and names the column for assistive tech. */
@@ -5223,6 +5232,8 @@ export declare interface SidePanelProps {
5223
5232
  description?: default_2.ReactNode;
5224
5233
  /** Pinned between the header and the scrolling body. */
5225
5234
  toolbar?: default_2.ReactNode;
5235
+ /** `body` insets the toolbar 28px, level with the body. Default: `default`. */
5236
+ toolbarPadding?: 'default' | 'body';
5226
5237
  /** Divider under the header. Default: false. */
5227
5238
  headerDivider?: boolean;
5228
5239
  /** Leading header slot, typically a logo or icon. */
@@ -5267,6 +5278,12 @@ export declare interface SidePanelProps {
5267
5278
  children: default_2.ReactNode;
5268
5279
  }
5269
5280
 
5281
+ /** Tabs for anywhere in a `SidePanel` body, with the strip pinned under the header. Arrow keys
5282
+ * open the tab they reach unless `activation` is `manual`. */
5283
+ declare const SidePanelTabs: default_2.FC<SidePanelTabsProps>;
5284
+
5285
+ export declare type SidePanelTabsProps = Pick<TabsProps, 'items' | 'activeKey' | 'onChange' | 'trailing' | 'destroyInactivePanels' | 'activation'>;
5286
+
5270
5287
  export declare const SignOutIcon: React.FC<IconProps_102>;
5271
5288
 
5272
5289
  export declare const Skeleton: {
@@ -5923,6 +5940,8 @@ export declare interface TabsProps {
5923
5940
  * a round trip and its data is not fetched again.
5924
5941
  */
5925
5942
  destroyInactivePanels?: boolean;
5943
+ /** `automatic` opens the tab an arrow key reaches; `manual` only focuses it. Default: `manual`. */
5944
+ activation?: 'manual' | 'automatic';
5926
5945
  className?: string;
5927
5946
  style?: default_2.CSSProperties;
5928
5947
  }