@kolkrabbi/kol-component 0.32.1 → 0.32.3
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/Popover.jsx +8 -1
- package/src/molecules/Dropdown.jsx +12 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.3",
|
|
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",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@floating-ui/react": "^0.27.19",
|
|
25
25
|
"embla-carousel-react": "^8.6.0",
|
|
26
26
|
"react-syntax-highlighter": "^16.1.1",
|
|
27
|
-
"@kolkrabbi/kol-icons": "0.
|
|
27
|
+
"@kolkrabbi/kol-icons": "^0.13.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"framer-motion": "^12.0.0",
|
package/src/atoms/Popover.jsx
CHANGED
|
@@ -67,7 +67,8 @@ export function usePopover({
|
|
|
67
67
|
if (matchReferenceWidth) {
|
|
68
68
|
middleware.push(
|
|
69
69
|
sizeMw({
|
|
70
|
-
|
|
70
|
+
padding: 8,
|
|
71
|
+
apply({ rects, elements, availableHeight }) {
|
|
71
72
|
/* FLOOR again, not exact (2026-08-09 evening, user: "if you have
|
|
72
73
|
* to truncate 'centered' then its too narrow" — overrides the
|
|
73
74
|
* morning's exact-width reading of the one-piece ruling for the
|
|
@@ -81,8 +82,14 @@ export function usePopover({
|
|
|
81
82
|
* row. Letting the panel size itself was the broken middle: an
|
|
82
83
|
* abs-positioned float with auto width sizes against available
|
|
83
84
|
* space, not content. Sole consumer is Dropdown. */
|
|
85
|
+
/* VIEWPORT CLAMP (2026-08-09, kol-ds-fxr lobby ticket): flip is
|
|
86
|
+
* off on Dropdown (fused edge), so a long list (the labs 30-item
|
|
87
|
+
* "Add FX…" picker) otherwise renders past the viewport bottom.
|
|
88
|
+
* Cap the panel to the space below the trigger; .kol-dd-list
|
|
89
|
+
* scrolls inside (panel is a flex column in kol-theme). */
|
|
84
90
|
Object.assign(elements.floating.style, {
|
|
85
91
|
width: `${rects.reference.width}px`,
|
|
92
|
+
maxHeight: `${Math.max(0, Math.floor(availableHeight))}px`,
|
|
86
93
|
})
|
|
87
94
|
},
|
|
88
95
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
1
|
+
import { useEffect, useRef, useState } from 'react'
|
|
2
2
|
import { Icon } from '@kolkrabbi/kol-icons'
|
|
3
3
|
import { MenuDropdownItem } from './MenuItem.jsx'
|
|
4
4
|
import { PopoverPanel, usePopover } from '../atoms/Popover.jsx'
|
|
@@ -79,6 +79,16 @@ const Dropdown = ({
|
|
|
79
79
|
|
|
80
80
|
const currentOption = options.find((opt) => opt.value === value) || options[0]
|
|
81
81
|
|
|
82
|
+
/* A clamped list (Popover caps the panel to the viewport) can open with the
|
|
83
|
+
* checked row past the fold — scroll it into reach. Keyboard focus after
|
|
84
|
+
* that scrolls natively; the list's children are the option buttons 1:1. */
|
|
85
|
+
const listRef = useRef(null)
|
|
86
|
+
useEffect(() => {
|
|
87
|
+
if (!isOpen) return
|
|
88
|
+
const idx = options.findIndex((opt) => opt.value === currentOption?.value)
|
|
89
|
+
listRef.current?.children[idx]?.scrollIntoView({ block: 'nearest' })
|
|
90
|
+
}, [isOpen]) // eslint-disable-line react-hooks/exhaustive-deps
|
|
91
|
+
|
|
82
92
|
const triggerCls = [
|
|
83
93
|
'kol-btn',
|
|
84
94
|
/* grey is dropdown-only chrome (2026-07-15) — no kol-btn-* class so it
|
|
@@ -125,7 +135,7 @@ const Dropdown = ({
|
|
|
125
135
|
>
|
|
126
136
|
{(resolvedVariant === 'primary' || resolvedVariant === 'grey') && <div className="kol-dd-div" />}
|
|
127
137
|
|
|
128
|
-
<div className="kol-dd-list" role="listbox">
|
|
138
|
+
<div ref={listRef} className="kol-dd-list" role="listbox">
|
|
129
139
|
{options.map((option) => {
|
|
130
140
|
const isActive = option.value === currentOption?.value
|
|
131
141
|
return (
|