@raxrai/stylelab-ui 0.3.1 → 0.4.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/README.md CHANGED
@@ -49,6 +49,8 @@ export default function RootLayout({ children }) {
49
49
  }
50
50
  ```
51
51
 
52
+ Optional props: `storageKey` (default `"stylelab-theme"`) for the localStorage key; `persistTheme` (default `true`). When `persistTheme={false}`, the provider does not read or write localStorage (theme is fixed to `defaultTheme` unless you change it in memory).
53
+
52
54
  ### 3. Use components
53
55
 
54
56
  ```tsx
@@ -73,7 +75,7 @@ export function MyPage() {
73
75
 
74
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.
75
77
 
76
- **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).
77
79
 
78
80
  - **See all components and try themes:** [stylelab.rajarai.com](https://stylelab.rajarai.com)
79
81
  - **Full API (props, types, hooks):** [docs/COMPONENTS.md](docs/COMPONENTS.md) in this repo.
@@ -185,9 +187,12 @@ Implements focus trap and scroll lock when open.
185
187
 
186
188
  ### Dropdown
187
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
+
188
192
  | Prop | Type | Default | Description |
189
193
  |----------------|-------------------------|---------|--------------------------|
190
- | `trigger` | `ReactNode` | — | Button / element to open |
194
+ | `trigger` | `ReactNode` | — | Custom trigger; omit for default (placeholder/selected label) |
195
+ | `placeholder` | `string` | `"Select…"` | Shown when no value selected (default trigger only) |
191
196
  | `items` | `{ value, label, disabled? }[]` | — | Options |
192
197
  | `value` / `defaultValue` | `string` | — | Controlled / initial |
193
198
  | `onValueChange`| `(value: string) => void` | — | Selection callback |
@@ -200,10 +205,11 @@ Keyboard: Enter/Space to open, Arrows to move, Enter to select, Escape to close.
200
205
  ## Utilities & hooks
201
206
 
202
207
  ```tsx
203
- import { cn, useFocusTrap, useClickOutside, useKeyboardNavigation, getNextListIndex } from "@raxrai/stylelab-ui";
208
+ import { cn, mergeRefs, useFocusTrap, useClickOutside, useKeyboardNavigation, getNextListIndex } from "@raxrai/stylelab-ui";
204
209
  ```
205
210
 
206
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.
207
213
  - **useFocusTrap(active, options?)** – Traps focus in a container ref (e.g. Modal).
208
214
  - **useClickOutside(ref(s), handler, options?)** – Fires when click is outside ref(s).
209
215
  - **useKeyboardNavigation({ onEscape, onArrowLeft, onArrowRight, ... })** – Document-level key handlers.
@@ -213,6 +219,17 @@ import { cn, useFocusTrap, useClickOutside, useKeyboardNavigation, getNextListIn
213
219
 
214
220
  ## Changelog
215
221
 
222
+ ### [0.4.0]
223
+
224
+ - **Overrides + refs** — Component roots consistently support `style`, consumer `className` overrides (consumer class last), and ref forwarding across the library.
225
+ - **Theme fixes** — Card no longer forces text color; Button `ghost` uses `text-inherit` so it can inherit parent text color.
226
+ - **Accessibility** — ProgressBar now supports ARIA progress attributes; Toast supports Escape-to-dismiss; Tooltip uses `aria-describedby` when visible.
227
+ - **Exports** — `mergeRefs` and common component prop types are re-exported from the package entry.
228
+
229
+ ### [0.3.2]
230
+
231
+ - **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.
232
+
216
233
  ### [0.3.1]
217
234
 
218
235
  - **Dropdown** — `disabled` prop: when true, the dropdown does not open and the trigger is non-interactive (opacity, cursor, no popover). Use for empty or loading state.