@medixdeck/ui 0.1.13 → 0.1.15

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
@@ -58,12 +58,12 @@ export function App() {
58
58
 
59
59
  | Area | Exports |
60
60
  | --- | --- |
61
- | Provider + theme | `MedixProvider`, `useThemeMode`, `useIsDarkMode`, `system`, `medixConfig`, token exports |
61
+ | Provider + theme | `MedixProvider`, `useThemeMode`, `useIsDarkMode`, `useColorScheme`, `system`, `medixConfig`, token exports |
62
62
  | Primitive | `Button`, `IconButton`, `Badge`, `Avatar`, `AvatarGroup`, `Spinner`, `FullPageSpinner`, `Tag`, `Divider`, `Logo` |
63
63
  | Form | `Input`, `SearchInput`, `Textarea`, `Select`, `Checkbox`, `RadioGroup`, `Switch`, `FormControl`, `OTPInput`, `PinInput`, `PhoneInput`, `DatePicker`, `DateRangePicker`, `Calendar`, `Combobox`, `FileUpload` |
64
- | Layout | `Card`, `CardHeader`, `CardBody`, `CardFooter`, `StatCard`, `Container`, `SectionHeader`, `ThemeColorPalette`, `DashboardLayout` |
64
+ | Layout | `Card`, `CardHeader`, `CardBody`, `CardFooter`, `StatCard`, `Container`, `SectionHeader`, `ThemeColorPalette`, `DashboardLayout`, `Footer` |
65
65
  | Navigation | `Navbar`, `Breadcrumb`, `Tabs`, `Pagination`, `Stepper` |
66
- | Feedback | `Alert`, `Skeleton`, `SkeletonText`, `SkeletonCard`, `Progress`, `Modal`, `Drawer`, `Tooltip`, `EmptyState`, `Toaster`, `toast`, `dismissToast` |
66
+ | Feedback | `Alert`, `Skeleton`, `SkeletonText`, `SkeletonCard`, `Progress`, `Modal`, `Drawer`, `Tooltip`, `EmptyState`, `Toaster`, `toast`, `dismissToast`, `CookieConsentBanner`, `PWAInstallPrompt` |
67
67
  | Data display | `Accordion`, `TestimonialCard`, `BlogCard`, `DataTable` |
68
68
  | Healthcare | `DoctorCard`, `VitalBadge`, `AppointmentCard` |
69
69
  | Chakra re-exports | `Box`, `Flex`, `Grid`, `Stack`, `Text`, `Heading`, `Link`, `Image`, `Icon`, `Center`, `Wrap`, `WrapItem`, others in `lib/index.ts` |
@@ -99,8 +99,212 @@ function ThemeStatus() {
99
99
  }
100
100
  ```
101
101
 
102
+ ## Color scheme theming
103
+
104
+ Five components — `Navbar`, `Footer`, `Accordion`, `BlogCard`, and `DashboardLayout` — accept a `colorScheme` prop that switches every brand accent between MedixDeck blue (`#0685FF`) and purple (`#7700CC`).
105
+
106
+ ```tsx
107
+ import {
108
+ Navbar,
109
+ Footer,
110
+ Accordion,
111
+ BlogCard,
112
+ DashboardLayout,
113
+ } from "@medixdeck/ui";
114
+
115
+ <Navbar colorScheme="purple" navItems={[...]} ctaLabel="Talk to a Doctor" />
116
+ <Footer colorScheme="purple" />
117
+ <Accordion colorScheme="purple" items={[...]} />
118
+ <BlogCard colorScheme="purple" title="..." />
119
+ <DashboardLayout colorScheme="purple">{/* ... */}</DashboardLayout>
120
+ ```
121
+
122
+ Use the `useColorScheme` hook to manage the active scheme in state and keep multiple components in sync:
123
+
124
+ ```tsx
125
+ import { useColorScheme, Navbar, Footer, Accordion } from "@medixdeck/ui";
126
+
127
+ function Page() {
128
+ const { colorScheme, toggleColorScheme } = useColorScheme(); // defaults to "blue"
129
+
130
+ return (
131
+ <>
132
+ <button onClick={toggleColorScheme}>
133
+ Switch to {colorScheme === "blue" ? "purple" : "blue"}
134
+ </button>
135
+ <Navbar colorScheme={colorScheme} navItems={[...]} />
136
+ <Accordion colorScheme={colorScheme} items={[...]} />
137
+ <Footer colorScheme={colorScheme} />
138
+ </>
139
+ );
140
+ }
141
+ ```
142
+
143
+ `useColorScheme(initialScheme?)` returns:
144
+
145
+ | Field | Type | Description |
146
+ | --- | --- | --- |
147
+ | `colorScheme` | `"blue" \| "purple"` | Currently active scheme |
148
+ | `setColorScheme` | `(scheme) => void` | Explicit setter |
149
+ | `toggleColorScheme` | `() => void` | Flips blue ↔ purple |
150
+ | `isBlue` | `boolean` | `true` when scheme is `"blue"` |
151
+ | `isPurple` | `boolean` | `true` when scheme is `"purple"` |
152
+
153
+ ## DashboardLayout
154
+
155
+ The full-screen authenticated application shell. Renders a fixed sidebar, sticky top bar, and an optional mobile bottom nav.
156
+
157
+ ### Basic usage
158
+
159
+ ```tsx
160
+ import { DashboardLayout } from "@medixdeck/ui";
161
+
162
+ <DashboardLayout
163
+ colorScheme="purple"
164
+ user={{ name: "Dr. Okedi Williams", email: "williams@medixdeck.com" }}
165
+ navGroups={[
166
+ {
167
+ items: [
168
+ { label: "Home", href: "/", isActive: true },
169
+ { label: "Messages", href: "/messages", badge: 6 },
170
+ ],
171
+ },
172
+ {
173
+ groupLabel: "Account",
174
+ items: [
175
+ { label: "Profile", href: "/profile" },
176
+ { label: "Notifications", href: "/notifications", hasDot: true },
177
+ ],
178
+ },
179
+ ]}
180
+ onLogout={() => auth.signOut()}
181
+ renderLink={(item, children) => <Link href={item.href}>{children}</Link>}
182
+ >
183
+ {/* page content */}
184
+ </DashboardLayout>
185
+ ```
186
+
187
+ ### Mobile bottom navigation (`mobileNavItems`)
188
+
189
+ A fixed bottom tab bar (mobile only, hidden on `md+`). Uses `react-icons/lu` or any icon component.
190
+
191
+ ```tsx
192
+ import { LuHouse, LuMessageCircle, LuUser } from "react-icons/lu";
193
+
194
+ <DashboardLayout
195
+ mobileNavItems={[
196
+ { label: "Home", href: "/", icon: <LuHouse size={22} />, isActive: true },
197
+ { label: "Messages", href: "/messages", icon: <LuMessageCircle size={22} />, badge: 6 },
198
+ { label: "Profile", href: "/profile", icon: <LuUser size={22} /> },
199
+ ]}
200
+ >
201
+ {/* ... */}
202
+ </DashboardLayout>
203
+ ```
204
+
205
+ `DashboardMobileNavItem` props:
206
+
207
+ | Prop | Type | Required | Description |
208
+ | --- | --- | --- | --- |
209
+ | `label` | `string` | ✓ | Text below the icon |
210
+ | `href` | `string` | ✓ | Unique key + navigation target |
211
+ | `icon` | `ReactNode` | ✓ | Icon (22 × 22 px recommended) |
212
+ | `isActive` | `boolean` | — | Highlights the active tab |
213
+ | `badge` | `number` | — | Count bubble on icon (capped at `99+`) |
214
+
215
+ ### Doctor score card (`scoreCard`)
216
+
217
+ Shown above the sidebar nav on **desktop only**. Only pass this prop for doctor-role users.
218
+
219
+ ```tsx
220
+ <DashboardLayout
221
+ scoreCard={{
222
+ name: "Dr. Okedi Williams",
223
+ role: "Cardiologist",
224
+ avatarSrc: "/dr-okedi.jpg", // optional — initials fallback
225
+ tier: "gold", // "bronze" | "silver" | "gold" | "platinum" | "diamond"
226
+ medixScore: 847,
227
+ link: "/doctor/profile", // optional — makes the card clickable
228
+ }}
229
+ >
230
+ {/* ... */}
231
+ </DashboardLayout>
232
+ ```
233
+
234
+ Tier colours:
235
+
236
+ | Tier | Label colour | Avatar ring |
237
+ | --- | --- | --- |
238
+ | `bronze` | `#92400E` | `#D97706` |
239
+ | `silver` | `#475569` | `#94A3B8` |
240
+ | `gold` | `#D97706` | `#F59E0B` |
241
+ | `platinum` | `#0284C7` | `#38BDF8` |
242
+ | `diamond` | `#7C3AED` | `#A78BFA` |
243
+
244
+ ### Greeting subtitle (`greetingSubtext`)
245
+
246
+ An optional second line below the greeting. The top bar expands from 64 px → 80 px automatically.
247
+
248
+ ```tsx
249
+ <DashboardLayout
250
+ greetingSubtext={`${new Date().toLocaleDateString("en-GB", {
251
+ weekday: "long", day: "numeric", month: "long", year: "numeric",
252
+ })} · 8 consultations scheduled today`}
253
+ >
254
+ {/* ... */}
255
+ </DashboardLayout>
256
+ ```
257
+
258
+ ### All `DashboardLayout` props
259
+
260
+ | Prop | Type | Default | Description |
261
+ | --- | --- | --- | --- |
262
+ | `user` | `DashboardUser` | — | Name, email, optional avatar |
263
+ | `navGroups` | `DashboardNavGroup[]` | — | Sidebar navigation tree |
264
+ | `colorScheme` | `"blue" \| "purple"` | `"blue"` | Brand accent colour |
265
+ | `logo` | `ReactNode` | `<Logo />` | Override the sidebar logo |
266
+ | `greeting` | `string` | auto | Override "Good morning / afternoon / evening" |
267
+ | `greetingSubtext` | `string` | — | Subtitle line below the greeting |
268
+ | `mobileNavItems` | `DashboardMobileNavItem[]` | — | Mobile bottom tab bar items |
269
+ | `scoreCard` | `DashboardScoreCardData` | — | Doctor identity card (desktop only) |
270
+ | `topBarSlot` | `ReactNode` | — | Slot right of greeting (search, bell, etc.) |
271
+ | `dropdownItems` | `DashboardDropdownItem[]` | — | Extra user dropdown items |
272
+ | `sidebarWidth` | `number` | `220` | Sidebar width in px |
273
+ | `renderLink` | `(item, children) => ReactNode` | `<a>` | Router integration |
274
+ | `onLogout` | `() => void` | — | Logout callback |
275
+
276
+ ## Footer
277
+
278
+ The `Footer` component provides the core navigation layout for the bottom of pages. It features an optional compliance `certifications` row and a brandable `colorScheme`.
279
+
280
+ ```tsx
281
+ import { Footer } from "@medixdeck/ui";
282
+
283
+ <Footer
284
+ colorScheme="purple"
285
+ certifications={[
286
+ { name: "NDPR Compliant", href: "https://nitda.gov.ng" },
287
+ { name: "MDCN Certified Platform", href: "https://mdcn.gov.ng" },
288
+ { name: "ISO 27001", href: "#" },
289
+ ]}
290
+ />
291
+ ```
292
+
293
+ | Prop | Type | Default | Description |
294
+ | --- | --- | --- | --- |
295
+ | `colorScheme` | `"blue" \| "purple"` | `"blue"` | Brand accent colour for links and social icons |
296
+ | `certifications` | `FooterCertification[]` | — | Compliance badges displayed above the copyright |
297
+ | `logo` | `ReactNode` | `<Logo />` | Override the default logo |
298
+ | `description` | `string` | — | Short company bio |
299
+ | `sections` | `FooterSection[]` | — | Link columns |
300
+ | `socialLinks` | `SocialLink[]` | — | Social media URLs |
301
+ | `newsletter` | `NewsletterProps` | — | Email subscription form config |
302
+ | `bottomLinks` | `BottomLink[]` | — | Terms/Privacy links next to copyright |
303
+ | `renderLink` | `(item, children) => ReactNode` | `<a>` | Router integration |
304
+
102
305
  ## Theme color reference
103
306
 
307
+
104
308
  ```tsx
105
309
  import { ThemeColorPalette } from "@medixdeck/ui";
106
310