@kolkrabbi/kol-component 0.180.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.180.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
  }
@@ -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>