@raxrai/stylelab-ui 0.3.2 → 0.4.1
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/README.md +18 -3
- package/dist/index.cjs +534 -516
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +163 -55
- package/dist/index.d.ts +163 -55
- package/dist/index.mjs +423 -403
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -3
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ export function MyPage() {
|
|
|
75
75
|
|
|
76
76
|
**Components:** Accordion, Alert, Avatar, AvatarGroup, Badge, BentoGrid, Breadcrumbs, Button, Calendar, Card, CommandPalette, DashboardShell, DataTable, DocumentAccordion, Dropdown, Flashcard, GraphicCard, Input, Modal, Navbar, PricingCard, ProgressBar, SectionHeader, Sidebar, Skeleton, Slider, StatsCard, Tabs, Terminal, Timeline, Toast, Toggle, Tooltip.
|
|
77
77
|
|
|
78
|
-
**Global:** ThemeProvider, useTheme, getThemeClass, THEMES, StyleLabTheme, cn, getNextListIndex, useFocusTrap, useClickOutside, useKeyboardNavigation.
|
|
78
|
+
**Global:** ThemeProvider, useTheme, getThemeClass, THEMES, StyleLabTheme, cn, mergeRefs, getNextListIndex, useFocusTrap, useClickOutside, useKeyboardNavigation. Component roots support **ref** forwarding and **style** / **className** (consumer `className` applied last for overrides).
|
|
79
79
|
|
|
80
80
|
- **See all components and try themes:** [stylelab.rajarai.com](https://stylelab.rajarai.com)
|
|
81
81
|
- **Full API (props, types, hooks):** [docs/COMPONENTS.md](docs/COMPONENTS.md) in this repo.
|
|
@@ -187,9 +187,12 @@ Implements focus trap and scroll lock when open.
|
|
|
187
187
|
|
|
188
188
|
### Dropdown
|
|
189
189
|
|
|
190
|
+
**Two usage patterns:** (1) **Default trigger** — omit `trigger`; the component shows a button with the selected label or `placeholder`. (2) **Custom trigger** — pass `trigger` with your own element (e.g. a Button or icon); the same list opens on activation.
|
|
191
|
+
|
|
190
192
|
| Prop | Type | Default | Description |
|
|
191
193
|
|----------------|-------------------------|---------|--------------------------|
|
|
192
|
-
| `trigger` | `ReactNode` | — |
|
|
194
|
+
| `trigger` | `ReactNode` | — | Custom trigger; omit for default (placeholder/selected label) |
|
|
195
|
+
| `placeholder` | `string` | `"Select…"` | Shown when no value selected (default trigger only) |
|
|
193
196
|
| `items` | `{ value, label, disabled? }[]` | — | Options |
|
|
194
197
|
| `value` / `defaultValue` | `string` | — | Controlled / initial |
|
|
195
198
|
| `onValueChange`| `(value: string) => void` | — | Selection callback |
|
|
@@ -202,10 +205,11 @@ Keyboard: Enter/Space to open, Arrows to move, Enter to select, Escape to close.
|
|
|
202
205
|
## Utilities & hooks
|
|
203
206
|
|
|
204
207
|
```tsx
|
|
205
|
-
import { cn, useFocusTrap, useClickOutside, useKeyboardNavigation, getNextListIndex } from "@raxrai/stylelab-ui";
|
|
208
|
+
import { cn, mergeRefs, useFocusTrap, useClickOutside, useKeyboardNavigation, getNextListIndex } from "@raxrai/stylelab-ui";
|
|
206
209
|
```
|
|
207
210
|
|
|
208
211
|
- **cn(...)** – clsx + tailwind-merge for class names.
|
|
212
|
+
- **mergeRefs(...refs)** – Combines multiple refs (e.g. forwarded ref + internal ref). Use when a component needs to forward a ref and also attach its own ref.
|
|
209
213
|
- **useFocusTrap(active, options?)** – Traps focus in a container ref (e.g. Modal).
|
|
210
214
|
- **useClickOutside(ref(s), handler, options?)** – Fires when click is outside ref(s).
|
|
211
215
|
- **useKeyboardNavigation({ onEscape, onArrowLeft, onArrowRight, ... })** – Document-level key handlers.
|
|
@@ -215,6 +219,17 @@ import { cn, useFocusTrap, useClickOutside, useKeyboardNavigation, getNextListIn
|
|
|
215
219
|
|
|
216
220
|
## Changelog
|
|
217
221
|
|
|
222
|
+
### [0.4.1]
|
|
223
|
+
|
|
224
|
+
- **Navbar** — Mobile menu: click-outside ref now wraps both the bar and the dropdown panel so taps on nav links or buttons (e.g. Log out) run the action instead of only closing the menu. Mobile panel uses an explicit opaque theme-aware background in all themes (readable with glass/clay). Optional `mobileMenuExtra` prop renders content at the bottom of the hamburger overlay (e.g. a Log out button); clicking it closes the menu.
|
|
225
|
+
|
|
226
|
+
### [0.4.0]
|
|
227
|
+
|
|
228
|
+
- **Overrides + refs** — Component roots consistently support `style`, consumer `className` overrides (consumer class last), and ref forwarding across the library.
|
|
229
|
+
- **Theme fixes** — Card no longer forces text color; Button `ghost` uses `text-inherit` so it can inherit parent text color.
|
|
230
|
+
- **Accessibility** — ProgressBar now supports ARIA progress attributes; Toast supports Escape-to-dismiss; Tooltip uses `aria-describedby` when visible.
|
|
231
|
+
- **Exports** — `mergeRefs` and common component prop types are re-exported from the package entry.
|
|
232
|
+
|
|
218
233
|
### [0.3.2]
|
|
219
234
|
|
|
220
235
|
- **ThemeProvider** — Optional `persistTheme` prop (default `true`). When `persistTheme={false}`, the provider does not read from or write to localStorage: theme stays at `defaultTheme` unless changed in memory. Use for fixed-theme pages (e.g. landing, docs) or nested providers where only the inner tree should persist. Optional `storageKey` (default `"stylelab-theme"`) still applies when `persistTheme` is true.
|