@medixdeck/ui 0.1.25 → 0.1.27

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/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 MedixDeck
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 MedixDeck
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # @medixdeck/ui
2
2
 
3
- > Shared React UI component library for MedixDeck, published as `@medixdeck/ui`.
3
+ React components and design tokens for MedixDeck applications, built with
4
+ TypeScript and Chakra UI v3. Includes forms, navigation, dashboards, feedback,
5
+ healthcare components, and light/dark themes.
4
6
 
7
+ [![npm](https://img.shields.io/npm/v/@medixdeck/ui)](https://www.npmjs.com/package/@medixdeck/ui)
5
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue)](https://www.typescriptlang.org/)
6
9
  [![Chakra UI](https://img.shields.io/badge/Chakra%20UI-v3-teal)](https://chakra-ui.com/)
7
10
  [![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE)
8
11
 
9
- `@medixdeck/ui` is a Vite library-mode package built with React 18, TypeScript 5, Chakra UI v3, semantic design tokens, and dual ESM/CJS output for npm publishing.
12
+ ## Features
13
+
14
+ - Typed component props and named exports.
15
+ - Shared blue/purple palettes and semantic design tokens.
16
+ - Responsive navigation, dashboard layouts, and healthcare components.
17
+ - Light, dark, and system color modes.
18
+ - Server rendering support, with ESM, CommonJS, and TypeScript declarations.
10
19
 
11
20
  ## Install
12
21
 
@@ -18,6 +27,9 @@ npm install @medixdeck/ui @chakra-ui/react react react-dom
18
27
  npm install @tiptap/react @tiptap/pm @tiptap/starter-kit @tiptap/extension-link @tiptap/extension-underline @tiptap/extension-text-align @tiptap/extension-placeholder
19
28
  ```
20
29
 
30
+ Requires React and React DOM 18 or newer, Chakra UI 3 or newer, and Node.js
31
+ 20.19 or newer for server rendering. Keep React and React DOM on matching versions.
32
+
21
33
  ## Quick start
22
34
 
23
35
  ```tsx
@@ -66,14 +78,15 @@ export function App() {
66
78
  | Healthcare | `DoctorCard`, `VitalBadge`, `AppointmentCard` |
67
79
  | Chakra re-exports | `Box`, `Flex`, `Grid`, `Stack`, `Text`, `Heading`, `Link`, `Image`, `Icon`, `Center`, `Wrap`, `WrapItem`, others in `lib/index.ts` |
68
80
 
69
- ## Design-system rules
81
+ ## Styling and server rendering
70
82
 
71
- - Use Chakra UI **v3** APIs only.
72
- - All library source lives in `lib\`; `src\` is dev-preview only.
73
- - Use semantic tokens such as `bg.surface`, `text.heading`, and `border` instead of raw hex for normal component styling.
74
- - **No `boxShadow` / `shadow`**: Do NOT use `boxShadow`, `shadow`, `card-light`, or `card-dark` props. Rely on clean borders (`border="1px solid" borderColor="border"`) for visual separation.
75
- - For color-critical interactive controls, prefer the repo's native-first pattern instead of Chakra recipes.
76
- - Apply dark mode on `document.documentElement`, not an inner container.
83
+ Wrap your application in `MedixProvider` once to enable shared tokens, fonts,
84
+ theme preferences, and toast notifications. Use semantic tokens such as
85
+ `bg.surface`, `text.heading`, and `border` when styling with Chakra props.
86
+
87
+ In Next.js App Router, place interactive components inside a `"use client"`
88
+ boundary. Theme-dependent labels should wait for `useThemeMode().mounted` as in
89
+ the quick start. The rich text editor initializes after hydration.
77
90
 
78
91
  ## Theme hooks
79
92
 
@@ -153,20 +166,14 @@ function Page() {
153
166
 
154
167
  ### Toast Notifications
155
168
 
156
- The MedixDeck UI includes a fully automated `Toast` system powered by Chakra UI v3's `createToaster` API, styled to match MedixDeck `Alert` components.
157
-
158
- To use it, render the `<Toaster />` at the root of your application, and then use the `toast` helper to trigger notifications from anywhere.
169
+ `MedixProvider` includes the toast host. Use the `toast` helper to trigger
170
+ notifications from components inside your application.
159
171
 
160
172
  ```tsx
161
- import { Toaster, toast } from '@medixdeck/ui';
173
+ import { toast } from '@medixdeck/ui';
162
174
 
163
- function App() {
164
- return (
165
- <>
166
- <Toaster />
167
- <button onClick={() => toast.success('Changes saved successfully!')}>Save</button>
168
- </>
169
- );
175
+ function SaveButton() {
176
+ return <button onClick={() => toast.success('Changes saved successfully!')}>Save</button>;
170
177
  }
171
178
  ```
172
179
 
@@ -180,6 +187,7 @@ The `toast` utility exposes `success`, `error`, `info`, and `warning` shorthand
180
187
  <ServerErrorPage
181
188
  errorMessage="TypeError: Cannot read properties of undefined (reading 'id')"
182
189
  onAction={() => reset()}
190
+ colorScheme="purple" // "blue" | "purple", default "blue" — buttons (and the 404 watermark) follow the scheme; the 500 error icon stays red
183
191
  />
184
192
  ```
185
193
 
@@ -187,7 +195,8 @@ The `toast` utility exposes `success`, `error`, `info`, and `warning` shorthand
187
195
 
188
196
  ### Accordion with HTML/Markdown
189
197
 
190
- The `Accordion` supports passing rich text answers via the `answerType` prop. Use `"HTML"` (safely sanitized via `isomorphic-dompurify`) or `"MD"` (parsed via `react-markdown`).
198
+ The `Accordion` supports rich text answers through `answerType`: use `"HTML"` for
199
+ sanitized HTML or `"MD"` for Markdown.
191
200
 
192
201
  ```tsx
193
202
  <Accordion
@@ -452,8 +461,8 @@ Shown above the sidebar nav on **desktop only**. Only pass this prop for doctor-
452
461
  name: 'Dr. Okedi Williams',
453
462
  role: 'Cardiologist',
454
463
  avatarSrc: '/dr-okedi.jpg', // optional — initials fallback
455
- tier: 'gold', // "bronze" | "silver" | "gold" | "platinum" | "diamond"
456
- medixScore: 847,
464
+ tier: 'gold', // "bronze" | "silver" | "gold" | "platinum" | "elite-i" | "elite-ii" | "elite-iii" | "elite-iv" | "elite-v"
465
+ medixScore: 8470,
457
466
  link: '/doctor/profile', // optional — makes the card clickable
458
467
  }}
459
468
  >
@@ -461,15 +470,21 @@ Shown above the sidebar nav on **desktop only**. Only pass this prop for doctor-
461
470
  </DashboardLayout>
462
471
  ```
463
472
 
464
- Tier colours:
473
+ Tiers mirror the backend `MEDIX_SCORE_TIER` bands. Use `getMedixScoreTierForScore(score)` to resolve a tier key from a raw balance.
474
+
475
+ Tier colours and score bands:
465
476
 
466
- | Tier | Label colour | Avatar ring |
467
- | ---------- | ------------ | ----------- |
468
- | `bronze` | `#92400E` | `#D97706` |
469
- | `silver` | `#475569` | `#94A3B8` |
470
- | `gold` | `#D97706` | `#F59E0B` |
471
- | `platinum` | `#0284C7` | `#38BDF8` |
472
- | `diamond` | `#7C3AED` | `#A78BFA` |
477
+ | Tier | Level | Score band | Label colour | Avatar ring |
478
+ | ----------- | :---: | ----------------- | ------------ | ----------- |
479
+ | `bronze` | 1 | 0 – 999 | `#92400E` | `#D97706` |
480
+ | `silver` | 2 | 1,000 – 4,999 | `#475569` | `#94A3B8` |
481
+ | `gold` | 3 | 5,000 – 14,999 | `#D97706` | `#F59E0B` |
482
+ | `platinum` | 4 | 15,000 – 39,999 | `#0284C7` | `#38BDF8` |
483
+ | `elite-i` | 5 | 40,000 – 59,999 | `#6D28D9` | `#8B5CF6` |
484
+ | `elite-ii` | 6 | 60,000 – 79,999 | `#7C3AED` | `#A78BFA` |
485
+ | `elite-iii` | 7 | 80,000 – 119,999 | `#7700CC` | `#A855F7` |
486
+ | `elite-iv` | 8 | 120,000 – 199,999 | `#5B21B6` | `#7C3AED` |
487
+ | `elite-v` | 9 | 200,000+ | `#4C1D95` | `#6D28D9` |
473
488
 
474
489
  ### Greeting subtitle (`greetingSubtext`)
475
490
 
@@ -648,63 +663,12 @@ export function DesignTokensPage() {
648
663
 
649
664
  `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.
650
665
 
651
- ## Repository index
652
-
653
- ```txt
654
- lib\ library source and npm entrypoint
655
- src\ local showcase app only
656
- .github\workflows\publish.yml npm publish workflow
657
- AGENTS.md full multi-agent repo guide
658
- COPILOT.md concise AI contributor guide
659
- .github\copilot-instructions.md GitHub Copilot repo instructions
660
- CONTRIBUTING.md contributor workflow
661
- CHANGELOG.md release history
662
- LICENSE package license
663
- package.json npm metadata and scripts
664
- ```
666
+ ## Contributing
665
667
 
666
- ## Development commands
668
+ See [CONTRIBUTING.md](./CONTRIBUTING.md) for local setup, development, testing, and contribution guidelines.
667
669
 
668
- ```bash
669
- npm run dev
670
- npm run build
671
- npm run test
672
- npm run pack:check
673
- ```
670
+ See [CHANGELOG.md](./CHANGELOG.md) for release notes. Report bugs and request features through [GitHub Issues](https://github.com/medixdeck/medixdeck-ui/issues).
674
671
 
675
- ## Publishing notes
676
-
677
- - The package publishes from `dist\` with ESM, CJS, sourcemaps, and `.d.ts` declarations.
678
- - Public API changes must stay in sync across `lib\index.ts`, `README.md`, `src\App.tsx`, Storybook stories, and `CHANGELOG.md`.
679
- - The GitHub Actions workflow installs dependencies, runs build and test checks, performs `npm pack --dry-run`, and then publishes to npm.
680
-
681
- ## Project structure
682
-
683
- ```txt
684
- medixdeck-ui\
685
- ├── lib\
686
- │ ├── index.ts
687
- │ ├── theme\
688
- │ └── components\
689
- │ ├── provider\
690
- │ ├── primitive\
691
- │ ├── form\
692
- │ ├── layout\
693
- │ ├── navigation\
694
- │ ├── feedback\
695
- │ ├── data\
696
- │ └── healthcare\
697
- ├── src\
698
- ├── .github\
699
- │ ├── copilot-instructions.md
700
- │ └── workflows\publish.yml
701
- ├── AGENTS.md
702
- ├── COPILOT.md
703
- ├── CONTRIBUTING.md
704
- ├── CHANGELOG.md
705
- ├── LICENSE
706
- ├── package.json
707
- ├── vite.config.ts
708
- ├── vitest.config.ts
709
- └── tsconfig.build.json
710
- ```
672
+ ## License
673
+
674
+ MIT © MedixDeck Team. See [LICENSE](./LICENSE).