@kolkrabbi/kol-component 0.32.2 → 0.32.4

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.32.2",
3
+ "version": "0.32.4",
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.12.1"
27
+ "@kolkrabbi/kol-icons": "^0.13.0"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "framer-motion": "^12.0.0",
@@ -67,7 +67,8 @@ export function usePopover({
67
67
  if (matchReferenceWidth) {
68
68
  middleware.push(
69
69
  sizeMw({
70
- apply({ rects, elements }) {
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 (
@@ -52,15 +52,17 @@ export function StatusChip({ value, options = [], onChange, size = 'sm' }) {
52
52
  const toneCls = activeOpt?.tone ? ` kol-status-chip--${activeOpt.tone}` : ''
53
53
  /* BUILT ON THE COVER-FOCUS SPECS (user ruling 2026-08-09: "same component
54
54
  * as cover focus"): the chip wears the Dropdown-sm trigger metrics — the
55
- * kol-btn-sm box (py-1 px-3) and mono-12 type as a pill with the tone
56
- * tint. The caret is a direct child of the flex row, centred by
57
- * items-center; it cannot sit off the label's middle. */
55
+ * kol-btn-sm box (py-1 px-3) and mono-12 type at its OWN 16px leading, so
56
+ * the pill stands the trigger's 24px (a leading-none had shrunk it to 20;
57
+ * user re-call same day: "like dropdown small in size"). The caret is a
58
+ * direct child of the flex row, centred by items-center; it cannot sit off
59
+ * the label's middle. */
58
60
  const chip = (interactive) => (
59
61
  <button
60
62
  type="button"
61
63
  disabled={!interactive || undefined}
62
64
  aria-expanded={interactive ? open : undefined}
63
- className={`kol-status-chip${toneCls} kol-mono-12 inline-flex items-center gap-1 rounded-full border-0 px-2 py-1 leading-none${interactive ? ' cursor-pointer' : ''}`}
65
+ className={`kol-status-chip${toneCls} kol-mono-12 inline-flex items-center gap-1 rounded-full border-0 px-3 py-1${interactive ? ' cursor-pointer' : ''}`}
64
66
  onClick={interactive ? () => setOpen((o) => !o) : undefined}
65
67
  >
66
68
  {activeOpt?.label ?? value}