@kolkrabbi/kol-component 0.192.0 → 0.193.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.193.0",
|
|
4
4
|
"description": "KOL design-system components — atoms through organisms, emitting canonical kol-* classes. Pairs with @kolkrabbi/kol-theme for styling.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -77,6 +77,11 @@ const Dropdown = ({
|
|
|
77
77
|
* while a row is hovered would otherwise leave the consumer previewing
|
|
78
78
|
* forever. It never fires while closed — a closed dropdown has no rows. */
|
|
79
79
|
onOptionHover,
|
|
80
|
+
/* OPTIONS may carry more than `{ value, label }`: `icon` puts a glyph in the
|
|
81
|
+
* row's line box (ADJACENT ladder — it sits beside a label), and `shortcut`
|
|
82
|
+
* prints on every row that is NOT the current one, the tick taking that slot
|
|
83
|
+
* when it is. Both were added for the tool-palette idiom and are general —
|
|
84
|
+
* a menu of tools and a menu of anything else want the same two columns. */
|
|
80
85
|
/* ICON-ONLY TRIGGER — an icon name, or a pre-rendered node dropped in where
|
|
81
86
|
* the glyph goes. The trigger becomes the pinned square (`kol-btn-icon`) at
|
|
82
87
|
* the current size, with no label, no ghost widths and no caret; the panel
|
|
@@ -259,8 +264,25 @@ const Dropdown = ({
|
|
|
259
264
|
onPointerEnter={onOptionHover ? () => reportHover(option.value) : undefined}
|
|
260
265
|
onPointerLeave={onOptionHover ? () => reportHover(null) : undefined}
|
|
261
266
|
onClick={() => handleSelect(option)}
|
|
262
|
-
|
|
267
|
+
/* The active row's mark is the CHECK, always — it is what says
|
|
268
|
+
* which value is current, and nothing may take that slot from
|
|
269
|
+
* it. An option's own `shortcut` shows on the rows that are
|
|
270
|
+
* not current, which is the tool-palette idiom: the keystroke
|
|
271
|
+
* that would arm this variant, replaced by the tick once it
|
|
272
|
+
* is armed (editor-set-is-behind-its-source, 2026-09-03). */
|
|
273
|
+
shortcut={
|
|
274
|
+
isActive
|
|
275
|
+
? <Icon name="check" size={resolvedSize === 'xs' ? indicatorSize('xs') : 11} />
|
|
276
|
+
: option.shortcut
|
|
277
|
+
}
|
|
263
278
|
>
|
|
279
|
+
{/* an option's leading glyph — the ADJACENT ladder, because it
|
|
280
|
+
* sits in a line box beside a label, never the solo rung */}
|
|
281
|
+
{option.icon && (
|
|
282
|
+
<span className="shrink-0 inline-flex items-center" style={{ marginRight: 'var(--kol-spacing-2)' }}>
|
|
283
|
+
<Icon name={option.icon} size={glyphSize(resolvedSize)} />
|
|
284
|
+
</span>
|
|
285
|
+
)}
|
|
264
286
|
{option.label}
|
|
265
287
|
</MenuDropdownItem>
|
|
266
288
|
)
|
|
@@ -30,6 +30,22 @@ import { glyphSize } from '../hooks/glyphLadders.js'
|
|
|
30
30
|
* For a text-trigger single-select use `Dropdown`; for the two-button
|
|
31
31
|
* action-half + chevron-half split use `ShapeDropdown`.
|
|
32
32
|
*
|
|
33
|
+
* WHY THIS IS STILL ITS OWN COMPONENT, after `Dropdown` grew the icon-only
|
|
34
|
+
* square trigger it was asked to (2026-09-03, `editor-set-is-behind-its-
|
|
35
|
+
* source`). The ticket's premise — *"it hand-rolls a `<button>` re-emitting
|
|
36
|
+
* Button's classes"* — is gone: since 0.182.0 this wears
|
|
37
|
+
* `kol-btn-icon kol-btn-{size}`, the same class output at the same rungs, so
|
|
38
|
+
* there is no second implementation of the box left to collapse. What remains
|
|
39
|
+
* is ONE behaviour Dropdown does not have and should not grow for one caller:
|
|
40
|
+
* a click on the trigger both ARMS the last-picked variant and opens the menu,
|
|
41
|
+
* so a tool is selected and re-pickable in one gesture. Dropdown is a
|
|
42
|
+
* controlled select — its trigger opens, it does not choose — and giving it an
|
|
43
|
+
* `onTriggerClick` seam to serve this would be a seam for exactly one consumer.
|
|
44
|
+
* Two components, one class output, one popover utility, one glyph ladder: the
|
|
45
|
+
* duplication the ticket named is closed, and the difference that is left is
|
|
46
|
+
* real. What DID move to Dropdown is the part that generalises — per-option
|
|
47
|
+
* `icon` and `shortcut` rows, which any menu wants.
|
|
48
|
+
*
|
|
33
49
|
* @param {Object} props
|
|
34
50
|
* @param {{id: string, label: string, icon: string, shortcut?: string}[]} props.variants - Variants: menu rows + trigger glyph
|
|
35
51
|
* @param {string} props.value - Active variant id (controlled)
|