@kolkrabbi/kol-component 0.114.1 → 0.115.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.115.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",
|
|
@@ -56,6 +56,11 @@ import { kindOf as dsKindOf, KIND_LABEL as DS_KIND_LABEL } from '../utilities/me
|
|
|
56
56
|
* @param {number} defaultHeight uncontrolled start height (528); min 240
|
|
57
57
|
* @param {Function} onHeightChange (px) => void — on every drag step; the consumer persists it
|
|
58
58
|
* @param {number} columnWidth every column's start width (260); the preview column starts at 320; min 160
|
|
59
|
+
* @param {Object} columnWidths the CONTROLLED counterpart to `onColumnResize` (ColumnBrowserWidthsPersist,
|
|
60
|
+
* kol-r2b2 2026-08-27): a map keyed by column index plus `'preview'` —
|
|
61
|
+
* `{ 0: 300, 2: 190, preview: 420 }` — the same shape the callback reports,
|
|
62
|
+
* so a consumer hands back what it stored. A key with no column is ignored;
|
|
63
|
+
* any column it does not name falls back to the drag state, then `columnWidth`
|
|
59
64
|
* @param {Function} onColumnResize (index, px) => void — the column's index, or `'preview'`
|
|
60
65
|
* @param {string} className extra classes on the browser
|
|
61
66
|
*/
|
|
@@ -209,6 +214,7 @@ export default function ColumnBrowser({
|
|
|
209
214
|
defaultHeight = 528,
|
|
210
215
|
onHeightChange,
|
|
211
216
|
columnWidth = 260,
|
|
217
|
+
columnWidths,
|
|
212
218
|
onColumnResize,
|
|
213
219
|
className = '',
|
|
214
220
|
}) {
|
|
@@ -217,7 +223,7 @@ export default function ColumnBrowser({
|
|
|
217
223
|
const [ownH, setOwnH] = useState(defaultHeight)
|
|
218
224
|
const h = height ?? ownH
|
|
219
225
|
const [widths, setWidths] = useState({})
|
|
220
|
-
const widthOf = (i) => widths[i] ?? (i === 'preview' ? PREVIEW_W : columnWidth)
|
|
226
|
+
const widthOf = (i) => columnWidths?.[i] ?? widths[i] ?? (i === 'preview' ? PREVIEW_W : columnWidth)
|
|
221
227
|
const dragBase = useRef(null)
|
|
222
228
|
const resizeCol = (i) => (dx) => {
|
|
223
229
|
if (dragBase.current == null) dragBase.current = widthOf(i)
|