@kolkrabbi/kol-component 0.260.0 → 0.262.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 +2 -2
- package/src/atoms/IconToggle.jsx +61 -0
- package/src/index.js +1 -0
- package/src/molecules/MenuItem.jsx +4 -1
- package/src/molecules/OptionRow.jsx +6 -2
- package/src/organisms/MediaLibrary.jsx +28 -32
- package/src/organisms/MediaLibraryPages.jsx +16 -5
- package/src/organisms/ShellSearchOverlay.jsx +19 -7
- package/src/utilities/Popover.jsx +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.262.0",
|
|
4
4
|
"description": "The core component library",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-dom": "^18.3.0 || ^19.0.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@kolkrabbi/kol-icons": "^0.
|
|
41
|
+
"@kolkrabbi/kol-icons": "^0.38.0"
|
|
42
42
|
},
|
|
43
43
|
"files": [
|
|
44
44
|
"src",
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Icon } from '@kolkrabbi/kol-icons'
|
|
2
|
+
import { SOLO } from '../hooks/glyphLadders.js'
|
|
3
|
+
import { Tooltip } from '../utilities/Popover.jsx'
|
|
4
|
+
|
|
5
|
+
/* taxonomy-ok: atom — one control, Icon + the DS Tooltip */
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* IconToggle — an icon-only toggle: the icon is the control, the state is its INK, the name is the
|
|
9
|
+
* tooltip (IconToggle, kol-mirror 2026-10-15 — user: *"why is everything in brackets icon AND TEXT?
|
|
10
|
+
* all of this is also listed in shortcuts so? … because we want to minimise noise"*).
|
|
11
|
+
*
|
|
12
|
+
* The interactive twin of `IconFrame`: no ground, no border, no pressed fill. `IconFrame` has no
|
|
13
|
+
* states by law and `ToggleBracket` is text, so neither fits; `Button pressed` paints the inverted
|
|
14
|
+
* fill, which is the tool-palette idiom and too loud for studio chrome. It owns `.kol-icon-toggle`
|
|
15
|
+
* for the same reason IconFrame owns its classes — nothing of `kol-btn-*` to inherit.
|
|
16
|
+
*
|
|
17
|
+
* Ink on the `oq` ladder (icons-use-oq law): on 96 · off 32 · off-hover 64 · disabled 12;
|
|
18
|
+
* `tone="danger"` puts the ON ink on `--ui-error` (mirror's Lock: a locked view reads as a warning).
|
|
19
|
+
* Square on the size ladder (xs 22 · sm 26 · md 32), glyph on the solo ladder.
|
|
20
|
+
*
|
|
21
|
+
* @param {boolean} pressed state → `aria-pressed`
|
|
22
|
+
* @param {Function} onChange `(next) => void`
|
|
23
|
+
* @param {string} icon icon when off (and on, without `iconOn`)
|
|
24
|
+
* @param {string} [iconOn] icon when on (Lock: `unlock` → `lock`)
|
|
25
|
+
* @param {string} label `aria-label` — required, there is no visible text
|
|
26
|
+
* @param {string} [title] tooltip, default `label` (mirror: "Lock the view (L)")
|
|
27
|
+
* @param {'default'|'danger'} [tone='default']
|
|
28
|
+
* @param {'xs'|'sm'|'md'} [size='sm']
|
|
29
|
+
* @param {boolean} [disabled]
|
|
30
|
+
*/
|
|
31
|
+
export default function IconToggle({
|
|
32
|
+
pressed = false,
|
|
33
|
+
onChange,
|
|
34
|
+
icon,
|
|
35
|
+
iconOn,
|
|
36
|
+
label,
|
|
37
|
+
title,
|
|
38
|
+
tone = 'default',
|
|
39
|
+
size = 'sm',
|
|
40
|
+
disabled = false,
|
|
41
|
+
iconComponent: IconCmp = Icon,
|
|
42
|
+
className = '',
|
|
43
|
+
...rest
|
|
44
|
+
}) {
|
|
45
|
+
const cls = `kol-icon-toggle kol-icon-toggle-${size}${tone === 'danger' ? ' kol-icon-toggle-danger' : ''} ${className}`.trim()
|
|
46
|
+
return (
|
|
47
|
+
<Tooltip label={title ?? label} triggerClassName="inline-flex shrink-0">
|
|
48
|
+
<button
|
|
49
|
+
type="button"
|
|
50
|
+
className={cls}
|
|
51
|
+
aria-pressed={pressed}
|
|
52
|
+
aria-label={label}
|
|
53
|
+
disabled={disabled}
|
|
54
|
+
onClick={() => onChange?.(!pressed)}
|
|
55
|
+
{...rest}
|
|
56
|
+
>
|
|
57
|
+
<IconCmp name={pressed && iconOn ? iconOn : icon} size={SOLO[size] ?? SOLO.sm} />
|
|
58
|
+
</button>
|
|
59
|
+
</Tooltip>
|
|
60
|
+
)
|
|
61
|
+
}
|
package/src/index.js
CHANGED
|
@@ -35,6 +35,7 @@ export { default as DocsToc } from './molecules/DocsToc.jsx'
|
|
|
35
35
|
export { default as DropdownTagFilter } from './molecules/DropdownTagFilter.jsx'
|
|
36
36
|
export { default as EmptyState } from './molecules/EmptyState.jsx'
|
|
37
37
|
export { default as IconFrame } from './atoms/IconFrame.jsx'
|
|
38
|
+
export { default as IconToggle } from './atoms/IconToggle.jsx'
|
|
38
39
|
export { default as ExitPreview } from './utilities/ExitPreview.jsx'
|
|
39
40
|
export { default as Figure } from './atoms/Figure.jsx'
|
|
40
41
|
export { default as FullscreenOverlay } from './utilities/FullscreenOverlay.jsx'
|
|
@@ -21,6 +21,9 @@ import { PopoverPanel, usePopover } from '../utilities/Popover.jsx'
|
|
|
21
21
|
*/
|
|
22
22
|
/* the ladder's tokens, so the touch rung (D5, 2026-09-29) grows the trigger with its row */
|
|
23
23
|
const TRIGGER_H = { xs: 'var(--kol-ctl-xs)', sm: 'var(--kol-ctl-sm)', md: 'var(--kol-ctl-md)', lg: 'var(--kol-ctl-lg)' }
|
|
24
|
+
/* and its type: xs wears its rows' face, as `Button size="xs"` beside it does (MenuItemXsTriggerType,
|
|
25
|
+
* kol-monitor 2026-10-15 — 12px helper type in a 22px box) */
|
|
26
|
+
const TRIGGER_BY_SIZE = { xs: 'kol-mono-8 px-2', sm: 'kol-helper-12 px-3', md: 'kol-helper-12 px-3', lg: 'kol-helper-12 px-3' }
|
|
24
27
|
|
|
25
28
|
export function MenuItem({
|
|
26
29
|
label,
|
|
@@ -61,7 +64,7 @@ export function MenuItem({
|
|
|
61
64
|
ref={popover.refs.setReference}
|
|
62
65
|
{...popover.getReferenceProps()}
|
|
63
66
|
type="button"
|
|
64
|
-
className={`kol-menu-btn
|
|
67
|
+
className={`kol-menu-btn ${TRIGGER_BY_SIZE[size] ?? TRIGGER_BY_SIZE.md} inline-flex items-center gap-2 rounded text-body hover:text-emphasis transition-colors ${buttonClassName}`}
|
|
65
68
|
style={{ height: TRIGGER_H[size] ?? TRIGGER_H.md }}
|
|
66
69
|
>
|
|
67
70
|
<span>{label}</span>
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
* @param {string} as element to render (`div` · `button` · `li`)
|
|
25
25
|
* @param {boolean} hover false = hover paints nothing (the media browser's ruling, 2026-09-02)
|
|
26
26
|
* @param {boolean} muted a row that is there but not the point (fg-48)
|
|
27
|
+
* @param {boolean} disabled a row that is there but cannot be picked: the disabled opacity, no
|
|
28
|
+
* hover, not-allowed — the caller keeps it out of its keyboard order
|
|
27
29
|
*
|
|
28
30
|
* `ROW_HEIGHT` / `ROW_TYPE` / `ROW_FILL` are exported for a row that cannot take this anatomy (the
|
|
29
31
|
* media rows view's table row: twisty, drag hit, columns) — it still sits on the same ramp and fills.
|
|
@@ -60,6 +62,7 @@ export default function OptionRow({
|
|
|
60
62
|
trail = false,
|
|
61
63
|
hover = true,
|
|
62
64
|
muted = false,
|
|
65
|
+
disabled = false,
|
|
63
66
|
icon,
|
|
64
67
|
leading,
|
|
65
68
|
label,
|
|
@@ -69,12 +72,13 @@ export default function OptionRow({
|
|
|
69
72
|
children,
|
|
70
73
|
...rest
|
|
71
74
|
}) {
|
|
72
|
-
const state =
|
|
75
|
+
const state = disabled ? 'text-fg-80 opacity-[var(--kol-opacity-disabled)]'
|
|
76
|
+
: selected ? ROW_FILL.selected : active ? ROW_FILL.active : trail ? ROW_FILL.trail
|
|
73
77
|
: `${muted ? 'text-fg-48' : 'text-fg-80'}${hover ? ` hover:${TONE}` : ''}`
|
|
74
78
|
const lead = leading ?? (icon && <Icon name={icon} size={glyphSize(size)} />)
|
|
75
79
|
return (
|
|
76
80
|
<Tag
|
|
77
|
-
className={`flex items-center gap-2 px-4 border border-transparent ${ROW_HEIGHT[size] ?? ROW_HEIGHT.md} rounded-[var(--kol-radius-sm)] cursor-pointer text-left ${type ?? ROW_TYPE[size] ?? ROW_TYPE.md} transition-colors ${state} ${className}`.trim()}
|
|
81
|
+
className={`flex items-center gap-2 px-4 border border-transparent ${ROW_HEIGHT[size] ?? ROW_HEIGHT.md} rounded-[var(--kol-radius-sm)] ${disabled ? 'cursor-not-allowed' : 'cursor-pointer'} text-left ${type ?? ROW_TYPE[size] ?? ROW_TYPE.md} transition-colors ${state} ${className}`.trim()}
|
|
78
82
|
{...rest}
|
|
79
83
|
>
|
|
80
84
|
{/* the glyph takes the row's ink when selected — a grey mark on a white fill reads as a hole */}
|
|
@@ -2,15 +2,13 @@ import { createContext, useContext, useEffect, useMemo, useState } from 'react'
|
|
|
2
2
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
3
|
import ActionButton from '../molecules/ActionButton.jsx'
|
|
4
4
|
import Button from '../atoms/Button.jsx'
|
|
5
|
-
import CloseButton from '../atoms/CloseButton.jsx'
|
|
6
5
|
import Divider from '../atoms/Divider.jsx'
|
|
7
6
|
import Dropdown from '../molecules/Dropdown.jsx'
|
|
8
7
|
import Input from '../atoms/Input.jsx'
|
|
9
|
-
import SizeOrDownload from '../atoms/SizeOrDownload.jsx'
|
|
10
8
|
import ViewToggle from '../atoms/ViewToggle.jsx'
|
|
11
9
|
import FullscreenOverlay from '../utilities/FullscreenOverlay.jsx'
|
|
12
10
|
import { Tooltip } from '../utilities/Popover.jsx'
|
|
13
|
-
import
|
|
11
|
+
import MediaTile from '../molecules/MediaTile.jsx'
|
|
14
12
|
import ContentRow from '../molecules/ContentRow.jsx'
|
|
15
13
|
import ContentFilters from './ContentFilters.jsx'
|
|
16
14
|
import { MenuItem, MenuDropdownItem, MenuDropdownDivider } from '../molecules/MenuItem.jsx'
|
|
@@ -33,8 +31,8 @@ import { filterMedia } from '../utilities/mediaSearch.js'
|
|
|
33
31
|
* Same contract as kol-dashboards / kol-chess / kol-content.
|
|
34
32
|
*
|
|
35
33
|
* COMPOSED, NOT BUILT. Every part is an existing DS member:
|
|
36
|
-
*
|
|
37
|
-
*
|
|
34
|
+
* MediaTile — the grid tile, preview over name — `picker`'s tile (was ContentCard
|
|
35
|
+
* default until 2026-10-15, MediaLibraryModalTilesBroken)
|
|
38
36
|
* ContentRow — the list row, `variant="default"` (thumb · title · date · size · actions)
|
|
39
37
|
* MediaCard / MediaRow retired 2026-08-26 (ContentSetRetirement);
|
|
40
38
|
* this was the DS's own last composition of them, swapped 2026-08-27
|
|
@@ -711,23 +709,18 @@ function FilesBody({ files, viewMode, onOpen, onPick }) {
|
|
|
711
709
|
</div>
|
|
712
710
|
)
|
|
713
711
|
}
|
|
714
|
-
/* INLINE controls, never labelled Buttons (ContentSetRetirement, 2026-08-27)
|
|
715
|
-
* the
|
|
716
|
-
*
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
* glyph beside Copy. `Use` (picker only) is the same control wearing `plus`. */
|
|
720
|
-
const actionsFor = (row, form) => (
|
|
721
|
-
<div className={form === 'row' ? 'flex items-center gap-2' : 'flex h-full flex-col items-center justify-between'}>
|
|
712
|
+
/* INLINE controls, never labelled Buttons (ContentSetRetirement, 2026-08-27) —
|
|
713
|
+
* the list row's Use · Copy · Download. `Use` (picker only) is the same control
|
|
714
|
+
* wearing `plus`. The grid's tile carries none (see below). */
|
|
715
|
+
const actionsFor = (row) => (
|
|
716
|
+
<div className="flex items-center gap-2">
|
|
722
717
|
{onPick && <ActionButton chrome="inline" size="sm" icon="plus" confirmIcon="check" label="Use" confirmLabel="Used" onAction={() => onPick(row)} />}
|
|
723
718
|
<ActionButton chrome="inline" size="sm" icon="copy" confirmIcon="check" label="Copy URL" confirmLabel="Copied" onAction={() => copy(urlFor(row))} />
|
|
724
|
-
|
|
725
|
-
<ActionButton chrome="inline" size="sm" icon="download" confirmIcon="check" label="Download" confirmLabel="Downloaded" href={urlFor(row)} />
|
|
726
|
-
)}
|
|
719
|
+
<ActionButton chrome="inline" size="sm" icon="download" confirmIcon="check" label="Download" confirmLabel="Downloaded" href={urlFor(row)} />
|
|
727
720
|
</div>
|
|
728
721
|
)
|
|
729
|
-
/* the title voice is the family's ruled default (heading-
|
|
730
|
-
*
|
|
722
|
+
/* the row's title voice is the family's ruled default (heading-05, truncated by
|
|
723
|
+
* ContentText); the tile's is MediaTile's. The full key rides as the tooltip. */
|
|
731
724
|
const nameFor = (row) => <Tooltip label={row.key} asChild><span>{row.displayKey}</span></Tooltip>
|
|
732
725
|
const date = (row) => (row.uploaded ? String(row.uploaded).slice(0, 10) : undefined)
|
|
733
726
|
const size = (row) => formatSize(row.size) || undefined
|
|
@@ -744,24 +737,25 @@ function FilesBody({ files, viewMode, onOpen, onPick }) {
|
|
|
744
737
|
title={nameFor(row)}
|
|
745
738
|
date={date(row)}
|
|
746
739
|
size={size(row)}
|
|
747
|
-
actions={actionsFor(row
|
|
740
|
+
actions={actionsFor(row)}
|
|
748
741
|
/>
|
|
749
742
|
))}
|
|
750
743
|
</div>
|
|
751
744
|
) : (
|
|
752
|
-
|
|
745
|
+
/* THE PICKER'S TILE (MediaLibraryModalTilesBroken, kol-mirror 2026-10-15). The grid wore
|
|
746
|
+
* `ContentCard` default — a heading-04 filename, and an actions column that sat on the size —
|
|
747
|
+
* while `picker`'s grid is `MediaTile`, preview over name (the card was retired from the file
|
|
748
|
+
* grid 2026-09-23 for exactly that). Same item here: a click opens the lightbox, where Use and
|
|
749
|
+
* Copy URL live; a double-click (or Enter) uses the file. */
|
|
750
|
+
<div className="kol-media-grid gap-y-5">
|
|
753
751
|
{files.map((row) => (
|
|
754
|
-
<
|
|
752
|
+
<MediaTile
|
|
755
753
|
key={row.key}
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
}
|
|
761
|
-
title={nameFor(row)}
|
|
762
|
-
date={date(row)}
|
|
763
|
-
size={size(row) && <SizeOrDownload href={urlFor(row)}>{size(row)}</SizeOrDownload>}
|
|
764
|
-
actions={actionsFor(row, 'card')}
|
|
754
|
+
markKey={row.key}
|
|
755
|
+
preview={<div className="w-full h-full flex items-center justify-center bg-fg-04 overflow-hidden"><Thumb row={row} mediaUrl={mediaUrl} /></div>}
|
|
756
|
+
name={nameFor(row)}
|
|
757
|
+
onClick={openerFor(row)}
|
|
758
|
+
onDoubleClick={onPick ? () => onPick(row) : undefined}
|
|
765
759
|
/>
|
|
766
760
|
))}
|
|
767
761
|
</div>
|
|
@@ -1090,7 +1084,9 @@ function PickerBrowse({ client, accept, onClose, onSelect, title = 'MEDIA', ...b
|
|
|
1090
1084
|
return (
|
|
1091
1085
|
/* THE X SITS ON THE HEADER ROW (MediaPickerCloseOnTheHeaderRow, kol-fxr 2026-10-10 — user: *"x
|
|
1092
1086
|
* close is in a weird place, align better"*). The overlay's corner close floated ~100px above
|
|
1093
|
-
* the header and lined up with nothing
|
|
1087
|
+
* the header and lined up with nothing. In the control cluster after the gear it read as one more
|
|
1088
|
+
* control (media-picker-close-and-title, kol-mirror 2026-10-15), so it is the header's own ×:
|
|
1089
|
+
* alone at the far end of the title's row, the drawer's shape. */
|
|
1094
1090
|
<FullscreenOverlay open scrim onClose={onClose} closeButton={false}>
|
|
1095
1091
|
<div className="kol-media-picker gap-4">
|
|
1096
1092
|
<MediaLibraryBrowse
|
|
@@ -1102,7 +1098,7 @@ function PickerBrowse({ client, accept, onClose, onSelect, title = 'MEDIA', ...b
|
|
|
1102
1098
|
settings={settings}
|
|
1103
1099
|
onSettingsChange={setSettings}
|
|
1104
1100
|
onPickFile={setFile}
|
|
1105
|
-
|
|
1101
|
+
onHeaderClose={onClose}
|
|
1106
1102
|
/>
|
|
1107
1103
|
<div className="mt-auto flex items-center justify-end gap-4">
|
|
1108
1104
|
<span className="kol-mono-12 text-fg-48 truncate mr-auto">{file ? file.key : 'Select a file'}</span>
|
|
@@ -8,6 +8,7 @@ import Divider from '../atoms/Divider.jsx'
|
|
|
8
8
|
import Input from '../atoms/Input.jsx'
|
|
9
9
|
import Tag from '../atoms/Tag.jsx'
|
|
10
10
|
import IconFrame from '../atoms/IconFrame.jsx'
|
|
11
|
+
import CloseButton from '../atoms/CloseButton.jsx'
|
|
11
12
|
import ActionButton from '../molecules/ActionButton.jsx'
|
|
12
13
|
import SizeOrDownload from '../atoms/SizeOrDownload.jsx'
|
|
13
14
|
import ToggleCheckbox from '../atoms/ToggleCheckbox.jsx'
|
|
@@ -903,7 +904,7 @@ function TrashPanel({ trash, onClose, run, confirm }) {
|
|
|
903
904
|
)
|
|
904
905
|
}
|
|
905
906
|
|
|
906
|
-
function LibraryHeader({ title, buckets, bucketId, appRoot, onBucket, bucketMeta, writable, headerActions, onSettings, onTrash, onHome, headerTrailing }) {
|
|
907
|
+
function LibraryHeader({ title, buckets, bucketId, appRoot, onBucket, bucketMeta, writable, headerActions, onSettings, onTrash, onHome, headerTrailing, onClose }) {
|
|
907
908
|
/* the app's masthead voice when a Shell sets one (2026-09-29), else the display voice as before */
|
|
908
909
|
const titleCls = mastheadTitleClass(useMasthead(), 'kol-sans-display-03')
|
|
909
910
|
/* ONE BUCKET, NO DROPDOWN (user 2026-09-22) — a picker with one thing in it chooses nothing. */
|
|
@@ -916,12 +917,14 @@ function LibraryHeader({ title, buckets, bucketId, appRoot, onBucket, bucketMeta
|
|
|
916
917
|
<header className="flex items-baseline justify-between gap-4">
|
|
917
918
|
{onHome ? (
|
|
918
919
|
<button type="button" onClick={onHome}
|
|
919
|
-
className={`${titleCls} min-w-0 truncate text-left cursor-pointer transition-opacity hover:opacity-64`}
|
|
920
|
+
className={`${titleCls} text-fg-96 min-w-0 truncate text-left cursor-pointer transition-opacity hover:opacity-64`}
|
|
920
921
|
aria-label={`${title} — back to the top`}>{title}</button>
|
|
921
922
|
) : (
|
|
922
|
-
|
|
923
|
+
/* its own ink (media-picker-close-and-title, kol-mirror 2026-10-15): portalled into a body
|
|
924
|
+
* with no colour, the title inherited black on the dark card */
|
|
925
|
+
<h1 className={`${titleCls} text-fg-96 min-w-0 truncate`}>{title}</h1>
|
|
923
926
|
)}
|
|
924
|
-
<div className=
|
|
927
|
+
<div className={`flex items-center gap-2 min-w-0${onClose ? ' ml-auto' : ''}`}>
|
|
925
928
|
{options.length > 0 && <Dropdown className="min-w-0 max-w-[45vw] md:w-48 md:max-w-none" value={appRoot ? 'all' : bucketId} onChange={onBucket} options={options} />}
|
|
926
929
|
{headerActions}
|
|
927
930
|
{/* The DS's own `Tooltip` (utilities/Popover → `.kol-tooltip`), not a `title`
|
|
@@ -947,6 +950,12 @@ function LibraryHeader({ title, buckets, bucketId, appRoot, onBucket, bucketMeta
|
|
|
947
950
|
* the row directly beneath it. */}
|
|
948
951
|
{headerTrailing}
|
|
949
952
|
</div>
|
|
953
|
+
{/* THE × IS THE CARD'S, NOT A CONTROL (media-picker-close-and-title, kol-mirror 2026-10-15 — user:
|
|
954
|
+
* "you ever seen a close out button before??", pointing at the Display Settings drawer). Alone at
|
|
955
|
+
* the far end of the title's row, outside the control cluster — the drawer's shape. `self-end`, not
|
|
956
|
+
* `self-center`: the row is baseline-aligned, so centring put it on the display wordmark, 10px
|
|
957
|
+
* above the gear (MediaPickerCloseOnControlRow, kol-monitor 2026-10-16). */}
|
|
958
|
+
{onClose && <CloseButton onClick={onClose} className="shrink-0 self-end" />}
|
|
950
959
|
</header>
|
|
951
960
|
)
|
|
952
961
|
}
|
|
@@ -1031,6 +1040,8 @@ export function MediaLibraryBrowse({
|
|
|
1031
1040
|
* rendering what it rendered. */
|
|
1032
1041
|
view: viewProp, onViewChange,
|
|
1033
1042
|
folderTree, headerActions, headerTrailing, refreshKey, onOpen, autoFocus = false, settingsFooter, className = '', banner,
|
|
1043
|
+
/* `onHeaderClose` — a × alone at the far end of the title row, outside the controls (the picker card) */
|
|
1044
|
+
onHeaderClose,
|
|
1034
1045
|
/* `smartFolder` — a smart folder's id to open ON (a Home tile linking straight to one); the chips
|
|
1035
1046
|
* take over from there (media D1 plan v2) */
|
|
1036
1047
|
smartFolder,
|
|
@@ -2341,7 +2352,7 @@ export function MediaLibraryBrowse({
|
|
|
2341
2352
|
return (
|
|
2342
2353
|
<div ref={pageRef} {...press} className={`flex flex-col gap-6 ${className}`.trim()}>
|
|
2343
2354
|
<RowSize.Provider value={rowSize}>
|
|
2344
|
-
<LibraryHeader title={title} buckets={buckets} bucketId={bucketMeta.id} appRoot={atTitleRoot} bucketMeta={bucketMeta} writable={writable} headerActions={headerActions} headerTrailing={headerTrailing} onTrash={trash ? () => setTrashOpen(true) : undefined}
|
|
2355
|
+
<LibraryHeader title={title} buckets={buckets} bucketId={bucketMeta.id} appRoot={atTitleRoot} bucketMeta={bucketMeta} writable={writable} headerActions={headerActions} headerTrailing={headerTrailing} onClose={onHeaderClose} onTrash={trash ? () => setTrashOpen(true) : undefined}
|
|
2345
2356
|
onHome={goTitleRoot}
|
|
2346
2357
|
onBucket={(v) => { if (v === 'all') goTitleRoot(); else { setAppRoot(false); switchBucket(v) } }}
|
|
2347
2358
|
onSettings={onOpenSettings ?? (() => setSettingsOpen(true))} />
|
|
@@ -76,7 +76,7 @@ export function HighlightMatch({ label, query, ranges }) {
|
|
|
76
76
|
*
|
|
77
77
|
* @param {boolean} open mount/unmount the overlay
|
|
78
78
|
* @param {Function} onClose () => void — backdrop click, Escape, post-select
|
|
79
|
-
* @param {Array} results pre-filtered rows: { id, label, group?, hint?, icon? }
|
|
79
|
+
* @param {Array} results pre-filtered rows: { id, label, group?, hint?, icon?, disabled?, disabledHint? }
|
|
80
80
|
* @param {Array} [suggestions] rows shown while the query is empty (same shape) —
|
|
81
81
|
* the search modal opens on somewhere to go, not a blank box
|
|
82
82
|
* @param {string} query controlled query (drives the highlight slice)
|
|
@@ -126,7 +126,14 @@ export default function ShellSearchOverlay({
|
|
|
126
126
|
* index 0 counts as a selection and Enter navigates somewhere unasked. */
|
|
127
127
|
const [navigated, setNavigated] = useState(false)
|
|
128
128
|
const results = groupRows(query ? rawResults : suggestions)
|
|
129
|
-
|
|
129
|
+
/* a `disabled` row is drawn but never active: ↑↓ step over it, Enter and click never reach
|
|
130
|
+
* `onSelect` (ShellSearchDisabledRow, kol-monitor 2026-10-15 — a module with no room on the rack) */
|
|
131
|
+
const clamped = Math.min(activeIndex, results.length - 1)
|
|
132
|
+
const active = clamped >= 0 && !results[clamped].disabled ? clamped : -1
|
|
133
|
+
const step = (from, dir) => {
|
|
134
|
+
for (let i = from + dir; i >= 0 && i < results.length; i += dir) if (!results[i].disabled) return i
|
|
135
|
+
return from
|
|
136
|
+
}
|
|
130
137
|
|
|
131
138
|
/* Focus in on open, restore the opener on close. querySelector instead of
|
|
132
139
|
* a ref through SearchInput — ref-as-prop needs React 19 and the package
|
|
@@ -143,7 +150,7 @@ export default function ShellSearchOverlay({
|
|
|
143
150
|
* suggestions for a category's presets). Keyed on the row ids, not the array's identity, so a
|
|
144
151
|
* consumer passing a fresh array every render does not snap the highlight back to the top. */
|
|
145
152
|
const rowsKey = results.map((r) => r.id).join('\u0000')
|
|
146
|
-
useEffect(() => { setActiveIndex(0); setNavigated(false) }, [query, open, rowsKey])
|
|
153
|
+
useEffect(() => { setActiveIndex(Math.max(0, results.findIndex((r) => !r.disabled))); setNavigated(false) }, [query, open, rowsKey]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
147
154
|
|
|
148
155
|
/* Keep the active row visible inside the scrolling list. */
|
|
149
156
|
useEffect(() => {
|
|
@@ -158,6 +165,7 @@ export default function ShellSearchOverlay({
|
|
|
158
165
|
* still reaches `onSelect`, and the closure stays the consumer's to run there: the overlay running
|
|
159
166
|
* it too would fire it twice in every shell that already does (workshop's tag rows). */
|
|
160
167
|
const select = (item) => {
|
|
168
|
+
if (item?.disabled) return
|
|
161
169
|
onSelect?.(item)
|
|
162
170
|
if (!(item?.keepOpen || typeof item?.action === 'function')) onClose?.()
|
|
163
171
|
}
|
|
@@ -171,11 +179,11 @@ export default function ShellSearchOverlay({
|
|
|
171
179
|
} else if (e.key === 'ArrowDown') {
|
|
172
180
|
e.preventDefault()
|
|
173
181
|
setNavigated(true)
|
|
174
|
-
setActiveIndex((i) => Math.min(i
|
|
182
|
+
setActiveIndex((i) => step(Math.min(i, results.length - 1), 1))
|
|
175
183
|
} else if (e.key === 'ArrowUp') {
|
|
176
184
|
e.preventDefault()
|
|
177
185
|
setNavigated(true)
|
|
178
|
-
setActiveIndex((i) => Math.
|
|
186
|
+
setActiveIndex((i) => step(Math.min(i, results.length - 1), -1))
|
|
179
187
|
} else if (e.key === 'Enter') {
|
|
180
188
|
e.preventDefault()
|
|
181
189
|
/* ⌘ENTER OPENS EVERY HIT (user 2026-09-30: *"enter would focus searched item, and maybe
|
|
@@ -258,6 +266,8 @@ export default function ShellSearchOverlay({
|
|
|
258
266
|
* hint subtext shown when the LABEL was not what matched
|
|
259
267
|
* href a destination; dismisses the search modal
|
|
260
268
|
* action a closure, run by the consumer's `onSelect`; the search modal STAYS OPEN (tag rows)
|
|
269
|
+
* disabled drawn muted, skipped by ↑↓, never reaches `onSelect`; `disabledHint` replaces
|
|
270
|
+
* `hint` with the reason (a full rack: "no room")
|
|
261
271
|
* keepOpen the row selects and the search modal STAYS OPEN — a drill-in (category →
|
|
262
272
|
* its items, a "← All" row back); the consumer swaps `suggestions`/`results`
|
|
263
273
|
* Built by `buildShellSearchItems` (showcase/src/nav/shell-nav.js). */}
|
|
@@ -282,14 +292,16 @@ export default function ShellSearchOverlay({
|
|
|
282
292
|
id={optionId(item)}
|
|
283
293
|
role="option"
|
|
284
294
|
aria-selected={i === active}
|
|
295
|
+
aria-disabled={item.disabled || undefined}
|
|
285
296
|
active={i === active}
|
|
297
|
+
disabled={item.disabled}
|
|
286
298
|
icon={item.icon}
|
|
287
299
|
label={<HighlightMatch label={item.label} query={query} ranges={item.highlights} />}
|
|
288
|
-
hint={item.hint}
|
|
300
|
+
hint={(item.disabled && item.disabledHint) || item.hint}
|
|
289
301
|
/* preventDefault keeps focus in the input through the click */
|
|
290
302
|
onMouseDown={(e) => e.preventDefault()}
|
|
291
303
|
onClick={() => select(item)}
|
|
292
|
-
onMouseEnter={() => { setActiveIndex(i); setNavigated(true) }}
|
|
304
|
+
onMouseEnter={() => { if (!item.disabled) { setActiveIndex(i); setNavigated(true) } }}
|
|
293
305
|
/>
|
|
294
306
|
</li>
|
|
295
307
|
)
|
|
@@ -156,6 +156,9 @@ const TooltipNest = createContext(null)
|
|
|
156
156
|
* element that takes a ref: an intrinsic tag always does; a component only if it forwards one
|
|
157
157
|
* (React 18 needs forwardRef), so Button / IconFrame keep the wrapper. Its own ref and handlers are
|
|
158
158
|
* kept — the reference props merge over the child's. */
|
|
159
|
+
/* `disabled` (HardwareNativeTitle, kol-monitor 2026-10-15): the tooltip stays mounted but never
|
|
160
|
+
* opens — a jack mid-patch. Dropping the label instead would swap the tree and remount the trigger
|
|
161
|
+
* under the pointer. */
|
|
159
162
|
const childRefOf = (el) => ('ref' in (el.props ?? {}) ? el.props.ref : reactVersion.startsWith('18') ? el.ref : undefined)
|
|
160
163
|
|
|
161
164
|
export function Tooltip(props) {
|
|
@@ -173,12 +176,13 @@ function TooltipOn({
|
|
|
173
176
|
children,
|
|
174
177
|
triggerClassName = 'inline-flex',
|
|
175
178
|
asChild = false,
|
|
179
|
+
disabled = false,
|
|
176
180
|
}) {
|
|
177
181
|
const [open, setOpen] = useState(false)
|
|
178
182
|
const [covered, setCovered] = useState(false)
|
|
179
183
|
const parent = useContext(TooltipNest)
|
|
180
184
|
const popover = usePopover({
|
|
181
|
-
open: open && !covered,
|
|
185
|
+
open: open && !covered && !disabled,
|
|
182
186
|
onOpenChange: (v) => { setOpen(v); parent?.(v) },
|
|
183
187
|
placement,
|
|
184
188
|
offset,
|
|
@@ -194,7 +198,7 @@ function TooltipOn({
|
|
|
194
198
|
* trigger's RESOLVED `--kol-tone-*` onto the panel. No tone in effect = nothing copied, and the
|
|
195
199
|
* tooltip keeps its own surface. */
|
|
196
200
|
const [ambient, setAmbient] = useState(null)
|
|
197
|
-
const shown = open && !covered
|
|
201
|
+
const shown = open && !covered && !disabled
|
|
198
202
|
useLayoutEffect(() => {
|
|
199
203
|
const ref = popover.refs.reference.current
|
|
200
204
|
/* the SURROUNDINGS' tone, not the trigger's own: an `asChild` trigger can be a variant button
|