@kolkrabbi/kol-component 0.123.0 → 0.124.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.124.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",
|
|
@@ -47,6 +47,20 @@ const Dropdown = ({
|
|
|
47
47
|
size,
|
|
48
48
|
variant = 'primary',
|
|
49
49
|
tone = 'default',
|
|
50
|
+
/* DropdownGhostWidthAndListHeight (kol-mirror 2026-08-28 — user, on the
|
|
51
|
+
* studio's 30-option Source picker in a ~300px shelf: "1 it's way too tall,
|
|
52
|
+
* 2 it's not fitting"):
|
|
53
|
+
* `maxRows` how many rows the panel shows before the list scrolls
|
|
54
|
+
* (default 10). Popover's size middleware clamps the panel to
|
|
55
|
+
* the VIEWPORT, which does nothing for a 30-row slab opened at
|
|
56
|
+
* the top of a tall page — and its inline maxHeight cannot be
|
|
57
|
+
* overridden from a consumer stylesheet, so the ceiling is ours.
|
|
58
|
+
* `rowHeight` the row pitch (number = px, or any CSS length) for a chrome
|
|
59
|
+
* whose own rows are shorter than the h-8 rung. Inline on the
|
|
60
|
+
* row, because `h-8` is a utility and a rule cannot out-rank it.
|
|
61
|
+
* Both write variables on the panel that `.kol-dd-list` reads. */
|
|
62
|
+
maxRows = 10,
|
|
63
|
+
rowHeight,
|
|
50
64
|
defaultOpen = false,
|
|
51
65
|
className = ''
|
|
52
66
|
}) => {
|
|
@@ -108,7 +122,7 @@ const Dropdown = ({
|
|
|
108
122
|
].filter(Boolean).join(' ')
|
|
109
123
|
|
|
110
124
|
return (
|
|
111
|
-
<div className={`relative inline-block align-middle ${className}`}>
|
|
125
|
+
<div className={`kol-dd-root relative inline-block align-middle ${className}`}>
|
|
112
126
|
<button
|
|
113
127
|
ref={popover.refs.setReference}
|
|
114
128
|
{...popover.getReferenceProps()}
|
|
@@ -139,6 +153,10 @@ const Dropdown = ({
|
|
|
139
153
|
panel={false}
|
|
140
154
|
focus={false}
|
|
141
155
|
className={`kol-dd-panel kol-dd-panel--${resolvedVariant} ${toneClass(tone)}`.trim()}
|
|
156
|
+
style={{
|
|
157
|
+
'--kol-dd-max-rows': maxRows ?? 10,
|
|
158
|
+
...(rowHeight != null ? { '--kol-dd-row-h': typeof rowHeight === 'number' ? `${rowHeight}px` : rowHeight } : null),
|
|
159
|
+
}}
|
|
142
160
|
>
|
|
143
161
|
{(resolvedVariant === 'primary' || resolvedVariant === 'grey') && <div className="kol-dd-div" />}
|
|
144
162
|
|
|
@@ -155,6 +173,7 @@ const Dropdown = ({
|
|
|
155
173
|
* all — and this was the last one left, the option row's ink
|
|
156
174
|
* brighten. The check mark is what marks the current value. */
|
|
157
175
|
hover={false}
|
|
176
|
+
height={rowHeight}
|
|
158
177
|
onClick={() => handleSelect(option)}
|
|
159
178
|
shortcut={isActive ? <Icon name="check" size={11} /> : undefined}
|
|
160
179
|
>
|
|
@@ -79,6 +79,11 @@ export function MenuItem({
|
|
|
79
79
|
/**
|
|
80
80
|
* MenuDropdownItem — action row inside a MenuItem's dropdown panel.
|
|
81
81
|
*
|
|
82
|
+
* `height` (default none — the `h-8` rung) — an inline row height, for a panel
|
|
83
|
+
* in a chrome whose own rows are shorter (DropdownGhostWidthAndListHeight,
|
|
84
|
+
* kol-mirror 2026-08-28: its controls sit in 24px rows and the DS row was a
|
|
85
|
+
* third taller). Inline because `h-8` is a utility and a rule cannot out-rank it.
|
|
86
|
+
*
|
|
82
87
|
* `hover` (default true) — `false` drops the ink brighten, for a panel ruled
|
|
83
88
|
* to carry NO hover state at all (user 2026-08-28, on `Dropdown`: "delete any
|
|
84
89
|
* hover state on dropdowns"). Scoped to the caller: a MenuItem's own menu keeps
|
|
@@ -94,7 +99,7 @@ export function MenuItem({
|
|
|
94
99
|
* - children — main label, flex-1.
|
|
95
100
|
* - shortcut — trailing content (text shortcut hint, ✓ marker, or icon).
|
|
96
101
|
*/
|
|
97
|
-
export function MenuDropdownItem({ onClick, disabled, prefix, iconLeft, shortcut, hover = true, children }) {
|
|
102
|
+
export function MenuDropdownItem({ onClick, disabled, prefix, iconLeft, shortcut, hover = true, height, children }) {
|
|
98
103
|
return (
|
|
99
104
|
<button
|
|
100
105
|
type="button"
|
|
@@ -102,6 +107,7 @@ export function MenuDropdownItem({ onClick, disabled, prefix, iconLeft, shortcut
|
|
|
102
107
|
onClick={onClick}
|
|
103
108
|
disabled={disabled}
|
|
104
109
|
role="menuitem"
|
|
110
|
+
style={height != null ? { height } : undefined}
|
|
105
111
|
className={`w-full kol-helper-12 px-3 h-8 shrink-0 inline-flex items-center gap-2 text-body ${hover ? 'hover:text-emphasis' : ''} disabled:opacity-40 disabled:cursor-not-allowed text-left`}
|
|
106
112
|
>
|
|
107
113
|
{prefix && <span className="shrink-0 inline-flex items-center">{prefix}</span>}
|