@kolkrabbi/kol-component 0.179.0 → 0.181.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.179.0",
3
+ "version": "0.181.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",
@@ -30,10 +30,8 @@
30
30
  "framer-motion": "^12.0.0",
31
31
  "gsap": "^3.13.0",
32
32
  "hls.js": "^1.6.0",
33
- "opentype.js": "^1.3.4 || ^2.0.0",
34
33
  "react": "^18.3.0 || ^19.0.0",
35
- "react-dom": "^18.3.0 || ^19.0.0",
36
- "react-router-dom": "^6.0.0 || ^7.0.0"
34
+ "react-dom": "^18.3.0 || ^19.0.0"
37
35
  },
38
36
  "devDependencies": {
39
37
  "@kolkrabbi/kol-icons": "^0.25.0"
@@ -57,13 +55,5 @@
57
55
  "publishConfig": {
58
56
  "access": "public"
59
57
  },
60
- "sideEffects": false,
61
- "peerDependenciesMeta": {
62
- "react-router-dom": {
63
- "optional": true
64
- },
65
- "opentype.js": {
66
- "optional": true
67
- }
68
- }
58
+ "sideEffects": false
69
59
  }
@@ -43,10 +43,18 @@
43
43
  * mono-16, 8/20 pad). Same cell padding + mono type as the
44
44
  * matching `.kol-btn-{sm,md,lg}`, so a segmented strip lines
45
45
  * up with a Button of the same size.
46
+ * tone — the ground (segmented-toggle-sunken-tone, kol-client-olina 2026-09-03: the one
47
+ * control ControlToneSunken skipped; kol-fxr and olina carried the same three CSS
48
+ * lines to fake it). `sunken` (alias `inverse`): shell border transparent, the
49
+ * selected cell on `--kol-surface-sunken` / `fg-96`, rest cells as the default paints
50
+ * them; `filled` and `tonal` keep their own selected law. Through `toneClass`, so a
51
+ * `kol-tone-sunken` wrapper reaches it too. Unset = inherit.
46
52
  * ariaLabel — accessible name for the group
47
53
  * className — additional classes on the outer shell
48
54
  */
49
- export default function SegmentedToggle({ value, onChange, options = [], variant = 'default', size = 'md', ariaLabel, className = '' }) {
55
+ import { toneClass } from '../utilities/tone.js'
56
+
57
+ export default function SegmentedToggle({ value, onChange, options = [], variant = 'default', size = 'md', tone = 'default', ariaLabel, className = '' }) {
50
58
  const cellType = { xs: 'kol-mono-8', sm: 'kol-mono-12', md: 'kol-mono-14', lg: 'kol-mono-16' }[size]
51
59
  const stateless = value == null
52
60
  const focusIdx = Math.max(0, options.findIndex((opt) => opt.value === value))
@@ -71,6 +79,7 @@ export default function SegmentedToggle({ value, onChange, options = [], variant
71
79
  (variant === 'filled' || variant === 'tonal') && 'kol-seg--filled',
72
80
  variant === 'tonal' && 'kol-seg--tonal',
73
81
  size !== 'md' && `kol-seg--${size}`,
82
+ toneClass(tone),
74
83
  className,
75
84
  ].filter(Boolean).join(' ')}
76
85
  >
@@ -1,10 +1,28 @@
1
- import { Link, useLocation } from 'react-router-dom'
2
-
3
- export default function ExitPreview() {
4
- const { pathname: _pathname } = useLocation()
1
+ /**
2
+ * ExitPreview — the escape hatch out of a preview surface, worn as a fixed
3
+ * pill. Router-AGNOSTIC by the same seam kol-shell uses for navigation: it
4
+ * renders a plain `<a>` unless the consumer hands it its router's link.
5
+ *
6
+ * It used to `import { Link, useLocation } from 'react-router-dom'` at module
7
+ * level. react-router-dom is an OPTIONAL peer of this package, so that one line
8
+ * made kol-component — and every package whose barrel touches it — unbuildable
9
+ * for a consumer without a router (kol-client-olina, 2026-09-03). An optional
10
+ * peer is never statically imported.
11
+ *
12
+ * @param {string} [to='/'] - Where exiting goes.
13
+ * @param {React.ElementType} [linkComponent='a'] - Router link to render
14
+ * instead of an anchor, e.g. react-router's `Link`. Given one, `to` is passed
15
+ * as `to`; on the default anchor it is passed as `href`.
16
+ *
17
+ * @example
18
+ * <ExitPreview /> // plain anchor, hard nav
19
+ * <ExitPreview linkComponent={Link} /> // client-side nav
20
+ */
21
+ export default function ExitPreview({ to = '/', linkComponent: Link = 'a' }) {
22
+ const target = Link === 'a' ? { href: to } : { to }
5
23
 
6
24
  return (
7
- <Link to="/" className="kol-exit-preview" aria-label="Exit preview">
25
+ <Link {...target} className="kol-exit-preview" aria-label="Exit preview">
8
26
  <span className="kol-exit-preview-icon" aria-hidden="true">×</span>
9
27
  <span className="kol-exit-preview-label">Exit</span>
10
28
  </Link>