@kolkrabbi/kol-component 0.324.0 → 0.325.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.324.0",
3
+ "version": "0.325.0",
4
4
  "description": "The core component library",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -76,7 +76,7 @@ function Rows({ items }) {
76
76
  <Rows items={it.items} />
77
77
  </MenuFlyout>
78
78
  ) : (
79
- <MenuRow disabled={it.disabled} rowClass={cls} onClick={it.onClick} iconLeft={icon} shortcut={trailingOf(it)}>
79
+ <MenuRow href={it.href} disabled={it.disabled} rowClass={cls} onClick={it.onClick} iconLeft={icon} shortcut={trailingOf(it)}>
80
80
  {it.label}
81
81
  </MenuRow>
82
82
  )
@@ -134,15 +134,17 @@ const ROW_BY_SIZE = { xs: 'kol-mono-8 px-2 h-5', sm: 'kol-helper-12 px-2 h-8', m
134
134
  /* `flex`, not `inline-flex` (MenuDropdownItemBlockRow, kol-fxr 2026-10-13): as bare children of a
135
135
  * content-sized (`w-max`) panel, inline rows measured as ONE line — five starters ≈ 795px. A block
136
136
  * row still fills a fixed panel through `w-full` and lets a content-sized one hug its longest label. */
137
- export function MenuRow({ onClick, onPointerEnter, onPointerLeave, disabled, prefix, iconLeft, shortcut, hover = true, height, size = 'sm', rowClass, children }) {
137
+ export function MenuRow({ href, onClick, onPointerEnter, onPointerLeave, disabled, prefix, iconLeft, shortcut, hover = true, height, size = 'sm', rowClass, children }) {
138
+ /* `href` makes the row a real link — cmd/ctrl-click and middle-click open a new tab (DocumentHeader, 2026-10-31);
139
+ * a plain click still runs `onClick` (the app's router), which may preventDefault */
140
+ const Row = href && !disabled ? 'a' : 'button'
138
141
  return (
139
- <button
140
- type="button"
142
+ <Row
143
+ {...(Row === 'a' ? { href, onClick: (e) => { if (e.metaKey || e.ctrlKey || e.shiftKey || e.button === 1) return; onClick?.(e) } } : { type: 'button', onClick })}
141
144
  data-menu-item
142
- onClick={onClick}
143
145
  onPointerEnter={onPointerEnter}
144
146
  onPointerLeave={onPointerLeave}
145
- disabled={disabled}
147
+ disabled={Row === 'button' ? disabled : undefined}
146
148
  role="menuitem"
147
149
  style={height != null ? { height } : undefined}
148
150
  className={`kol-menu-btn w-full ${rowClass ?? ROW_BY_SIZE[size] ?? ROW_BY_SIZE.sm} shrink-0 flex items-center gap-2 text-body ${hover ? 'hover:text-emphasis' : ''} disabled:opacity-40 disabled:cursor-not-allowed text-left`}
@@ -155,7 +157,7 @@ export function MenuRow({ onClick, onPointerEnter, onPointerLeave, disabled, pre
155
157
  * zero layout shift (MenuItemDescenderClip, 2026-08-12). */}
156
158
  <span className="flex-1 truncate leading-normal">{children}</span>
157
159
  {shortcut && <span className="kol-helper-10 text-emphasis shrink-0 inline-flex items-center">{shortcut}</span>}
158
- </button>
160
+ </Row>
159
161
  )
160
162
  }
161
163