@kolkrabbi/kol-component 0.15.1 → 0.15.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-component",
3
- "version": "0.15.1",
3
+ "version": "0.15.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",
@@ -25,8 +25,15 @@ import { Icon } from '@kolkrabbi/kol-icons'
25
25
  * pairs that flip with the theme, so light/dark comes free from the tokens with
26
26
  * no per-theme props.
27
27
  *
28
- * `size` moves the square and the glyph together one prop, never two — on the
29
- * solo-glyph law (16/20/24 against the pinned squares 28/32/36).
28
+ * `size` moves the square and the glyph together on the solo-glyph ladder
29
+ * (16/20/24 against the pinned squares 28/32/36) — that pairing is the DEFAULT,
30
+ * and it is what every call site should take. `iconSize` unbinds the glyph for
31
+ * the cases the ladder cannot serve, exactly as it does on `Button` and `Input`:
32
+ * a `radius="full"` frame reads heavier than the square it was tuned against (a
33
+ * circle inscribes ~78.5% of its bounding box), so an edge-straddling round
34
+ * control wants a smaller glyph in the same pinned square. The square never
35
+ * moves with it — that is the 2026-07-28 law, and it only means something if the
36
+ * two are separable.
30
37
  *
31
38
  * Deliberately absent: `onClick`, `href`, `disabled`, `aria-pressed`, `title`.
32
39
  * Wanting any of those means wanting a `Button` with `iconOnly`, not this.
@@ -34,6 +41,14 @@ import { Icon } from '@kolkrabbi/kol-icons'
34
41
  * @param {string} name icon name (kol-icons)
35
42
  * @param {string} variant primary|secondary|accent|outline|ghost|nav|grey|danger
36
43
  * @param {string} size sm|md|lg — square + glyph together
44
+ * @param {string} radius sm (default, the system's 4px) | full (9999px).
45
+ * Two values, nothing between: a round frame is its
46
+ * own chrome idiom (edge-straddling controls, avatars),
47
+ * and it is the only sanctioned exception to the hard
48
+ * 4px repo invariant.
49
+ * @param {number} iconSize glyph size in px — overrides the size-derived
50
+ * default. Null (the default) keeps the ladder. The
51
+ * square is unaffected; only the centred glyph moves.
37
52
  * @param {string} className escape hatch
38
53
  */
39
54
  const GLYPH = { sm: 16, md: 20, lg: 24 }
@@ -42,16 +57,20 @@ export default function IconFrame({
42
57
  name,
43
58
  variant = 'secondary',
44
59
  size = 'md',
60
+ radius = 'sm',
61
+ iconSize = null,
45
62
  className = '',
46
63
  ...rest
47
64
  }) {
48
65
  if (!name) return null
66
+ const radiusCls = radius === 'full' ? ' kol-icon-frame-radius-full' : ''
67
+ const resolvedIconSize = iconSize ?? GLYPH[size] ?? GLYPH.md
49
68
  return (
50
69
  <span
51
- className={`kol-icon-frame kol-icon-frame-${variant} kol-icon-frame-${size} ${className}`.trim()}
70
+ className={`kol-icon-frame kol-icon-frame-${variant} kol-icon-frame-${size}${radiusCls} ${className}`.trim()}
52
71
  {...rest}
53
72
  >
54
- <Icon name={name} size={GLYPH[size] ?? GLYPH.md} />
73
+ <Icon name={name} size={resolvedIconSize} />
55
74
  </span>
56
75
  )
57
76
  }