@medixdeck/ui 0.1.6 → 0.1.8

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/dist/index.d.ts CHANGED
@@ -261,7 +261,7 @@ export declare interface BreadcrumbProps extends BoxProps {
261
261
  * <Button variant="ghost" colorScheme="blue" size="sm">Cancel</Button>
262
262
  * ```
263
263
  */
264
- export declare const Button: default_2.ForwardRefExoticComponent<ButtonProps & default_2.RefAttributes<HTMLButtonElement>>;
264
+ export declare const Button: default_2.ForwardRefExoticComponent<ButtonProps & default_2.RefAttributes<HTMLElement>>;
265
265
 
266
266
  export declare interface ButtonProps {
267
267
  /** Visual variant */
@@ -281,7 +281,7 @@ export declare interface ButtonProps {
281
281
  /** HTML type attribute */
282
282
  type?: "button" | "submit" | "reset";
283
283
  /** Click handler */
284
- onClick?: default_2.MouseEventHandler<HTMLButtonElement>;
284
+ onClick?: default_2.MouseEventHandler<HTMLElement>;
285
285
  /** Any additional className */
286
286
  className?: string;
287
287
  /** Arbitrary additional style */
@@ -292,6 +292,14 @@ export declare interface ButtonProps {
292
292
  "aria-expanded"?: boolean | "true" | "false";
293
293
  "aria-controls"?: string;
294
294
  "aria-haspopup"?: boolean | "dialog" | "menu" | "grid" | "listbox" | "tree";
295
+ /** HTML element to render as — supports "button" (default) or "a" (anchor link) */
296
+ as?: "button" | "a";
297
+ /** Link destination if rendered as an anchor */
298
+ href?: string;
299
+ /** Link target if rendered as an anchor */
300
+ target?: string;
301
+ /** Link rel if rendered as an anchor */
302
+ rel?: string;
295
303
  }
296
304
 
297
305
  /**
@@ -2211,6 +2219,10 @@ export declare const textStyleTokens: {
2211
2219
  };
2212
2220
  };
2213
2221
 
2222
+ export declare type ThemeMode = "light" | "dark";
2223
+
2224
+ export declare type ThemeModeSetting = ThemeMode | "system";
2225
+
2214
2226
  export declare const toast: {
2215
2227
  (options: Omit<ToastOptions, "id">): string;
2216
2228
  success(title: string, options?: Partial<ToastOptions>): string;
@@ -2366,6 +2378,66 @@ export declare const typographyTokens: {
2366
2378
  };
2367
2379
  };
2368
2380
 
2381
+ /**
2382
+ * Convenience hook for checking whether the active MedixDeck theme is dark.
2383
+ *
2384
+ * Returns `false` until the component has mounted and `next-themes` has had a
2385
+ * chance to resolve the active theme. This avoids reporting light mode during
2386
+ * SSR or initial hydration when the resolved client theme is actually dark.
2387
+ */
2388
+ export declare function useIsDarkMode(): boolean;
2389
+
2390
+ /**
2391
+ * Accesses the current MedixDeck theme mode and helpers for updating it.
2392
+ *
2393
+ * In SSR environments (e.g. Next.js), `next-themes` resolves the theme after
2394
+ * hydration. Gate any theme-dependent UI on `mounted` to avoid hydration
2395
+ * mismatches and flicker. In Next.js App Router, this hook must be called
2396
+ * inside a `"use client"` component.
2397
+ *
2398
+ * @example
2399
+ * ```tsx
2400
+ * // Avoid hydration mismatch: render theme-dependent UI only after mount.
2401
+ * const { mounted, themeMode, toggleThemeMode } = useThemeMode();
2402
+ *
2403
+ * if (!mounted) return null;
2404
+ *
2405
+ * return (
2406
+ * <button onClick={toggleThemeMode}>
2407
+ * Switch to {themeMode === "dark" ? "light" : "dark"} mode
2408
+ * </button>
2409
+ * );
2410
+ * ```
2411
+ */
2412
+ export declare function useThemeMode(): UseThemeModeResult;
2413
+
2414
+ export declare interface UseThemeModeResult {
2415
+ /**
2416
+ * Indicates whether the hook has mounted on the client.
2417
+ * Primarily useful for avoiding SSR hydration mismatches with `next-themes`.
2418
+ */
2419
+ mounted: boolean;
2420
+ /**
2421
+ * The currently resolved theme mode.
2422
+ * Falls back to `"light"` before client-side theme values are available.
2423
+ */
2424
+ themeMode: ThemeMode;
2425
+ /**
2426
+ * The user's current theme preference (`"light"`, `"dark"`, or `"system"`).
2427
+ * Defaults to `"system"` before client-side hydration or when the provider
2428
+ * returns an unrecognised value (e.g. outside a `MedixProvider`).
2429
+ */
2430
+ themeSetting: ThemeModeSetting;
2431
+ /**
2432
+ * Updates the active theme preference.
2433
+ */
2434
+ setThemeMode: (mode: ThemeModeSetting) => void;
2435
+ /**
2436
+ * Toggles between `"light"` and `"dark"` modes.
2437
+ */
2438
+ toggleThemeMode: () => void;
2439
+ }
2440
+
2369
2441
  /**
2370
2442
  * MedixDeck VitalBadge
2371
2443
  *