@medixdeck/ui 0.1.7 → 0.1.9
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 +59 -4
- package/dist/index.cjs +9 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +83 -0
- package/dist/index.js +3632 -3275
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -2219,6 +2219,29 @@ export declare const textStyleTokens: {
|
|
|
2219
2219
|
};
|
|
2220
2220
|
};
|
|
2221
2221
|
|
|
2222
|
+
/**
|
|
2223
|
+
* MedixDeck ThemeColorPalette
|
|
2224
|
+
*
|
|
2225
|
+
* Visual reference for the library's semantic tokens and raw color scales.
|
|
2226
|
+
*
|
|
2227
|
+
* @example
|
|
2228
|
+
* ```tsx
|
|
2229
|
+
* <ThemeColorPalette />
|
|
2230
|
+
* ```
|
|
2231
|
+
*/
|
|
2232
|
+
export declare const ThemeColorPalette: default_2.ForwardRefExoticComponent<ThemeColorPaletteProps & default_2.RefAttributes<HTMLDivElement>>;
|
|
2233
|
+
|
|
2234
|
+
export declare interface ThemeColorPaletteProps extends Omit<BoxProps, "children"> {
|
|
2235
|
+
/** Show the semantic token groups with light and dark comparisons. */
|
|
2236
|
+
showSemanticTokens?: boolean;
|
|
2237
|
+
/** Show the raw brand, status, and neutral token scales. */
|
|
2238
|
+
showPrimitiveTokens?: boolean;
|
|
2239
|
+
}
|
|
2240
|
+
|
|
2241
|
+
export declare type ThemeMode = "light" | "dark";
|
|
2242
|
+
|
|
2243
|
+
export declare type ThemeModeSetting = ThemeMode | "system";
|
|
2244
|
+
|
|
2222
2245
|
export declare const toast: {
|
|
2223
2246
|
(options: Omit<ToastOptions, "id">): string;
|
|
2224
2247
|
success(title: string, options?: Partial<ToastOptions>): string;
|
|
@@ -2374,6 +2397,66 @@ export declare const typographyTokens: {
|
|
|
2374
2397
|
};
|
|
2375
2398
|
};
|
|
2376
2399
|
|
|
2400
|
+
/**
|
|
2401
|
+
* Convenience hook for checking whether the active MedixDeck theme is dark.
|
|
2402
|
+
*
|
|
2403
|
+
* Returns `false` until the component has mounted and `next-themes` has had a
|
|
2404
|
+
* chance to resolve the active theme. This avoids reporting light mode during
|
|
2405
|
+
* SSR or initial hydration when the resolved client theme is actually dark.
|
|
2406
|
+
*/
|
|
2407
|
+
export declare function useIsDarkMode(): boolean;
|
|
2408
|
+
|
|
2409
|
+
/**
|
|
2410
|
+
* Accesses the current MedixDeck theme mode and helpers for updating it.
|
|
2411
|
+
*
|
|
2412
|
+
* In SSR environments (e.g. Next.js), `next-themes` resolves the theme after
|
|
2413
|
+
* hydration. Gate any theme-dependent UI on `mounted` to avoid hydration
|
|
2414
|
+
* mismatches and flicker. In Next.js App Router, this hook must be called
|
|
2415
|
+
* inside a `"use client"` component.
|
|
2416
|
+
*
|
|
2417
|
+
* @example
|
|
2418
|
+
* ```tsx
|
|
2419
|
+
* // Avoid hydration mismatch: render theme-dependent UI only after mount.
|
|
2420
|
+
* const { mounted, themeMode, toggleThemeMode } = useThemeMode();
|
|
2421
|
+
*
|
|
2422
|
+
* if (!mounted) return null;
|
|
2423
|
+
*
|
|
2424
|
+
* return (
|
|
2425
|
+
* <button onClick={toggleThemeMode}>
|
|
2426
|
+
* Switch to {themeMode === "dark" ? "light" : "dark"} mode
|
|
2427
|
+
* </button>
|
|
2428
|
+
* );
|
|
2429
|
+
* ```
|
|
2430
|
+
*/
|
|
2431
|
+
export declare function useThemeMode(): UseThemeModeResult;
|
|
2432
|
+
|
|
2433
|
+
export declare interface UseThemeModeResult {
|
|
2434
|
+
/**
|
|
2435
|
+
* Indicates whether the hook has mounted on the client.
|
|
2436
|
+
* Primarily useful for avoiding SSR hydration mismatches with `next-themes`.
|
|
2437
|
+
*/
|
|
2438
|
+
mounted: boolean;
|
|
2439
|
+
/**
|
|
2440
|
+
* The currently resolved theme mode.
|
|
2441
|
+
* Falls back to `"light"` before client-side theme values are available.
|
|
2442
|
+
*/
|
|
2443
|
+
themeMode: ThemeMode;
|
|
2444
|
+
/**
|
|
2445
|
+
* The user's current theme preference (`"light"`, `"dark"`, or `"system"`).
|
|
2446
|
+
* Defaults to `"system"` before client-side hydration or when the provider
|
|
2447
|
+
* returns an unrecognised value (e.g. outside a `MedixProvider`).
|
|
2448
|
+
*/
|
|
2449
|
+
themeSetting: ThemeModeSetting;
|
|
2450
|
+
/**
|
|
2451
|
+
* Updates the active theme preference.
|
|
2452
|
+
*/
|
|
2453
|
+
setThemeMode: (mode: ThemeModeSetting) => void;
|
|
2454
|
+
/**
|
|
2455
|
+
* Toggles between `"light"` and `"dark"` modes.
|
|
2456
|
+
*/
|
|
2457
|
+
toggleThemeMode: () => void;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2377
2460
|
/**
|
|
2378
2461
|
* MedixDeck VitalBadge
|
|
2379
2462
|
*
|