@ahrowe/ui 0.1.19 → 0.1.21

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.
@@ -0,0 +1,62 @@
1
+ # TabHeader
2
+
3
+ **When to use:** A horizontal row of tabs to switch between sibling views or sections — settings panels, dashboards, detail pages. Each tab carries an icon plus an optional title and subtitle.
4
+
5
+ **Import:** `import { TabHeader } from '@ahrowe/ui'`
6
+
7
+ **Mobile behaviour:** On narrow screens (≤ 640px) only the active tab keeps its title and subtitle; every other tab collapses to just its icon.
8
+
9
+ ```tsx
10
+ import { useState } from 'react';
11
+ import { TabHeader } from '@ahrowe/ui';
12
+ import type { TabHeaderTab } from '@ahrowe/ui';
13
+ import { faUser, faBell, faGear } from '@fortawesome/free-solid-svg-icons';
14
+
15
+ const TABS: TabHeaderTab[] = [
16
+ { id: 'profile', icon: faUser, title: 'Profile', subtitle: 'Your details' },
17
+ { id: 'notifications', icon: faBell, title: 'Notifications', subtitle: 'Email & push' },
18
+ { id: 'settings', icon: faGear, title: 'Settings' }, // title only
19
+ ];
20
+
21
+ function Example() {
22
+ const [tab, setTab] = useState('profile');
23
+ return <TabHeader tabs={TABS} currentTab={tab} onChange={setTab} />;
24
+ }
25
+
26
+ // Icon-only tabs
27
+ <TabHeader
28
+ tabs={[{ id: 'a', icon: faUser }, { id: 'b', icon: faGear }]}
29
+ currentTab={tab}
30
+ onChange={setTab}
31
+ />
32
+
33
+ // Disabled tab — dimmed and not selectable
34
+ <TabHeader
35
+ tabs={[
36
+ { id: 'a', icon: faUser, title: 'Profile' },
37
+ { id: 'b', icon: faGear, title: 'Billing', disabled: true },
38
+ ]}
39
+ currentTab={tab}
40
+ onChange={setTab}
41
+ />
42
+ ```
43
+
44
+ **TabHeaderProps:**
45
+
46
+ | Prop | Type | Description |
47
+ |------|------|-------------|
48
+ | `tabs` | `TabHeaderTab[]` | The tabs to render, in order |
49
+ | `currentTab` | `string` | `id` of the selected tab |
50
+ | `onChange` | `(id: string) => void` | Called with the tab `id` when a different, enabled tab is clicked |
51
+
52
+ **TabHeaderTab:**
53
+
54
+ | Field | Type | Description |
55
+ |-------|------|-------------|
56
+ | `id` | `string` | Unique identifier, matched against `currentTab` |
57
+ | `icon` | `IconDefinition` | FontAwesome icon (always visible, incl. mobile) |
58
+ | `title` | `string` | Optional title next to the icon |
59
+ | `subtitle` | `string` | Optional subtitle beneath the title |
60
+ | `disabled` | `boolean` | Dim the tab and prevent selection |
61
+
62
+ **Slots:** `root` `tab` `icon` `labels` `title` `subtitle`
@@ -90,7 +90,8 @@ const columns: VirtualListColumn<User>[] = [
90
90
  | `height` | `number \| string` | Scroll viewport height (default `'100%'`) |
91
91
  | `estimatedRowHeight` | `number` | Estimated row height before measurement (default `40`) |
92
92
  | `overscan` | `number` | Extra rows rendered outside the viewport (default `3`) |
93
- | `rowGap` | `number` | Gap in px between rows (default `0`) |
93
+ | `rowGap` | `number \| string` | Gap between rows — number = px; string = any CSS length (`'1em'`, `'var(--spacing-s)'`). Default `0` |
94
+ | `rowPadding` | `number \| string` | Padding on every row — number = px; string = any CSS padding value (`'8px 12px'`, `'var(--spacing-s)'`) |
94
95
  | `showDivider` | `boolean` | Row divider lines (default `true`) |
95
96
  | `getItemKey` | `(item, index) => string \| number` | Stable key per item |
96
97
  | `selectedKey` | `string \| number \| null` | Controlled single-select key |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahrowe/ui",
3
- "version": "0.1.19",
3
+ "version": "0.1.21",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },