@medixdeck/ui 0.1.23 → 0.1.25

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/dist/index.d.ts CHANGED
@@ -442,6 +442,16 @@ export declare interface CheckboxProps {
442
442
  id?: string;
443
443
  }
444
444
 
445
+ /**
446
+ * Safely removes a saved draft from localStorage.
447
+ */
448
+ export declare function clearRichTextDraft(storageKey: string): void;
449
+
450
+ /**
451
+ * Safely removes a saved draft from localStorage.
452
+ */
453
+ export declare function clearTextareaDraft(storageKey: string): void;
454
+
445
455
  declare const COLORS: {
446
456
  readonly blue: {
447
457
  readonly solid: "#0685FF";
@@ -1058,6 +1068,8 @@ export declare interface DashboardMobileNavItem {
1058
1068
  isActive?: boolean;
1059
1069
  /** Numeric count badge shown on the icon (capped at 99+). */
1060
1070
  badge?: number;
1071
+ /** Optional "NEW" indicator dot shown on the icon when no count badge exists. */
1072
+ isNew?: boolean;
1061
1073
  }
1062
1074
 
1063
1075
  export declare interface DashboardNavGroup {
@@ -1078,6 +1090,12 @@ export declare interface DashboardNavItem {
1078
1090
  badge?: number;
1079
1091
  /** Red dot indicator (e.g. for unread notifications). */
1080
1092
  hasDot?: boolean;
1093
+ /**
1094
+ * "NEW" badge indicator shown to the right of the label.
1095
+ * Matches the badge style with background and color derived from `colorScheme` (`blue` or `purple`).
1096
+ * In collapsed rail mode, renders a scheme-colored dot indicator and adds "(NEW)" to the tooltip.
1097
+ */
1098
+ isNew?: boolean;
1081
1099
  /** Mark this item as the currently active route. */
1082
1100
  isActive?: boolean;
1083
1101
  /** Optional nested sub-items (creates an expandable dropdown accordion). */
@@ -1317,6 +1335,8 @@ export declare interface DoctorCardProps extends BoxProps {
1317
1335
  variant?: 'standard' | 'compact' | 'featured';
1318
1336
  }
1319
1337
 
1338
+ export declare const DRAFT_STORAGE_PREFIX = "medix_rte_draft_";
1339
+
1320
1340
  /**
1321
1341
  * MedixDeck Drawer
1322
1342
  *
@@ -1542,6 +1562,26 @@ export declare function FullPageSpinner({ label }: {
1542
1562
  label?: string;
1543
1563
  }): JSX_2.Element;
1544
1564
 
1565
+ /**
1566
+ * Returns the effective localStorage key for a RichTextInput instance.
1567
+ */
1568
+ export declare function getEffectiveStorageKey(storageKey?: string, id?: string, name?: string, label?: string): string;
1569
+
1570
+ /**
1571
+ * Returns the effective localStorage key for a Textarea instance.
1572
+ */
1573
+ export declare function getEffectiveTextareaStorageKey(storageKey?: string, id?: string, name?: string, placeholder?: string): string;
1574
+
1575
+ /**
1576
+ * Safely retrieves a saved draft from localStorage.
1577
+ */
1578
+ export declare function getRichTextDraft(storageKey: string, maxAgeMs?: number): RichTextDraftPayload | null;
1579
+
1580
+ /**
1581
+ * Safely retrieves a saved draft from localStorage.
1582
+ */
1583
+ export declare function getTextareaDraft(storageKey: string, maxAgeMs?: number): TextareaDraftPayload | null;
1584
+
1545
1585
  export { Grid }
1546
1586
 
1547
1587
  export { GridItem }
@@ -2459,6 +2499,19 @@ export declare interface RadioOption {
2459
2499
  disabled?: boolean;
2460
2500
  }
2461
2501
 
2502
+ export declare interface RichTextDraftPayload {
2503
+ /** The saved text/HTML/Markdown content */
2504
+ content: string;
2505
+ /** Active editor composition mode when saved */
2506
+ mode: RichTextInputMode;
2507
+ /** Format of the saved content */
2508
+ format: RichTextInputFormat;
2509
+ /** Timestamp when draft was last written to localStorage (milliseconds) */
2510
+ updatedAt: number;
2511
+ /** Schema version */
2512
+ version: 1;
2513
+ }
2514
+
2462
2515
  /** Alias for RichTextInput */
2463
2516
  export declare const RichTextEditor: typeof RichTextInput;
2464
2517
 
@@ -2476,7 +2529,7 @@ export declare const RichTextEditor: typeof RichTextInput;
2476
2529
  * <RichTextInput outputFormat="markdown" onChange={setMarkdown} />
2477
2530
  * ```
2478
2531
  */
2479
- export declare function RichTextInput({ value, defaultValue, onChange, onMarkdownChange, onHtmlChange, outputFormat, defaultMode, mode: controlledMode, onModeChange, showModeToggle, placeholder, label, helperText, errorMessage, isInvalid, disabled, colorScheme, minHeight, maxHeight, maxLength, showCharCount, toolbarOptions, className, }: RichTextInputProps): JSX_2.Element;
2532
+ export declare function RichTextInput({ id, name, value, defaultValue, onChange, onMarkdownChange, onHtmlChange, outputFormat, defaultMode, mode: controlledMode, onModeChange, showModeToggle, placeholder, label, helperText, errorMessage, isInvalid, disabled, colorScheme, minHeight, maxHeight, maxLength, showCharCount, toolbarOptions, className, storageKey, persistDraft, debounceMs, draftMaxAgeMs, showDraftStatus, onDraftRestored, }: RichTextInputProps): JSX_2.Element;
2480
2533
 
2481
2534
  export declare namespace RichTextInput {
2482
2535
  var displayName: string;
@@ -2487,6 +2540,10 @@ export declare type RichTextInputFormat = 'html' | 'markdown';
2487
2540
  export declare type RichTextInputMode = 'wysiwyg' | 'markdown';
2488
2541
 
2489
2542
  export declare interface RichTextInputProps {
2543
+ /** Optional HTML element id */
2544
+ id?: string;
2545
+ /** Optional form field name */
2546
+ name?: string;
2490
2547
  /** Content string (HTML or Markdown depending on outputFormat) */
2491
2548
  value?: string;
2492
2549
  /** Default content string (uncontrolled) */
@@ -2533,8 +2590,47 @@ export declare interface RichTextInputProps {
2533
2590
  toolbarOptions?: ToolbarOptions;
2534
2591
  /** Additional CSS class on the wrapper */
2535
2592
  className?: string;
2593
+ /**
2594
+ * Unique storage key for persisting drafts to localStorage.
2595
+ * If omitted, falls back to `id`, `name`, or `label` slug.
2596
+ */
2597
+ storageKey?: string;
2598
+ /**
2599
+ * Automatically save typed content to localStorage to prevent data loss on page refresh.
2600
+ * Defaults to `true`. Set to `false` to disable.
2601
+ */
2602
+ persistDraft?: boolean;
2603
+ /**
2604
+ * Milliseconds of typing inactivity before writing draft to localStorage.
2605
+ * @default 400
2606
+ */
2607
+ debounceMs?: number;
2608
+ /**
2609
+ * Maximum age of a saved draft in ms before it is considered expired.
2610
+ * @default 604800000 (7 days)
2611
+ */
2612
+ draftMaxAgeMs?: number;
2613
+ /**
2614
+ * Display a subtle "Saving draft..." / "Draft saved" status in the footer.
2615
+ * @default false
2616
+ */
2617
+ showDraftStatus?: boolean;
2618
+ /**
2619
+ * Callback invoked when a saved draft is restored from localStorage on mount.
2620
+ */
2621
+ onDraftRestored?: (draft: RichTextDraftPayload) => void;
2536
2622
  }
2537
2623
 
2624
+ /**
2625
+ * Safely writes a draft to localStorage.
2626
+ */
2627
+ export declare function saveRichTextDraft(storageKey: string, payload: RichTextDraftPayload): void;
2628
+
2629
+ /**
2630
+ * Safely writes a draft to localStorage.
2631
+ */
2632
+ export declare function saveTextareaDraft(storageKey: string, payload: TextareaDraftPayload): void;
2633
+
2538
2634
  export declare const SearchInput: default_2.ForwardRefExoticComponent<SearchInputProps & default_2.RefAttributes<HTMLInputElement>>;
2539
2635
 
2540
2636
  /**
@@ -3092,7 +3188,8 @@ export { Text_2 as Text }
3092
3188
  /**
3093
3189
  * MedixDeck Textarea
3094
3190
  *
3095
- * Multi-line text input for notes, messages, and descriptions.
3191
+ * Multi-line text input for notes, messages, and descriptions with automatic
3192
+ * localStorage draft persistence to prevent data loss on page refresh.
3096
3193
  *
3097
3194
  * @example
3098
3195
  * ```tsx
@@ -3101,6 +3198,17 @@ export { Text_2 as Text }
3101
3198
  */
3102
3199
  export declare const Textarea: default_2.ForwardRefExoticComponent<TextareaProps & default_2.RefAttributes<HTMLTextAreaElement>>;
3103
3200
 
3201
+ export declare const TEXTAREA_DRAFT_PREFIX = "medix_textarea_draft_";
3202
+
3203
+ export declare interface TextareaDraftPayload {
3204
+ /** The saved textarea content */
3205
+ content: string;
3206
+ /** Timestamp when draft was last written to localStorage (milliseconds) */
3207
+ updatedAt: number;
3208
+ /** Schema version */
3209
+ version: 1;
3210
+ }
3211
+
3104
3212
  export declare interface TextareaProps extends TextareaProps_2 {
3105
3213
  /** Brand color scheme ('blue' | 'purple') */
3106
3214
  colorScheme?: 'blue' | 'purple';
@@ -3112,6 +3220,35 @@ export declare interface TextareaProps extends TextareaProps_2 {
3112
3220
  maxLength?: number;
3113
3221
  /** Show remaining character count */
3114
3222
  showCount?: boolean;
3223
+ /**
3224
+ * Unique storage key for persisting drafts to localStorage.
3225
+ * If omitted, falls back to `id`, `name`, or slugified `placeholder`.
3226
+ */
3227
+ storageKey?: string;
3228
+ /**
3229
+ * Automatically save typed content to localStorage to prevent data loss on page refresh.
3230
+ * Defaults to `true`. Set to `false` to disable.
3231
+ */
3232
+ persistDraft?: boolean;
3233
+ /**
3234
+ * Milliseconds of typing inactivity before writing draft to localStorage.
3235
+ * @default 400
3236
+ */
3237
+ debounceMs?: number;
3238
+ /**
3239
+ * Maximum age of a saved draft in ms before it is considered expired.
3240
+ * @default 604800000 (7 days)
3241
+ */
3242
+ draftMaxAgeMs?: number;
3243
+ /**
3244
+ * Display a subtle "Saving draft..." / "Draft saved" status in the footer.
3245
+ * @default false
3246
+ */
3247
+ showDraftStatus?: boolean;
3248
+ /**
3249
+ * Callback invoked when a saved draft is restored from localStorage on mount.
3250
+ */
3251
+ onDraftRestored?: (draft: TextareaDraftPayload) => void;
3115
3252
  }
3116
3253
 
3117
3254
  /**