@medixdeck/ui 0.1.23 → 0.1.24

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,7 +58,7 @@ export function App() {
58
58
  | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
59
59
  | Provider + theme | `MedixProvider`, `useThemeMode`, `useIsDarkMode`, `useColorScheme`, `system`, `medixConfig`, token exports |
60
60
  | Primitive | `Button`, `IconButton`, `Badge`, `Avatar`, `AvatarGroup`, `Spinner`, `FullPageSpinner`, `Tag`, `Divider`, `Logo` |
61
- | Form | `Input`, `SearchInput`, `Textarea`, `Select`, `Checkbox`, `RadioGroup`, `Switch`, `FormControl`, `OTPInput`, `PinInput`, `PhoneInput`, `DatePicker`, `DateRangePicker`, `Calendar`, `Combobox`, `FileUpload`, `TagsInput`, `TagInput`, `RichTextInput`, `RichTextEditor` |
61
+ | Form | `Input`, `SearchInput`, `Textarea`, `Select`, `Checkbox`, `RadioGroup`, `Switch`, `FormControl`, `OTPInput`, `PinInput`, `PhoneInput`, `DatePicker`, `DateRangePicker`, `Calendar`, `Combobox`, `FileUpload`, `TagsInput`, `TagInput`, `clearTextareaDraft`, `getTextareaDraft`, `saveTextareaDraft`, `RichTextInput`, `RichTextEditor`, `clearRichTextDraft`, `getRichTextDraft`, `saveRichTextDraft` |
62
62
  | Layout | `Card`, `CardHeader`, `CardBody`, `CardFooter`, `StatCard`, `Container`, `SectionHeader`, `ThemeColorPalette`, `DashboardLayout`, `Footer` |
63
63
  | Navigation | `Navbar`, `Breadcrumb`, `Tabs`, `Pagination`, `Stepper` |
64
64
  | Feedback | `Alert`, `Skeleton`, `SkeletonText`, `SkeletonCard`, `Progress`, `Modal`, `Drawer`, `Tooltip`, `EmptyState`, `NotFoundPage`, `ServerErrorPage`, `Toaster`, `toast`, `dismissToast`, `CookieConsentBanner`, `PWAInstallPrompt` |
@@ -209,30 +209,80 @@ The `Select` component supports native multiple selection, returning arrays on c
209
209
  />
210
210
  ```
211
211
 
212
+ ### Textarea
213
+
214
+ Multi-line text input with character limit tracking, error states, and **automatic draft persistence to `localStorage`** across page refreshes (`persistDraft = true`).
215
+
216
+ ```tsx
217
+ import { Textarea, clearTextareaDraft } from '@medixdeck/ui';
218
+
219
+ function SymptomForm() {
220
+ const [symptoms, setSymptoms] = React.useState('');
221
+
222
+ const handleSubmit = async (e: React.FormEvent) => {
223
+ e.preventDefault();
224
+ await submitSymptoms(symptoms);
225
+ // Clear saved draft from localStorage after successful submission
226
+ clearTextareaDraft('patient-symptoms-input');
227
+ setSymptoms('');
228
+ };
229
+
230
+ return (
231
+ <form onSubmit={handleSubmit}>
232
+ <Textarea
233
+ storageKey="patient-symptoms-input"
234
+ placeholder="Describe your symptoms in detail…"
235
+ rows={4}
236
+ maxLength={500}
237
+ showCount
238
+ showDraftStatus // displays "Saving draft..." / "Draft saved" in footer
239
+ value={symptoms}
240
+ onChange={(e) => setSymptoms(e.target.value)}
241
+ />
242
+ <button type="submit">Submit</button>
243
+ </form>
244
+ );
245
+ }
246
+ ```
247
+
212
248
  ### Rich Text Input (`RichTextInput` / `RichTextEditor`)
213
249
 
214
- A fully-featured rich text editor powered by TipTap (ProseMirror). Supports headings, formatting, lists, links, alignment, custom color schemes, character limit tracking, and height boundaries (`minHeight`, `maxHeight`).
250
+ A fully-featured rich text editor powered by TipTap (ProseMirror). Supports headings, formatting, lists, links, alignment, custom color schemes, character limit tracking, height boundaries (`minHeight`, `maxHeight`), and **automatic draft persistence to `localStorage`** across page refreshes.
215
251
 
216
252
  Requires optional peer dependencies (`@tiptap/*`).
217
253
 
218
254
  ```tsx
219
- import { RichTextInput } from '@medixdeck/ui';
255
+ import { RichTextInput, clearRichTextDraft } from '@medixdeck/ui';
220
256
 
221
257
  function NotesForm() {
222
- const [content, setContent] = React.useState('<p>Initial clinical note...</p>');
258
+ const [content, setContent] = React.useState('');
259
+
260
+ const handleSubmit = async (e: React.FormEvent) => {
261
+ e.preventDefault();
262
+ await saveNotesToApi(content);
263
+ // Clear the saved draft from localStorage upon successful submission
264
+ clearRichTextDraft('clinical-notes-form');
265
+ setContent('');
266
+ };
223
267
 
224
268
  return (
225
- <RichTextInput
226
- label="Clinical Notes"
227
- value={content}
228
- onChange={setContent}
229
- colorScheme="purple"
230
- placeholder="Type clinical notes..."
231
- minHeight="180px"
232
- maxHeight="400px"
233
- showCharCount
234
- maxLength={1000}
235
- />
269
+ <form onSubmit={handleSubmit}>
270
+ <RichTextInput
271
+ storageKey="clinical-notes-form"
272
+ label="Clinical Notes"
273
+ value={content}
274
+ onChange={setContent}
275
+ colorScheme="purple"
276
+ placeholder="Type clinical notes..."
277
+ minHeight="180px"
278
+ maxHeight="400px"
279
+ persistDraft // defaults to true
280
+ showDraftStatus // displays "Saving draft..." / "Draft saved" in footer
281
+ showCharCount
282
+ maxLength={1000}
283
+ />
284
+ <button type="submit">Save Notes</button>
285
+ </form>
236
286
  );
237
287
  }
238
288
  ```
@@ -333,6 +383,7 @@ import { DashboardLayout } from '@medixdeck/ui';
333
383
  items: [
334
384
  { label: 'Home', href: '/', isActive: true },
335
385
  { label: 'Messages', href: '/messages', badge: 6 },
386
+ { label: 'My Schedule', href: '/schedule', isNew: true },
336
387
  ],
337
388
  },
338
389
  {
@@ -350,6 +401,19 @@ import { DashboardLayout } from '@medixdeck/ui';
350
401
  </DashboardLayout>;
351
402
  ```
352
403
 
404
+ `DashboardNavItem` props:
405
+
406
+ | Prop | Type | Required | Description |
407
+ | ---------- | -------------------- | -------- | ------------------------------------------------------------------------------------------- |
408
+ | `label` | `string` | ✓ | Display label for the sidebar link |
409
+ | `href` | `string` | ✓ | Identifier or URL passed to `renderLink` and used as unique key |
410
+ | `icon` | `ReactNode` | — | Optional icon element |
411
+ | `badge` | `number` | — | Numeric count badge displayed to the right of the label |
412
+ | `hasDot` | `boolean` | — | Red dot indicator for unread alerts or notifications |
413
+ | `isNew` | `boolean` | — | "NEW" pill badge matching the active `colorScheme` (`blue` or `purple`) |
414
+ | `isActive` | `boolean` | — | Marks this item as the active navigation route |
415
+ | `subItems` | `DashboardNavItem[]` | — | Nested sub-links that expand/collapse in an accordion menu |
416
+
353
417
  ### Mobile bottom navigation (`mobileNavItems`)
354
418
 
355
419
  A fixed bottom tab bar (mobile only, hidden on `md+`). Uses `react-icons/lu` or any icon component.