@kolkrabbi/kol-component 0.15.2 → 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 +1 -1
- package/src/atoms/IconFrame.jsx +15 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-component",
|
|
3
|
-
"version": "0.15.
|
|
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",
|
package/src/atoms/IconFrame.jsx
CHANGED
|
@@ -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
|
|
29
|
-
*
|
|
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.
|
|
@@ -39,6 +46,9 @@ import { Icon } from '@kolkrabbi/kol-icons'
|
|
|
39
46
|
* own chrome idiom (edge-straddling controls, avatars),
|
|
40
47
|
* and it is the only sanctioned exception to the hard
|
|
41
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.
|
|
42
52
|
* @param {string} className escape hatch
|
|
43
53
|
*/
|
|
44
54
|
const GLYPH = { sm: 16, md: 20, lg: 24 }
|
|
@@ -48,17 +58,19 @@ export default function IconFrame({
|
|
|
48
58
|
variant = 'secondary',
|
|
49
59
|
size = 'md',
|
|
50
60
|
radius = 'sm',
|
|
61
|
+
iconSize = null,
|
|
51
62
|
className = '',
|
|
52
63
|
...rest
|
|
53
64
|
}) {
|
|
54
65
|
if (!name) return null
|
|
55
66
|
const radiusCls = radius === 'full' ? ' kol-icon-frame-radius-full' : ''
|
|
67
|
+
const resolvedIconSize = iconSize ?? GLYPH[size] ?? GLYPH.md
|
|
56
68
|
return (
|
|
57
69
|
<span
|
|
58
70
|
className={`kol-icon-frame kol-icon-frame-${variant} kol-icon-frame-${size}${radiusCls} ${className}`.trim()}
|
|
59
71
|
{...rest}
|
|
60
72
|
>
|
|
61
|
-
<Icon name={name} size={
|
|
73
|
+
<Icon name={name} size={resolvedIconSize} />
|
|
62
74
|
</span>
|
|
63
75
|
)
|
|
64
76
|
}
|