@kolkrabbi/kol-component 0.343.0 → 0.344.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/package.json +3 -3
- package/src/organisms/CommandOverlay.jsx +113 -118
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.344.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"pdfjs-dist": "^6.3.289",
|
|
31
31
|
"react-syntax-highlighter": "^16.1.1",
|
|
32
32
|
"@kolkrabbi/kol-search": "^0.3.0",
|
|
33
|
-
"@kolkrabbi/kol-
|
|
34
|
-
"@kolkrabbi/kol-
|
|
33
|
+
"@kolkrabbi/kol-growth": "^0.5.0",
|
|
34
|
+
"@kolkrabbi/kol-markdown": "^0.2.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@kolkrabbi/kol-icons": ">=0.61.1",
|
|
@@ -2,8 +2,7 @@ import { useEffect, useId, useRef, useState } from 'react'
|
|
|
2
2
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
3
|
import SearchInput from '../molecules/SearchInput.jsx'
|
|
4
4
|
import Tag from '../atoms/Tag.jsx'
|
|
5
|
-
import
|
|
6
|
-
import OptionRow from '../molecules/OptionRow.jsx'
|
|
5
|
+
import TabsRow from '../molecules/TabsRow.jsx'
|
|
7
6
|
import Button from '../atoms/Button.jsx'
|
|
8
7
|
import { floatSurfaceClass } from '../utilities/tone.js'
|
|
9
8
|
import { floatMotion } from '../utilities/motion.js'
|
|
@@ -14,6 +13,9 @@ import { shortcutInScope } from './ShortcutsOverlay.jsx'
|
|
|
14
13
|
* geometry — the p-2 inset, then the md control's 1px ring + 16px pad — so
|
|
15
14
|
* every glyph and word lines up under the field's icon and caret. */
|
|
16
15
|
|
|
16
|
+
/* the foot's rule runs the card's full width: out through the card's inset, the hints 12 in from the rows' edge */
|
|
17
|
+
const RULE = { margin: '6px calc(-1 * var(--kol-float-inset)) calc(-1 * var(--kol-float-inset))', paddingInline: 'calc(var(--kol-float-inset) + 12px)' }
|
|
18
|
+
|
|
17
19
|
/* Rows bucketed by `group` in first-seen order, rank kept inside a group —
|
|
18
20
|
* one heading per group; arrows rove this order, not the engine's. */
|
|
19
21
|
function groupRows(rows) {
|
|
@@ -152,10 +154,17 @@ function unfold(rows, opened) {
|
|
|
152
154
|
* @param {string} [selectLabel] the footer's Enter line while a row is highlighted (default
|
|
153
155
|
* `Go to page`) — a modal whose rows are not pages says what
|
|
154
156
|
* Enter does instead (the rack's module search: `Add module`)
|
|
155
|
-
* @param {'solid'|'glass-dark'|'glass-light'} [surface]
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* the
|
|
157
|
+
* @param {'solid'|'glass-dark'|'glass-light'} [surface='solid'] ONE SEARCH STYLE (plan-2026-11-05-float-editor 7.7, his
|
|
158
|
+
* frame float-more 30:914 — *"anchored search (along with same style regular search)"*):
|
|
159
|
+
* every search modal is the float card — RailTrigger's (`kol-more-sheet-float` on
|
|
160
|
+
* `--kol-float-menu-r`, the float surface and shadow), the float SearchInput, the float
|
|
161
|
+
* rows (Inter, `--kol-float-row`, the lit row fg-16, the hint right), eyebrow groups, and
|
|
162
|
+
* the key-hint foot under a full-width rule. `surface` only picks what the card is made of
|
|
163
|
+
* @param {Array} [tabs] `[{ id, label }]` — his All · Actions · Tools · Pages: the first shows every row, the
|
|
164
|
+
* rest the rows whose `tab` is their id. Tab / ⇧Tab step through them from the field
|
|
165
|
+
* @param {Object|Element} [anchor] a ref (or element) the card ANCHORS ABOVE — the dock's ⌘K: the card takes the anchor's
|
|
166
|
+
* left and width, 16 over its top, the page undimmed. Unset, the card is centred
|
|
167
|
+
* @param {string} [shortcutHint] the field's key cap while it is empty (his `⌘K`)
|
|
159
168
|
* @param {boolean|Object} [motion=true] with `surface`, the card fades and scales in and out over a fading scrim, held in
|
|
160
169
|
* the tree while it leaves (FloatActionStatesAndMotion, 2026-11-04): `true` the
|
|
161
170
|
* `--kol-float-*` tokens · `false` none · `{ duration, ease }` per app
|
|
@@ -187,10 +196,13 @@ export default function CommandOverlay({
|
|
|
187
196
|
mode = 'search',
|
|
188
197
|
shortcuts = [],
|
|
189
198
|
currentPath,
|
|
190
|
-
surface,
|
|
199
|
+
surface = 'solid',
|
|
200
|
+
tabs,
|
|
201
|
+
anchor,
|
|
202
|
+
shortcutHint,
|
|
191
203
|
motion = true,
|
|
192
204
|
}) {
|
|
193
|
-
const float =
|
|
205
|
+
const float = true
|
|
194
206
|
const fm = floatMotion(motion)
|
|
195
207
|
const presence = useFloatPresence(open, float ? fm.ms : 0)
|
|
196
208
|
const exit = float && presence.exiting ? '' : undefined
|
|
@@ -209,7 +221,21 @@ export default function CommandOverlay({
|
|
|
209
221
|
if (mode === 'go') mode = 'search'
|
|
210
222
|
const placeholder = placeholderProp ?? MODE_PLACEHOLDER[mode] ?? 'Search…'
|
|
211
223
|
const selectLabel = selectLabelProp ?? MODE_LABEL[mode] ?? 'Go to page'
|
|
212
|
-
const
|
|
224
|
+
const [tab, setTab] = useState(null)
|
|
225
|
+
const tabNow = tabs?.some((t) => t.id === tab) ? tab : tabs?.[0]?.id
|
|
226
|
+
const inTab = (r) => !tabs || (tabNow === tabs[0].id ? !r.tabOnly : r.tab === tabNow)
|
|
227
|
+
const base = mode === 'shortcuts' ? shortcutFolds(shortcuts, currentPath) : groupRows((query ? rawResults : suggestions).filter(inTab))
|
|
228
|
+
/* the anchored card: the anchor's left and width, 16 over its top — read as it draws (a hidden first frame could not
|
|
229
|
+
* take the focus), and again on resize */
|
|
230
|
+
const [, reflow] = useState(0)
|
|
231
|
+
useEffect(() => {
|
|
232
|
+
if (!open || !anchor) return undefined
|
|
233
|
+
const on = () => reflow((n) => n + 1)
|
|
234
|
+
window.addEventListener('resize', on)
|
|
235
|
+
return () => window.removeEventListener('resize', on)
|
|
236
|
+
}, [open, anchor])
|
|
237
|
+
const anchorRect = presence.mounted && anchor ? (anchor.current ?? anchor)?.getBoundingClientRect?.() : null
|
|
238
|
+
const place = anchorRect ? { left: anchorRect.left, width: anchorRect.width, bottom: window.innerHeight - anchorRect.top + 16 } : null
|
|
213
239
|
const results = unfold(base, opened)
|
|
214
240
|
/* a `disabled` row is drawn but never active: ↑↓ step over it, Enter and click never reach
|
|
215
241
|
* `onSelect` (ShellSearchDisabledRow, kol-monitor 2026-10-15 — a module with no room on the rack) */
|
|
@@ -228,7 +254,7 @@ export default function CommandOverlay({
|
|
|
228
254
|
const prev = document.activeElement
|
|
229
255
|
;(panelRef.current?.querySelector('input') ?? panelRef.current)?.focus()
|
|
230
256
|
setOpened(new Set(base.filter((r) => r.items && r.open).map((r) => r.id)))
|
|
231
|
-
return () => { setOpened(new Set()); if (prev instanceof HTMLElement) prev.focus() }
|
|
257
|
+
return () => { setOpened(new Set()); setTab(null); if (prev instanceof HTMLElement) prev.focus() }
|
|
232
258
|
}, [open])
|
|
233
259
|
|
|
234
260
|
/* Roving row resets to the top on every query change / reopen — and when the ROWS change under an
|
|
@@ -237,7 +263,7 @@ export default function CommandOverlay({
|
|
|
237
263
|
* consumer passing a fresh array every render does not snap the highlight back to the top. */
|
|
238
264
|
/* the BASE rows, not the unfolded ones: opening a category must not throw the highlight back to the top */
|
|
239
265
|
const rowsKey = base.map((r) => r.id).join('\u0000')
|
|
240
|
-
useEffect(() => { setActiveIndex(Math.max(0, results.findIndex((r) => !r.disabled))); setNavigated(false) }, [query, open, rowsKey]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
266
|
+
useEffect(() => { setActiveIndex(Math.max(0, results.findIndex((r) => !r.disabled))); setNavigated(false) }, [query, open, rowsKey, tabNow]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
241
267
|
|
|
242
268
|
/* Keep the active row visible inside the scrolling list. */
|
|
243
269
|
useEffect(() => {
|
|
@@ -313,22 +339,33 @@ export default function CommandOverlay({
|
|
|
313
339
|
if (active >= 0) select(results[active])
|
|
314
340
|
else onExpand?.()
|
|
315
341
|
} else if (e.key === 'Tab') {
|
|
316
|
-
/* Focus trap — the input is the search modal's only tab stop
|
|
342
|
+
/* Focus trap — the input is the search modal's only tab stop; with `tabs`, Tab / ⇧Tab step through them */
|
|
317
343
|
e.preventDefault()
|
|
344
|
+
if (tabs?.length) {
|
|
345
|
+
const at = tabs.findIndex((t) => t.id === tabNow)
|
|
346
|
+
setTab(tabs[(at + (e.shiftKey ? -1 : 1) + tabs.length) % tabs.length].id)
|
|
347
|
+
}
|
|
318
348
|
}
|
|
319
349
|
}
|
|
320
350
|
|
|
351
|
+
/* the foot's hints — his "↑↓ Navigate · ↵ Run · Esc Close"; Enter's word names what Enter does NOW */
|
|
352
|
+
const enterWord = results.length > 0
|
|
353
|
+
? (results[active]?.fold ? (opened.has(results[active].id) ? 'Collapse' : 'Expand') : noField ? 'Collapse' : selectLabel)
|
|
354
|
+
: enterLabel
|
|
355
|
+
const hint = 'flex items-center gap-1.5 text-oq-64'
|
|
356
|
+
const hintBtn = `${hint} hover:text-fg-emphasis transition-colors cursor-pointer`
|
|
357
|
+
|
|
321
358
|
return (
|
|
322
|
-
<div className=
|
|
359
|
+
<div className={`fixed inset-0 ${place ? '' : 'flex items-start justify-center pt-[20vh]'}`} style={{ zIndex: 'var(--kol-z-modal, 100)', ...fm.style }}>
|
|
323
360
|
{/* A BUTTON, not a div (OverlayScrimTapDismiss, 2026-09-01): iOS Safari
|
|
324
361
|
* does not bubble tap-clicks from non-interactive elements, so the div's
|
|
325
362
|
* onClick never fired on a phone and the only way out was the close
|
|
326
363
|
* control. A button always fires — and it ends the other half of the
|
|
327
|
-
* defect, an interactive target carrying `aria-hidden`. */}
|
|
364
|
+
* defect, an interactive target carrying `aria-hidden`. Anchored, the page stays undimmed. */}
|
|
328
365
|
<button
|
|
329
366
|
type="button"
|
|
330
367
|
aria-label="Close search"
|
|
331
|
-
className={`absolute inset-0
|
|
368
|
+
className={`absolute inset-0 ${place ? 'cursor-default' : 'kol-overlay-scrim kol-float-fade'}`}
|
|
332
369
|
data-exit={exit}
|
|
333
370
|
onClick={onClose}
|
|
334
371
|
/>
|
|
@@ -341,7 +378,9 @@ export default function CommandOverlay({
|
|
|
341
378
|
aria-modal="true"
|
|
342
379
|
aria-label="Search"
|
|
343
380
|
data-exit={exit}
|
|
344
|
-
|
|
381
|
+
data-side={place ? 'top' : undefined}
|
|
382
|
+
style={place ? { position: 'fixed', left: place.left, width: place.width, bottom: place.bottom } : undefined}
|
|
383
|
+
className={`kol-command kol-more-sheet kol-more-sheet-float kol-float-chrome kol-float-motion ${floatSurfaceClass(surface, true)} overflow-hidden ${place ? '' : `relative w-full mx-4 ${expanded ? 'max-w-[var(--kol-content-panel)]' : 'max-w-xl'}`} ${noField ? 'outline-none' : ''}`.replace(/\s+/g, ' ').trim()}
|
|
345
384
|
>
|
|
346
385
|
{/* THE MODE, said out loud (user 2026-08-01: "how do you set search
|
|
347
386
|
* mode? theres no helper, message or mode clearly readble"). Two
|
|
@@ -349,34 +388,36 @@ export default function CommandOverlay({
|
|
|
349
388
|
* to a destination) — and the only signal was whether chips happened
|
|
350
389
|
* to be present. The chips ARE the mode, so they get a label. */}
|
|
351
390
|
{chips.length > 0 && (
|
|
352
|
-
<div className="flex flex-wrap items-center gap-1.5 px-
|
|
353
|
-
<span className="kol-
|
|
391
|
+
<div className="flex flex-wrap items-center gap-1.5 px-3 pt-2 pb-1">
|
|
392
|
+
<span className="kol-float-label text-oq-64 shrink-0">Filtering by</span>
|
|
354
393
|
{chips.map((t) => (
|
|
355
394
|
<Tag key={t} onRemove={() => onRemoveChip?.(t)}>{t}</Tag>
|
|
356
395
|
))}
|
|
357
396
|
</div>
|
|
358
397
|
)}
|
|
359
|
-
{/* A REAL FIELD, inset in the panel (2026-09-30, shadcn's search modal as
|
|
360
|
-
* the aim) — the flush `bare` strip read as a hole, not a control. */}
|
|
361
|
-
{!noField && (
|
|
362
|
-
<div className={`${float ? '' : 'kol-tone-grey '}p-2 flex items-center gap-2`}>
|
|
363
398
|
{/* THE BACK ARROW TAKES THE SEARCH GLYPH'S SLOT (user 2026-10-18: *"why would the back move the input?!"*) —
|
|
364
399
|
* a button beside the field shrank it and shifted the caret on every drill-in */}
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
400
|
+
{!noField && (
|
|
401
|
+
<SearchInput
|
|
402
|
+
className="w-full min-w-0"
|
|
403
|
+
value={query}
|
|
404
|
+
onChange={(e) => onQueryChange?.(e.target.value)}
|
|
405
|
+
placeholder={chips.length > 0 ? 'Narrow these results…' : placeholder}
|
|
406
|
+
onKeyDown={handleKeyDown}
|
|
407
|
+
onBack={back}
|
|
408
|
+
backLabel={backLabel}
|
|
409
|
+
shortcutHint={shortcutHint}
|
|
410
|
+
variant="float"
|
|
411
|
+
size="lg"
|
|
412
|
+
role="combobox"
|
|
413
|
+
aria-expanded={results.length > 0}
|
|
414
|
+
aria-controls={listId}
|
|
415
|
+
aria-activedescendant={active >= 0 ? optionId(results[active]) : undefined}
|
|
416
|
+
/>
|
|
417
|
+
)}
|
|
418
|
+
{/* his tabs — All · Actions · Tools · Pages — the float TabsRow under the field */}
|
|
419
|
+
{tabs?.length > 0 && !expanded && (
|
|
420
|
+
<TabsRow variant="float" size="md" tabs={tabs} value={tabNow} onChange={setTab} className="pt-2" />
|
|
380
421
|
)}
|
|
381
422
|
|
|
382
423
|
{/* WHY THIS IS NOT `molecules/Dropdown` (asked 2026-08-01). Dropdown is
|
|
@@ -384,14 +425,14 @@ export default function CommandOverlay({
|
|
|
384
425
|
* options. This is a COMBOBOX — a text query filtering a live list
|
|
385
426
|
* whose rows carry a `group`, a `hint`, and may fire an `action`
|
|
386
427
|
* instead of selecting a value. Same ARIA family, different control.
|
|
387
|
-
* Folding one into the other would mean giving Dropdown a query, a
|
|
388
|
-
* hint slot and an action escape hatch, i.e. building this inside it.
|
|
389
428
|
*
|
|
390
|
-
* THE ROW CONTRACT
|
|
429
|
+
* THE ROW CONTRACT:
|
|
391
430
|
* label the row's text, match-highlighted against the query
|
|
392
|
-
* group section heading the row files under — 'Atoms', '
|
|
431
|
+
* group section heading the row files under — 'Atoms', 'Recent', 'Pages'
|
|
432
|
+
* tab the `tabs` id it shows under (every row shows under the first); `tabOnly` — only under its own
|
|
433
|
+
* (an empty Actions tab lists every action, which All leaves to Recent)
|
|
393
434
|
* icon optional leading glyph (kol-icons name)
|
|
394
|
-
* hint
|
|
435
|
+
* hint the right-hand line — a key, a page, what matched when the LABEL did not
|
|
395
436
|
* href a destination; dismisses the search modal
|
|
396
437
|
* action a closure, run by the consumer's `onSelect`; the search modal STAYS OPEN (tag rows)
|
|
397
438
|
* disabled drawn muted, skipped by ↑↓, never reaches `onSelect`; `disabledHint` replaces
|
|
@@ -400,106 +441,60 @@ export default function CommandOverlay({
|
|
|
400
441
|
* its items, a "← All" row back); the consumer swaps `suggestions`/`results`
|
|
401
442
|
* Built by `buildShellSearchItems` (showcase/src/nav/shell-nav.js). */}
|
|
402
443
|
{expanded ? (
|
|
403
|
-
<div className="border-t border-fg-08 max-h-[70vh] overflow-y-auto">{children}</div>
|
|
444
|
+
<div className="border-t border-fg-08 max-h-[70vh] overflow-y-auto" style={RULE}>{children}</div>
|
|
404
445
|
) : results.length > 0 && (
|
|
405
446
|
/* FIXED BODY HEIGHT — the panel holds still while the list narrows. */
|
|
406
|
-
<ul
|
|
407
|
-
ref={listRef}
|
|
408
|
-
id={listId}
|
|
409
|
-
role="listbox"
|
|
410
|
-
className={float ? 'h-80 overflow-y-auto' : `kol-tone-grey h-80 overflow-y-auto px-2 pb-2${noField ? ' pt-2' : ''}`}
|
|
411
|
-
>
|
|
447
|
+
<ul ref={listRef} id={listId} role="listbox" className="h-80 overflow-y-auto">
|
|
412
448
|
{results.map((item, i) => {
|
|
413
449
|
const heading = (item.group ?? '') !== (results[i - 1]?.group ?? '') || i === 0
|
|
414
450
|
return (
|
|
415
451
|
<li key={item.id} role="presentation">
|
|
416
452
|
{heading && item.group && (
|
|
417
453
|
/* the rail's eyebrow (user 2026-10-18: *"sections shoudl be uppercase eyebrow like in siderail"*) */
|
|
418
|
-
<p className=
|
|
454
|
+
<p className="kol-eyebrow text-oq-64 px-3 pt-3 pb-2">{item.group}</p>
|
|
419
455
|
)}
|
|
420
|
-
{float
|
|
421
|
-
|
|
422
|
-
<Button
|
|
423
|
-
id={optionId(item)}
|
|
424
|
-
role="option"
|
|
425
|
-
aria-selected={i === active}
|
|
426
|
-
aria-disabled={item.disabled || undefined}
|
|
427
|
-
tabIndex={-1}
|
|
428
|
-
variant="nav"
|
|
429
|
-
size="lg"
|
|
430
|
-
className={`kol-btn-float w-full justify-start${i === active ? ' kol-btn-pressed' : ''}`}
|
|
431
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
432
|
-
onClick={() => select(item)}
|
|
433
|
-
onMouseEnter={() => { if (!item.disabled) { setActiveIndex(i); setNavigated(true) } }}
|
|
434
|
-
>
|
|
435
|
-
{/* the glyph drawn here, not as `iconLeft` — Button would wrap it and the label in a span that does not take the row */}
|
|
436
|
-
<span className="flex min-w-0 flex-1 items-center" style={{ gap: 'var(--kol-float-gap-ic)' }}>
|
|
437
|
-
{item.indent ? <span className="inline-block w-4 shrink-0" /> : item.icon && <Icon name={item.icon} size="var(--kol-float-ic)" className="shrink-0" />}
|
|
438
|
-
<span className="truncate text-left"><HighlightMatch label={item.label} query={query} ranges={item.highlights} /></span>
|
|
439
|
-
{((item.disabled && item.disabledHint) || item.hint) && <span className="kol-float-hint ml-auto truncate text-oq-64">{(item.disabled && item.disabledHint) || item.hint}</span>}
|
|
440
|
-
</span>
|
|
441
|
-
</Button>
|
|
442
|
-
) : (
|
|
443
|
-
<OptionRow
|
|
456
|
+
{/* the float row: RailTrigger's card row, lit on the float selection while it is the cursor */}
|
|
457
|
+
<Button
|
|
444
458
|
id={optionId(item)}
|
|
445
459
|
role="option"
|
|
446
460
|
aria-selected={i === active}
|
|
447
461
|
aria-disabled={item.disabled || undefined}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
leading={item.indent ? <span className="inline-block w-4" /> : undefined}
|
|
453
|
-
label={<HighlightMatch label={item.label} query={query} ranges={item.highlights} />}
|
|
454
|
-
hint={(item.disabled && item.disabledHint) || item.hint}
|
|
455
|
-
/* preventDefault keeps focus in the input through the click */
|
|
462
|
+
tabIndex={-1}
|
|
463
|
+
variant="nav"
|
|
464
|
+
size="lg"
|
|
465
|
+
className={`kol-btn-float w-full justify-start${i === active ? ' kol-btn-pressed' : ''}${item.disabled ? ' opacity-40' : ''}`}
|
|
456
466
|
onMouseDown={(e) => e.preventDefault()}
|
|
457
467
|
onClick={() => select(item)}
|
|
458
468
|
onMouseEnter={() => { if (!item.disabled) { setActiveIndex(i); setNavigated(true) } }}
|
|
459
|
-
|
|
460
|
-
|
|
469
|
+
>
|
|
470
|
+
{/* the glyph drawn here, not as `iconLeft` — Button would wrap it and the label in a span that does not take the row */}
|
|
471
|
+
<span className="flex min-w-0 flex-1 items-center" style={{ gap: 'var(--kol-float-gap-ic)' }}>
|
|
472
|
+
{item.indent ? <span className="inline-block w-4 shrink-0" /> : item.icon && (typeof item.icon === 'string' ? <Icon name={item.icon} size="var(--kol-float-ic)" className="shrink-0 text-oq-88" /> : item.icon)}
|
|
473
|
+
<span className="truncate text-left"><HighlightMatch label={item.label} query={query} ranges={item.highlights} /></span>
|
|
474
|
+
{((item.disabled && item.disabledHint) || item.hint) && <span className="kol-float-hint ml-auto truncate pl-3 text-oq-64">{(item.disabled && item.disabledHint) || item.hint}</span>}
|
|
475
|
+
</span>
|
|
476
|
+
</Button>
|
|
461
477
|
</li>
|
|
462
478
|
)
|
|
463
479
|
})}
|
|
464
480
|
</ul>
|
|
465
481
|
)}
|
|
466
|
-
{/* THE
|
|
482
|
+
{/* THE FOOT — his key hints under a rule that runs the card's full width; it always says what Enter does. */}
|
|
467
483
|
{!expanded && (results.length > 0 || (query && (enterLabel || onOpenResults))) && (
|
|
468
|
-
<div className="border-t border-fg-08 py-
|
|
469
|
-
{
|
|
470
|
-
|
|
471
|
-
{(
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
{/* the second action on the same line, right — ⌘↵, the footer's idiom for "the other one" */}
|
|
479
|
-
{folds.length > 0 && !query && (
|
|
480
|
-
<button
|
|
481
|
-
type="button"
|
|
482
|
-
className="ml-auto flex items-center gap-2 text-fg-48 hover:text-fg-default transition-colors cursor-pointer"
|
|
483
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
484
|
-
onClick={toggleAll}
|
|
485
|
-
>
|
|
486
|
-
<Kbd icon="command"><Icon name="corner-down-left" size={12} /></Kbd>
|
|
487
|
-
{allOpen ? 'Collapse all' : 'Expand all'}
|
|
488
|
-
</button>
|
|
489
|
-
)}
|
|
490
|
-
</p>
|
|
484
|
+
<div className="kol-float-hint flex flex-wrap items-center gap-x-5 gap-y-1 border-t border-fg-08 py-3 pointer-coarse:min-h-11" style={RULE}>
|
|
485
|
+
{results.length > 1 && <span className={hint}><span aria-hidden>↑↓</span>Navigate</span>}
|
|
486
|
+
{enterWord && <span className={hint}><span aria-hidden>↵</span>{enterWord}</span>}
|
|
487
|
+
<button type="button" className={hintBtn} onMouseDown={(e) => e.preventDefault()} onClick={onClose}><span aria-hidden>Esc</span>Close</button>
|
|
488
|
+
{/* ⌘↵ — the other one: every fold open or shut, or THE RESULTS LINK (user 2026-10-01: *"make 'all
|
|
489
|
+
* results...' at the bottom also be a link to the results page"*) — the door ⌘Enter opens */}
|
|
490
|
+
{folds.length > 0 && !query && (
|
|
491
|
+
<button type="button" className={`${hintBtn} ml-auto`} onMouseDown={(e) => e.preventDefault()} onClick={toggleAll}>
|
|
492
|
+
<span aria-hidden>⌘↵</span>{allOpen ? 'Collapse all' : 'Expand all'}
|
|
493
|
+
</button>
|
|
491
494
|
)}
|
|
492
|
-
{/* THE RESULTS LINE IS A LINK (user 2026-10-01: *"make 'all results...' at the bottom
|
|
493
|
-
* also be a link to the results page"*) — the same door ⌘Enter opens. */}
|
|
494
495
|
{query && onOpenResults && (
|
|
495
|
-
<button
|
|
496
|
-
|
|
497
|
-
className="flex items-center gap-2 kol-helper-12 text-fg-48 hover:text-fg-default transition-colors mx-2 px-4 border-x border-transparent pt-1"
|
|
498
|
-
onMouseDown={(e) => e.preventDefault()}
|
|
499
|
-
onClick={() => { onOpenResults(query); onClose?.() }}
|
|
500
|
-
>
|
|
501
|
-
<Kbd icon="command"><Icon name="corner-down-left" size={12} /></Kbd>
|
|
502
|
-
{resultsLabel}
|
|
496
|
+
<button type="button" className={`${hintBtn} ml-auto min-w-0`} onMouseDown={(e) => e.preventDefault()} onClick={() => { onOpenResults(query); onClose?.() }}>
|
|
497
|
+
<span aria-hidden>⌘↵</span><span className="truncate">{resultsLabel}</span>
|
|
503
498
|
</button>
|
|
504
499
|
)}
|
|
505
500
|
</div>
|