@trendr/core 0.2.1 → 0.2.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/tabs.js +12 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trendr/core",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "direct-mode TUI renderer with JSX, signals, and per-cell diffing",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/tabs.js CHANGED
@@ -1,7 +1,9 @@
1
1
  import { jsx, jsxs } from '../jsx-runtime.js'
2
- import { useInput } from './hooks.js'
2
+ import { useInput, useTheme } from './hooks.js'
3
3
 
4
4
  export function Tabs({ items, selected, onSelect, focused = true }) {
5
+ const { accent = 'cyan' } = useTheme()
6
+
5
7
  useInput(({ key }) => {
6
8
  if (!focused) return
7
9
 
@@ -17,10 +19,15 @@ export function Tabs({ items, selected, onSelect, focused = true }) {
17
19
 
18
20
  const children = items.map(item => {
19
21
  const isSelected = item === selected
20
- return jsx('text', {
21
- style: isSelected ? { inverse: true, bold: true } : { color: 'gray' },
22
- children: ` ${item} `,
23
- })
22
+ let style
23
+ if (isSelected && focused) {
24
+ style = { bg: accent, color: 'black', bold: true }
25
+ } else if (isSelected) {
26
+ style = { inverse: true, bold: true }
27
+ } else {
28
+ style = { color: 'gray' }
29
+ }
30
+ return jsx('text', { style, children: ` ${item} ` })
24
31
  })
25
32
 
26
33
  return jsxs('box', {