@kolkrabbi/kol-framework 0.5.1 → 0.5.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/ThemeToggle.jsx +12 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kolkrabbi/kol-framework",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"description": "KOL app shell — sidenav, layout, theme toggle, footer, heroes + brand color layer. SideNav takes nav data as props so the tree stays app-local.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/src/ThemeToggle.jsx
CHANGED
|
@@ -5,9 +5,10 @@ import { useTheme } from './theme.js'
|
|
|
5
5
|
* Theme toggle — horizontal icon-swap button.
|
|
6
6
|
*
|
|
7
7
|
* Variants:
|
|
8
|
-
* icon —
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* icon — icon-only button on the DS button ladder: `size` 'sm'|'md'|'lg'
|
|
9
|
+
* → 14/16/18px glyph, square box + quiet states from the
|
|
10
|
+
* .kol-btn-nav chrome (theme ≥0.11.4), so the toggle sits flush
|
|
11
|
+
* with sibling navigation buttons in a bar.
|
|
11
12
|
* hop — full-width labeled Button-primary-styled sidenav row
|
|
12
13
|
* (bg-fg-04, on-primary text). For sidenav rows where it pairs
|
|
13
14
|
* with other Button-primary "hop" entries.
|
|
@@ -22,7 +23,7 @@ import { useTheme } from './theme.js'
|
|
|
22
23
|
* horizontally — the split-circle glyph makes the slide itself read as
|
|
23
24
|
* the flip (same-icon slide, per design).
|
|
24
25
|
*/
|
|
25
|
-
export default function ThemeToggle({ variant = 'icon', className = '' }) {
|
|
26
|
+
export default function ThemeToggle({ variant = 'icon', size = 'md', className = '' }) {
|
|
26
27
|
const { isDark, toggle } = useTheme()
|
|
27
28
|
|
|
28
29
|
const next = isDark ? 'light' : 'dark'
|
|
@@ -69,17 +70,20 @@ export default function ThemeToggle({ variant = 'icon', className = '' }) {
|
|
|
69
70
|
)
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
// variant === 'icon' (default) —
|
|
73
|
-
// (
|
|
73
|
+
// variant === 'icon' (default) — geometry from the DS button ladder
|
|
74
|
+
// (sm 14 / md 16 / lg 18 glyph), chrome = ghost icon-only .kol-btn.
|
|
75
|
+
// Overrules the 2026-07-15 "36×36/20 reference" one-off (user ruling
|
|
76
|
+
// 2026-07-28: the button ladder is the reference, bar icons included).
|
|
77
|
+
const glyph = size === 'sm' ? 14 : size === 'lg' ? 18 : 16
|
|
74
78
|
return (
|
|
75
79
|
<button
|
|
76
80
|
type="button"
|
|
77
81
|
onClick={handleToggle}
|
|
78
82
|
aria-label={`Switch to ${next} mode`}
|
|
79
83
|
title={`Switch to ${next} mode`}
|
|
80
|
-
className={`
|
|
84
|
+
className={`kol-btn kol-btn-nav kol-btn-${size} kol-btn-icon ${className}`.trim()}
|
|
81
85
|
>
|
|
82
|
-
{iconSwap(
|
|
86
|
+
{iconSwap(glyph)}
|
|
83
87
|
</button>
|
|
84
88
|
)
|
|
85
89
|
}
|