@kolkrabbi/kol-shell 0.110.0 → 0.111.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.
Files changed (2) hide show
  1. package/package.json +3 -3
  2. package/src/MenuBar.jsx +17 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kolkrabbi/kol-shell",
3
- "version": "0.110.0",
3
+ "version": "0.111.0",
4
4
  "private": false,
5
5
  "description": "The application shell",
6
6
  "license": "MIT",
@@ -21,8 +21,8 @@
21
21
  "react-dom": "^18.3.0 || ^19.0.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@kolkrabbi/kol-component": "^0.342.0",
25
- "@kolkrabbi/kol-icons": "^0.65.0",
24
+ "@kolkrabbi/kol-component": "^0.343.0",
25
+ "@kolkrabbi/kol-icons": "^0.66.0",
26
26
  "@kolkrabbi/kol-framework": "^0.70.0",
27
27
  "@kolkrabbi/kol-theme": "^0.212.0"
28
28
  },
package/src/MenuBar.jsx CHANGED
@@ -17,6 +17,10 @@ import { Icon } from '@kolkrabbi/kol-icons'
17
17
  * @param {string|Object} app the app's name ("FXR"), or a menu `{ label, items }` when the name opens the app menu
18
18
  * @param {Array} menus `[{ label, items, width? }]` — `width` the list's (default 250)
19
19
  * @param {Array} end the same, at the bar's far end (Help)
20
+ * @param {'bar'|'capsule'} variant `capsule` (plan-2026-11-05-float-editor W2b; his phone frame 06, 19:9544 — the Section 4
21
+ * menu capsule 19:10617): the menus on a float sheet (the secondary surface, the window round,
22
+ * 20 in), each trigger the float label role in caps at fg-48 with a 10 chevron, 12 apart,
23
+ * lit fg-96 while open. The same menus, lists and keys as the bar.
20
24
  * @param {string} className
21
25
  *
22
26
  * A row in `items` (Menu's own row keys): `{ label, onClick, kbd?, disabled?, checked?, indicator?, icon?, tone? }` ·
@@ -25,6 +29,8 @@ import { Icon } from '@kolkrabbi/kol-icons'
25
29
  const ROW = 'kol-menubar-row w-full shrink-0 flex items-center gap-2 h-6 px-2 rounded-[var(--kol-radius-sm)] text-left font-[family-name:var(--kol-font-family-sans)] text-[13px] font-medium leading-normal text-[color:var(--kol-fg-emphasis)] hover:bg-[var(--kol-fg-08)] aria-expanded:bg-[var(--kol-fg-08)] disabled:opacity-40 disabled:cursor-not-allowed focus-visible:outline-none focus-visible:bg-[var(--kol-fg-08)]'
26
30
  /* the list: the secondary surface, a 2% rim, 4 in, the large shadow; the key cap on the rim's fill, its ink oq-80 */
27
31
  const LIST = 'kol-menubar-list flex flex-col bg-[var(--kol-surface-secondary)] border border-[var(--kol-fg-02)] rounded-[var(--kol-radius-sm)] p-1 shadow-[0_10px_15px_rgba(0,0,0,0.1)] [&_.kol-menu-kbd]:bg-[var(--kol-fg-02)] [&_.kol-menu-kbd]:border [&_.kol-menu-kbd]:border-[var(--kol-fg-02)] [&_.kol-menu-kbd]:text-[var(--kol-oq-80)] [&_.kol-menu-kbd]:rounded-[2px]'
32
+ /* the capsule's trigger (his 19:9544): Inter 11 caps at fg-48, the chevron 8 after, 26 tall, the text on the top */
33
+ const CAPSULE_TRIGGER = 'kol-menu-btn inline-flex items-start gap-2 h-[26px] p-0 bg-transparent border-0 kol-float-label uppercase whitespace-nowrap text-fg-48 hover:text-(--kol-fg-80) aria-expanded:text-(--kol-fg-96) focus-visible:outline-none focus-visible:text-(--kol-fg-96) [&_svg]:mt-[3px]'
28
34
  /* the trigger: 26 tall, 12 in; lit while its menu is open. The line box is the pill (leading 26, not 13): a 13 line box
29
35
  * centred in 26 starts on a half pixel, and the glyphs rode it — the label's cap centre on the pill's centre, measured
30
36
  * in Chromium and Firefox (±0.5 at 1x is the 9px cap's own rounding). */
@@ -54,7 +60,8 @@ function Rows({ items, width }) {
54
60
  })
55
61
  }
56
62
 
57
- export default function MenuBar({ app, menus = [], end = [], className = '' }) {
63
+ export default function MenuBar({ app, menus = [], end = [], variant = 'bar', className = '' }) {
64
+ const capsule = variant === 'capsule'
58
65
  const appMenu = typeof app === 'string' ? { label: app } : app
59
66
  const all = [...(appMenu ? [{ ...appMenu, app: true }] : []), ...menus, ...end]
60
67
  const [open, setOpen] = useState(null)
@@ -93,8 +100,9 @@ export default function MenuBar({ app, menus = [], end = [], className = '' }) {
93
100
  <button {...props} ref={(el) => { triggers.current[i] = el }} type="button" aria-expanded={isOpen}
94
101
  /* the bar is live once a menu is open: pointing at another opens it (the mac menu bar) */
95
102
  onPointerEnter={() => { if (open != null && open !== i) setOpen(i) }}
96
- className={`${TRIGGER} ${m.app ? 'font-bold' : 'font-medium'}`}>
103
+ className={capsule ? CAPSULE_TRIGGER : `${TRIGGER} ${m.app ? 'font-bold' : 'font-medium'}`}>
97
104
  {m.label}
105
+ {capsule && <Icon name="chevron-down" size={10} className="text-oq-48" />}
98
106
  </button>
99
107
  )}
100
108
  >
@@ -104,6 +112,13 @@ export default function MenuBar({ app, menus = [], end = [], className = '' }) {
104
112
  }
105
113
 
106
114
  const startCount = (appMenu ? 1 : 0) + menus.length
115
+ if (capsule) {
116
+ return (
117
+ <div role="menubar" aria-label="Menu bar" className={`kol-menubar kol-menubar--capsule flex items-start gap-3 p-5 rounded-[var(--kol-float-window-r)] bg-[var(--kol-surface-secondary)] ${className}`.trim()}>
118
+ {all.map((m, i) => item(m, i))}
119
+ </div>
120
+ )
121
+ }
107
122
  return (
108
123
  <div role="menubar" aria-label="Menu bar" className={`kol-menubar flex items-center gap-1 h-10 px-4 shrink-0 bg-[var(--kol-surface-secondary)] border-b border-[var(--kol-fg-02)] ${className}`.trim()}>
109
124
  {all.slice(0, startCount).map((m, i) => item(m, i))}