@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/README.md
CHANGED
|
@@ -17,7 +17,27 @@ npm install @medixdeck/ui @chakra-ui/react react react-dom
|
|
|
17
17
|
## Quick start
|
|
18
18
|
|
|
19
19
|
```tsx
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
Button,
|
|
22
|
+
Logo,
|
|
23
|
+
MedixProvider,
|
|
24
|
+
Navbar,
|
|
25
|
+
useThemeMode,
|
|
26
|
+
} from "@medixdeck/ui";
|
|
27
|
+
|
|
28
|
+
// Next.js App Router: mark this component "use client" when using hooks.
|
|
29
|
+
function ThemeToggle() {
|
|
30
|
+
const { mounted, themeMode, toggleThemeMode } = useThemeMode();
|
|
31
|
+
|
|
32
|
+
// Avoid hydration mismatch: next-themes resolves the theme after mount.
|
|
33
|
+
if (!mounted) return null;
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Button variant="solid" colorScheme="blue" onClick={toggleThemeMode}>
|
|
37
|
+
Switch to {themeMode === "dark" ? "light" : "dark"} mode
|
|
38
|
+
</Button>
|
|
39
|
+
);
|
|
40
|
+
}
|
|
21
41
|
|
|
22
42
|
export function App() {
|
|
23
43
|
return (
|
|
@@ -27,7 +47,7 @@ export function App() {
|
|
|
27
47
|
ctaLabel="Talk to a Doctor"
|
|
28
48
|
ctaHref="/consult"
|
|
29
49
|
/>
|
|
30
|
-
<
|
|
50
|
+
<ThemeToggle />
|
|
31
51
|
<Logo variant="purple" height={28} />
|
|
32
52
|
</MedixProvider>
|
|
33
53
|
);
|
|
@@ -38,10 +58,10 @@ export function App() {
|
|
|
38
58
|
|
|
39
59
|
| Area | Exports |
|
|
40
60
|
| --- | --- |
|
|
41
|
-
| Provider + theme | `MedixProvider`, `system`, `medixConfig`, token exports |
|
|
61
|
+
| Provider + theme | `MedixProvider`, `useThemeMode`, `useIsDarkMode`, `system`, `medixConfig`, token exports |
|
|
42
62
|
| Primitive | `Button`, `IconButton`, `Badge`, `Avatar`, `AvatarGroup`, `Spinner`, `FullPageSpinner`, `Tag`, `Divider`, `Logo` |
|
|
43
63
|
| Form | `Input`, `SearchInput`, `Textarea`, `Select`, `Checkbox`, `RadioGroup`, `Switch`, `FormControl`, `OTPInput`, `PinInput`, `PhoneInput`, `DatePicker`, `DateRangePicker`, `Combobox`, `FileUpload` |
|
|
44
|
-
| Layout | `Card`, `CardHeader`, `CardBody`, `CardFooter`, `StatCard`, `Container`, `SectionHeader`, `DashboardLayout` |
|
|
64
|
+
| Layout | `Card`, `CardHeader`, `CardBody`, `CardFooter`, `StatCard`, `Container`, `SectionHeader`, `ThemeColorPalette`, `DashboardLayout` |
|
|
45
65
|
| Navigation | `Navbar`, `Breadcrumb`, `Tabs`, `Pagination`, `Stepper` |
|
|
46
66
|
| Feedback | `Alert`, `Skeleton`, `SkeletonText`, `SkeletonCard`, `Progress`, `Modal`, `Drawer`, `Tooltip`, `EmptyState`, `Toaster`, `toast`, `dismissToast` |
|
|
47
67
|
| Data display | `Accordion`, `TestimonialCard`, `BlogCard`, `DataTable` |
|
|
@@ -56,6 +76,41 @@ export function App() {
|
|
|
56
76
|
- For color-critical interactive controls, prefer the repo's native-first pattern instead of Chakra recipes.
|
|
57
77
|
- Apply dark mode on `document.documentElement`, not an inner container.
|
|
58
78
|
|
|
79
|
+
## Theme hooks
|
|
80
|
+
|
|
81
|
+
```tsx
|
|
82
|
+
import { useIsDarkMode, useThemeMode } from "@medixdeck/ui";
|
|
83
|
+
|
|
84
|
+
function ThemeStatus() {
|
|
85
|
+
const { themeMode, themeSetting, setThemeMode, toggleThemeMode } = useThemeMode();
|
|
86
|
+
const isDarkMode = useIsDarkMode();
|
|
87
|
+
|
|
88
|
+
return (
|
|
89
|
+
<>
|
|
90
|
+
<p>Resolved mode: {themeMode}</p>
|
|
91
|
+
<p>Following: {themeSetting ?? "system"}</p>
|
|
92
|
+
<p>Dark mode active: {String(isDarkMode)}</p>
|
|
93
|
+
<button onClick={() => setThemeMode("dark")}>Dark</button>
|
|
94
|
+
<button onClick={() => setThemeMode("light")}>Light</button>
|
|
95
|
+
<button onClick={() => setThemeMode("system")}>System</button>
|
|
96
|
+
<button onClick={toggleThemeMode}>Toggle</button>
|
|
97
|
+
</>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Theme color reference
|
|
103
|
+
|
|
104
|
+
```tsx
|
|
105
|
+
import { ThemeColorPalette } from "@medixdeck/ui";
|
|
106
|
+
|
|
107
|
+
export function DesignTokensPage() {
|
|
108
|
+
return <ThemeColorPalette mt="8" />;
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`ThemeColorPalette` renders the semantic design tokens side by side for light and dark mode, then lists the raw brand, status, and neutral scales that power the theme.
|
|
113
|
+
|
|
59
114
|
## Repository index
|
|
60
115
|
|
|
61
116
|
```txt
|