@kolkrabbi/kol-component 0.339.0 → 0.340.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.340.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"embla-carousel-react": "^8.6.0",
|
|
30
30
|
"pdfjs-dist": "^6.3.289",
|
|
31
31
|
"react-syntax-highlighter": "^16.1.1",
|
|
32
|
-
"@kolkrabbi/kol-
|
|
32
|
+
"@kolkrabbi/kol-search": "^0.3.0",
|
|
33
33
|
"@kolkrabbi/kol-markdown": "^0.2.0",
|
|
34
|
-
"@kolkrabbi/kol-
|
|
34
|
+
"@kolkrabbi/kol-growth": "^0.5.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@kolkrabbi/kol-icons": ">=0.61.1",
|
|
@@ -4,6 +4,8 @@ import SearchInput from '../molecules/SearchInput.jsx'
|
|
|
4
4
|
import Tag from '../atoms/Tag.jsx'
|
|
5
5
|
import Kbd from '../atoms/Kbd.jsx'
|
|
6
6
|
import OptionRow from '../molecules/OptionRow.jsx'
|
|
7
|
+
import Button from '../atoms/Button.jsx'
|
|
8
|
+
import { floatSurfaceClass } from '../utilities/tone.js'
|
|
7
9
|
import { shortcutInScope } from './ShortcutsOverlay.jsx'
|
|
8
10
|
|
|
9
11
|
/* ONE COLUMN (2026-09-30): rows, headings and footer sit on the field's own
|
|
@@ -148,6 +150,10 @@ function unfold(rows, opened) {
|
|
|
148
150
|
* @param {string} [selectLabel] the footer's Enter line while a row is highlighted (default
|
|
149
151
|
* `Go to page`) — a modal whose rows are not pages says what
|
|
150
152
|
* Enter does instead (the rack's module search: `Add module`)
|
|
153
|
+
* @param {'solid'|'glass-dark'|'glass-light'} [surface] the float look (FloatSearchAndPanels, 2026-11-04): the card
|
|
154
|
+
* is RailTrigger's (`kol-more-sheet-float` on `--kol-float-menu-r`, the float surface and
|
|
155
|
+
* shadow), the field the float SearchInput, the rows float Buttons (Inter, `--kol-float-row`,
|
|
156
|
+
* the lit row fg-16). Unset, the search modal is drawn as before. FloatLayout's `search` passes its own
|
|
151
157
|
*/
|
|
152
158
|
export default function CommandOverlay({
|
|
153
159
|
open,
|
|
@@ -176,7 +182,9 @@ export default function CommandOverlay({
|
|
|
176
182
|
mode = 'search',
|
|
177
183
|
shortcuts = [],
|
|
178
184
|
currentPath,
|
|
185
|
+
surface,
|
|
179
186
|
}) {
|
|
187
|
+
const float = surface != null
|
|
180
188
|
const panelRef = useRef(null)
|
|
181
189
|
const listRef = useRef(null)
|
|
182
190
|
const listId = useId()
|
|
@@ -322,7 +330,7 @@ export default function CommandOverlay({
|
|
|
322
330
|
role="dialog"
|
|
323
331
|
aria-modal="true"
|
|
324
332
|
aria-label="Search"
|
|
325
|
-
className={`kol-overlay-panel mx-4 ${noField ? 'outline-none ' : ''}${expanded ? 'max-w-[var(--kol-content-panel)]' : 'max-w-lg'}`}
|
|
333
|
+
className={`${float ? `kol-more-sheet kol-more-sheet-float kol-float-chrome ${floatSurfaceClass(surface, true)} relative w-full overflow-hidden` : 'kol-overlay-panel'} mx-4 ${noField ? 'outline-none ' : ''}${expanded ? 'max-w-[var(--kol-content-panel)]' : 'max-w-lg'}`}
|
|
326
334
|
>
|
|
327
335
|
{/* THE MODE, said out loud (user 2026-08-01: "how do you set search
|
|
328
336
|
* mode? theres no helper, message or mode clearly readble"). Two
|
|
@@ -340,7 +348,7 @@ export default function CommandOverlay({
|
|
|
340
348
|
{/* A REAL FIELD, inset in the panel (2026-09-30, shadcn's search modal as
|
|
341
349
|
* the aim) — the flush `bare` strip read as a hole, not a control. */}
|
|
342
350
|
{!noField && (
|
|
343
|
-
<div className=
|
|
351
|
+
<div className={`${float ? '' : 'kol-tone-grey '}p-2 flex items-center gap-2`}>
|
|
344
352
|
{/* THE BACK ARROW TAKES THE SEARCH GLYPH'S SLOT (user 2026-10-18: *"why would the back move the input?!"*) —
|
|
345
353
|
* a button beside the field shrank it and shifted the caret on every drill-in */}
|
|
346
354
|
<SearchInput
|
|
@@ -351,6 +359,7 @@ export default function CommandOverlay({
|
|
|
351
359
|
onKeyDown={handleKeyDown}
|
|
352
360
|
onBack={back}
|
|
353
361
|
backLabel={backLabel}
|
|
362
|
+
variant={float ? 'float' : undefined}
|
|
354
363
|
role="combobox"
|
|
355
364
|
aria-expanded={results.length > 0}
|
|
356
365
|
aria-controls={listId}
|
|
@@ -387,7 +396,7 @@ export default function CommandOverlay({
|
|
|
387
396
|
ref={listRef}
|
|
388
397
|
id={listId}
|
|
389
398
|
role="listbox"
|
|
390
|
-
className={`kol-tone-grey h-80 overflow-y-auto px-2 pb-2${noField ? ' pt-2' : ''}`}
|
|
399
|
+
className={float ? 'h-80 overflow-y-auto' : `kol-tone-grey h-80 overflow-y-auto px-2 pb-2${noField ? ' pt-2' : ''}`}
|
|
391
400
|
>
|
|
392
401
|
{results.map((item, i) => {
|
|
393
402
|
const heading = (item.group ?? '') !== (results[i - 1]?.group ?? '') || i === 0
|
|
@@ -395,8 +404,31 @@ export default function CommandOverlay({
|
|
|
395
404
|
<li key={item.id} role="presentation">
|
|
396
405
|
{heading && item.group && (
|
|
397
406
|
/* the rail's eyebrow (user 2026-10-18: *"sections shoudl be uppercase eyebrow like in siderail"*) */
|
|
398
|
-
<p className=
|
|
407
|
+
<p className={`kol-eyebrow text-fg-80 ${float ? 'px-3' : 'px-4 border-x border-transparent'} pt-3 pb-2`}>{item.group}</p>
|
|
399
408
|
)}
|
|
409
|
+
{float ? (
|
|
410
|
+
/* the float row: RailTrigger's card row, lit on the float selection while it is the cursor */
|
|
411
|
+
<Button
|
|
412
|
+
id={optionId(item)}
|
|
413
|
+
role="option"
|
|
414
|
+
aria-selected={i === active}
|
|
415
|
+
aria-disabled={item.disabled || undefined}
|
|
416
|
+
tabIndex={-1}
|
|
417
|
+
variant="nav"
|
|
418
|
+
size="lg"
|
|
419
|
+
className={`kol-btn-float w-full justify-start${i === active ? ' kol-btn-pressed' : ''}`}
|
|
420
|
+
onMouseDown={(e) => e.preventDefault()}
|
|
421
|
+
onClick={() => select(item)}
|
|
422
|
+
onMouseEnter={() => { if (!item.disabled) { setActiveIndex(i); setNavigated(true) } }}
|
|
423
|
+
>
|
|
424
|
+
{/* the glyph drawn here, not as `iconLeft` — Button would wrap it and the label in a span that does not take the row */}
|
|
425
|
+
<span className="flex min-w-0 flex-1 items-center" style={{ gap: 'var(--kol-float-gap-ic)' }}>
|
|
426
|
+
{item.indent ? <span className="inline-block w-4 shrink-0" /> : item.icon && <Icon name={item.icon} size="var(--kol-float-ic)" className="shrink-0" />}
|
|
427
|
+
<span className="truncate text-left"><HighlightMatch label={item.label} query={query} ranges={item.highlights} /></span>
|
|
428
|
+
{((item.disabled && item.disabledHint) || item.hint) && <span className="kol-float-hint ml-auto truncate text-oq-64">{(item.disabled && item.disabledHint) || item.hint}</span>}
|
|
429
|
+
</span>
|
|
430
|
+
</Button>
|
|
431
|
+
) : (
|
|
400
432
|
<OptionRow
|
|
401
433
|
id={optionId(item)}
|
|
402
434
|
role="option"
|
|
@@ -414,6 +446,7 @@ export default function CommandOverlay({
|
|
|
414
446
|
onClick={() => select(item)}
|
|
415
447
|
onMouseEnter={() => { if (!item.disabled) { setActiveIndex(i); setNavigated(true) } }}
|
|
416
448
|
/>
|
|
449
|
+
)}
|
|
417
450
|
</li>
|
|
418
451
|
)
|
|
419
452
|
})}
|
|
@@ -104,7 +104,8 @@ import NavRailFloat from './NavRailFloat.jsx'
|
|
|
104
104
|
* region between the mark and the pinned bottom rows, so a list longer than the window scrolls
|
|
105
105
|
* and runs out under the fade instead of being cut by the edge. `false` draws the list plain.
|
|
106
106
|
* @param {{ current: Function }} [toggleRef] the app and site rails fill it with their expand ↔ collapse toggle — the
|
|
107
|
-
* frame's `\` key (useRailKeys, 2026-11-04) presses it
|
|
107
|
+
* frame's `\` key (useRailKeys, 2026-11-04) presses it. The app rail's also carries `open` and `snap(open)`, so AppShell
|
|
108
|
+
* can bring it back from a hide as it was
|
|
108
109
|
*/
|
|
109
110
|
const RAIL_W = '--kol-shell-rail-width'
|
|
110
111
|
const CLOSED = 48
|
|
@@ -160,7 +161,10 @@ function useRailDrag(railRef, grabRef, onSnap, snapRef, enabled = true) {
|
|
|
160
161
|
const report = (w) => { const on = w >= RAIL_LABELS; if (on !== labelled) { labelled = on; onSnap(on) } }
|
|
161
162
|
const snapTo = (w) => {
|
|
162
163
|
gsap.to(root, { [RAIL_W]: `${w}px`, ...GRAB.snap, overwrite: 'auto' })
|
|
163
|
-
|
|
164
|
+
/* a snap always reports — a remount (StrictMode's second effect, AppShell's show-as-it-was) can leave this closure's
|
|
165
|
+
* `labelled` behind the rail's state, and a deduped report then never closed it */
|
|
166
|
+
labelled = w >= RAIL_LABELS
|
|
167
|
+
onSnap(labelled)
|
|
164
168
|
}
|
|
165
169
|
/* the ONLY way out of this effect (RailSectionPressOpensRail, kol-fxr
|
|
166
170
|
* 2026-08-30). `snapTo` closes over the animation and the CLOSED/open
|
|
@@ -407,7 +411,7 @@ function AppRail({
|
|
|
407
411
|
useGrabEdge(grabRef)
|
|
408
412
|
useRailDrag(railRef, grabRef, setRailOpen, snapOpenRef, !drawer)
|
|
409
413
|
/* the frame's `\` key (useRailKeys) — the grab strip's own click: expanded ↔ collapsed */
|
|
410
|
-
if (toggleRef) toggleRef.current = () => snapOpenRef.current?.(!railOpen)
|
|
414
|
+
if (toggleRef) toggleRef.current = Object.assign(() => snapOpenRef.current?.(!railOpen), { open: railOpen, snap: (o) => snapOpenRef.current?.(o) })
|
|
411
415
|
if (hidden) return null
|
|
412
416
|
const enterMode = (sections === 'fold' ? 'expand' : sections) === 'enter'
|
|
413
417
|
const enters = (item) => enterMode && !!item.sub?.some((s) => s.sub?.length > 0)
|