@medixdeck/ui 0.1.3 → 0.1.6
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 +21 -0
- package/README.md +82 -415
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +359 -0
- package/dist/index.js +4458 -3040
- package/dist/index.js.map +1 -1
- package/package.json +20 -5
package/dist/index.d.ts
CHANGED
|
@@ -212,6 +212,12 @@ export declare interface BlogCardProps extends Omit<BoxProps, "onClick"> {
|
|
|
212
212
|
onClick?: () => void;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
export declare interface BottomLink {
|
|
216
|
+
label: string;
|
|
217
|
+
href: string;
|
|
218
|
+
isExternal?: boolean;
|
|
219
|
+
}
|
|
220
|
+
|
|
215
221
|
export { Box }
|
|
216
222
|
|
|
217
223
|
/**
|
|
@@ -583,6 +589,25 @@ export declare interface Column<T = Record<string, unknown>> {
|
|
|
583
589
|
align?: "left" | "center" | "right";
|
|
584
590
|
}
|
|
585
591
|
|
|
592
|
+
export declare function Combobox({ options, value, onChange, placeholder, label, helperText, errorMessage, isInvalid, isDisabled, }: ComboboxProps): JSX_2.Element;
|
|
593
|
+
|
|
594
|
+
export declare interface ComboboxOption {
|
|
595
|
+
label: string;
|
|
596
|
+
value: string;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
export declare interface ComboboxProps {
|
|
600
|
+
options: ComboboxOption[];
|
|
601
|
+
value?: string;
|
|
602
|
+
onChange?: (value: string) => void;
|
|
603
|
+
placeholder?: string;
|
|
604
|
+
label?: string;
|
|
605
|
+
helperText?: string;
|
|
606
|
+
errorMessage?: string;
|
|
607
|
+
isInvalid?: boolean;
|
|
608
|
+
isDisabled?: boolean;
|
|
609
|
+
}
|
|
610
|
+
|
|
586
611
|
/**
|
|
587
612
|
* MedixDeck Container
|
|
588
613
|
*
|
|
@@ -602,6 +627,176 @@ export declare interface ContainerProps extends BoxProps {
|
|
|
602
627
|
maxWidth?: "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
603
628
|
}
|
|
604
629
|
|
|
630
|
+
export declare interface DashboardDropdownItem {
|
|
631
|
+
/** Label shown in the dropdown menu. */
|
|
632
|
+
label: string;
|
|
633
|
+
/** Optional icon rendered to the left of the label. */
|
|
634
|
+
icon?: default_2.ReactNode;
|
|
635
|
+
/** Called when the item is clicked. */
|
|
636
|
+
onClick?: () => void;
|
|
637
|
+
/** Renders the item in a destructive/danger colour. */
|
|
638
|
+
isDanger?: boolean;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* MedixDeck DashboardLayout
|
|
643
|
+
*
|
|
644
|
+
* A full-page authenticated shell with a fixed sidebar, sticky top bar, and
|
|
645
|
+
* scrollable main content area. Fully responsive — the sidebar is hidden on
|
|
646
|
+
* mobile and revealed via a hamburger toggle.
|
|
647
|
+
*
|
|
648
|
+
* ### Router integration
|
|
649
|
+
* Pass `renderLink` to use your router's `<Link>` component without bringing
|
|
650
|
+
* router dependencies into the library (mirrors the `Navbar` pattern).
|
|
651
|
+
*
|
|
652
|
+
* ### Active state
|
|
653
|
+
* Set `isActive: true` on the `DashboardNavItem` that represents the current
|
|
654
|
+
* route. The active item gets a blue left-accent bar and a tinted background
|
|
655
|
+
* in both light and dark modes.
|
|
656
|
+
*
|
|
657
|
+
* @example
|
|
658
|
+
* ```tsx
|
|
659
|
+
* import { DashboardLayout } from "@medixdeck/ui";
|
|
660
|
+
* import { Link, useLocation } from "react-router-dom";
|
|
661
|
+
*
|
|
662
|
+
* const NAV_GROUPS = [
|
|
663
|
+
* {
|
|
664
|
+
* items: [
|
|
665
|
+
* { label: "Home", href: "/", icon: <HomeIcon /> },
|
|
666
|
+
* { label: "Messages", href: "/messages", icon: <MsgIcon />, badge: 4 },
|
|
667
|
+
* ],
|
|
668
|
+
* },
|
|
669
|
+
* {
|
|
670
|
+
* groupLabel: "Account",
|
|
671
|
+
* items: [
|
|
672
|
+
* { label: "Profile", href: "/profile", icon: <ProfileIcon />, hasDot: true },
|
|
673
|
+
* ],
|
|
674
|
+
* },
|
|
675
|
+
* ];
|
|
676
|
+
*
|
|
677
|
+
* export function Layout({ children }) {
|
|
678
|
+
* const { pathname } = useLocation();
|
|
679
|
+
*
|
|
680
|
+
* const groups = NAV_GROUPS.map((g) => ({
|
|
681
|
+
* ...g,
|
|
682
|
+
* items: g.items.map((item) => ({
|
|
683
|
+
* ...item,
|
|
684
|
+
* isActive: item.href === "/" ? pathname === "/" : pathname.startsWith(item.href),
|
|
685
|
+
* })),
|
|
686
|
+
* }));
|
|
687
|
+
*
|
|
688
|
+
* return (
|
|
689
|
+
* <DashboardLayout
|
|
690
|
+
* navGroups={groups}
|
|
691
|
+
* user={{ name: "Daniel", email: "daniel@medixdeck.com" }}
|
|
692
|
+
* onLogout={() => auth.signOut()}
|
|
693
|
+
* renderLink={(item, children) => <Link to={item.href}>{children}</Link>}
|
|
694
|
+
* >
|
|
695
|
+
* {children}
|
|
696
|
+
* </DashboardLayout>
|
|
697
|
+
* );
|
|
698
|
+
* }
|
|
699
|
+
* ```
|
|
700
|
+
*/
|
|
701
|
+
export declare function DashboardLayout({ children, logo, navGroups, user, greeting, onLogout, renderLink, dropdownItems, topBarSlot, sidebarWidth, ...rest }: DashboardLayoutProps): JSX_2.Element;
|
|
702
|
+
|
|
703
|
+
export declare namespace DashboardLayout {
|
|
704
|
+
var displayName: string;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
export declare interface DashboardLayoutProps extends Omit<BoxProps, "children"> {
|
|
708
|
+
/** Page content rendered inside the main area. */
|
|
709
|
+
children: default_2.ReactNode;
|
|
710
|
+
/**
|
|
711
|
+
* Logo shown at the top of the sidebar.
|
|
712
|
+
* Defaults to `<Logo height={26} />` when omitted.
|
|
713
|
+
*/
|
|
714
|
+
logo?: default_2.ReactNode;
|
|
715
|
+
/**
|
|
716
|
+
* Navigation groups. Each group can have an optional section label and an
|
|
717
|
+
* array of nav items. Items are rendered top-to-bottom with the group label
|
|
718
|
+
* as a separator heading.
|
|
719
|
+
*
|
|
720
|
+
* @example
|
|
721
|
+
* ```tsx
|
|
722
|
+
* navGroups={[
|
|
723
|
+
* { items: [{ label: "Home", href: "/", icon: <HomeIcon />, isActive: true }] },
|
|
724
|
+
* { groupLabel: "Account", items: [{ label: "Profile", href: "/profile", icon: <ProfileIcon /> }] },
|
|
725
|
+
* ]}
|
|
726
|
+
* ```
|
|
727
|
+
*/
|
|
728
|
+
navGroups: DashboardNavGroup[];
|
|
729
|
+
/** Authenticated user displayed in the top-bar user menu. */
|
|
730
|
+
user: DashboardUser;
|
|
731
|
+
/**
|
|
732
|
+
* Override the auto-computed greeting ("Good morning / afternoon / evening").
|
|
733
|
+
* @example greeting="Welcome back"
|
|
734
|
+
*/
|
|
735
|
+
greeting?: string;
|
|
736
|
+
/** Called when the sidebar logout button is clicked. */
|
|
737
|
+
onLogout?: () => void;
|
|
738
|
+
/**
|
|
739
|
+
* Custom link renderer — mirrors the Navbar `renderLink` API.
|
|
740
|
+
* Use this to integrate Next.js `<Link>`, React Router `<Link>`, or TanStack
|
|
741
|
+
* Router without importing those packages inside the library.
|
|
742
|
+
*
|
|
743
|
+
* @example
|
|
744
|
+
* ```tsx
|
|
745
|
+
* // Next.js
|
|
746
|
+
* renderLink={(item, children) => <Link href={item.href}>{children}</Link>}
|
|
747
|
+
* // TanStack Router
|
|
748
|
+
* renderLink={(item, children) => <RouterLink to={item.href}>{children}</RouterLink>}
|
|
749
|
+
* ```
|
|
750
|
+
*/
|
|
751
|
+
renderLink?: (item: DashboardNavItem, children: default_2.ReactNode) => default_2.ReactNode;
|
|
752
|
+
/**
|
|
753
|
+
* Additional items shown in the user dropdown menu above the built-in
|
|
754
|
+
* Log out option. Use this to add Profile, Settings, etc.
|
|
755
|
+
*/
|
|
756
|
+
dropdownItems?: DashboardDropdownItem[];
|
|
757
|
+
/**
|
|
758
|
+
* Slot rendered on the right-hand side of the top bar, next to the user
|
|
759
|
+
* avatar. Use for global search, notification bell, etc.
|
|
760
|
+
*/
|
|
761
|
+
topBarSlot?: default_2.ReactNode;
|
|
762
|
+
/**
|
|
763
|
+
* Width of the sidebar in pixels.
|
|
764
|
+
* @default 220
|
|
765
|
+
*/
|
|
766
|
+
sidebarWidth?: number;
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
export declare interface DashboardNavGroup {
|
|
770
|
+
/** Optional uppercase section heading (e.g. "Account"). */
|
|
771
|
+
groupLabel?: string;
|
|
772
|
+
/** Nav items belonging to this group. */
|
|
773
|
+
items: DashboardNavItem[];
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
export declare interface DashboardNavItem {
|
|
777
|
+
/** Display label for the nav item. */
|
|
778
|
+
label: string;
|
|
779
|
+
/** Identifier / href — used as a key and passed to `renderLink`. */
|
|
780
|
+
href: string;
|
|
781
|
+
/** Optional icon element (e.g. an inline SVG component). */
|
|
782
|
+
icon?: default_2.ReactNode;
|
|
783
|
+
/** Numeric count badge shown to the right of the label. */
|
|
784
|
+
badge?: number;
|
|
785
|
+
/** Red dot indicator (e.g. for unread notifications). */
|
|
786
|
+
hasDot?: boolean;
|
|
787
|
+
/** Mark this item as the currently active route. */
|
|
788
|
+
isActive?: boolean;
|
|
789
|
+
}
|
|
790
|
+
|
|
791
|
+
export declare interface DashboardUser {
|
|
792
|
+
/** Display name shown in the top bar greeting and dropdown. */
|
|
793
|
+
name: string;
|
|
794
|
+
/** Email shown in the user dropdown. */
|
|
795
|
+
email?: string;
|
|
796
|
+
/** Optional avatar image src. Falls back to initials. */
|
|
797
|
+
avatarSrc?: string;
|
|
798
|
+
}
|
|
799
|
+
|
|
605
800
|
/**
|
|
606
801
|
* MedixDeck DataTable
|
|
607
802
|
*
|
|
@@ -679,6 +874,47 @@ export declare interface DatePickerProps {
|
|
|
679
874
|
includeTime?: boolean;
|
|
680
875
|
}
|
|
681
876
|
|
|
877
|
+
/**
|
|
878
|
+
* MedixDeck DateRangePicker
|
|
879
|
+
*
|
|
880
|
+
* Styled wrapper around two native date inputs (start and end).
|
|
881
|
+
*
|
|
882
|
+
* @example
|
|
883
|
+
* ```tsx
|
|
884
|
+
* <DateRangePicker
|
|
885
|
+
* label="Consultation Period"
|
|
886
|
+
* startValue={start}
|
|
887
|
+
* onStartChange={setStart}
|
|
888
|
+
* endValue={end}
|
|
889
|
+
* onEndChange={setEnd}
|
|
890
|
+
* />
|
|
891
|
+
* ```
|
|
892
|
+
*/
|
|
893
|
+
export declare function DateRangePicker({ startValue, onStartChange, endValue, onEndChange, min, max, label, helperText, errorMessage, isInvalid, isDisabled, startPlaceholder, endPlaceholder, id, }: DateRangePickerProps): JSX_2.Element;
|
|
894
|
+
|
|
895
|
+
export declare interface DateRangePickerProps {
|
|
896
|
+
/** Controlled start date value (ISO date string: YYYY-MM-DD) */
|
|
897
|
+
startValue?: string;
|
|
898
|
+
onStartChange?: (value: string) => void;
|
|
899
|
+
/** Controlled end date value (ISO date string: YYYY-MM-DD) */
|
|
900
|
+
endValue?: string;
|
|
901
|
+
onEndChange?: (value: string) => void;
|
|
902
|
+
/** Minimum selectable date (ISO string) */
|
|
903
|
+
min?: string;
|
|
904
|
+
/** Maximum selectable date (ISO string) */
|
|
905
|
+
max?: string;
|
|
906
|
+
label?: string;
|
|
907
|
+
helperText?: string;
|
|
908
|
+
errorMessage?: string;
|
|
909
|
+
isInvalid?: boolean;
|
|
910
|
+
isDisabled?: boolean;
|
|
911
|
+
startPlaceholder?: string;
|
|
912
|
+
endPlaceholder?: string;
|
|
913
|
+
id?: string;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
export declare const dismissToast: (id: string) => void;
|
|
917
|
+
|
|
682
918
|
/**
|
|
683
919
|
* MedixDeck Divider
|
|
684
920
|
*
|
|
@@ -796,8 +1032,97 @@ export declare interface EmptyStateProps extends BoxProps {
|
|
|
796
1032
|
onSecondaryAction?: () => void;
|
|
797
1033
|
}
|
|
798
1034
|
|
|
1035
|
+
/**
|
|
1036
|
+
* MedixDeck FileUpload
|
|
1037
|
+
*
|
|
1038
|
+
* Drag-and-drop styled file input area.
|
|
1039
|
+
*
|
|
1040
|
+
* @example
|
|
1041
|
+
* ```tsx
|
|
1042
|
+
* <FileUpload
|
|
1043
|
+
* label="Medical Records"
|
|
1044
|
+
* accept=".pdf,.doc"
|
|
1045
|
+
* onChange={(files) => console.log(files)}
|
|
1046
|
+
* />
|
|
1047
|
+
* ```
|
|
1048
|
+
*/
|
|
1049
|
+
export declare function FileUpload({ accept, multiple, maxSize, label, helperText, errorMessage, isInvalid, isDisabled, onChange, dropzoneTitle, id, }: FileUploadProps): JSX_2.Element;
|
|
1050
|
+
|
|
1051
|
+
export declare interface FileUploadProps {
|
|
1052
|
+
/** Accepted file types (e.g. ".pdf,.jpg,.png" or "image/*") */
|
|
1053
|
+
accept?: string;
|
|
1054
|
+
/** Whether multiple files can be selected */
|
|
1055
|
+
multiple?: boolean;
|
|
1056
|
+
/** Maximum file size in bytes */
|
|
1057
|
+
maxSize?: number;
|
|
1058
|
+
label?: string;
|
|
1059
|
+
helperText?: string;
|
|
1060
|
+
errorMessage?: string;
|
|
1061
|
+
isInvalid?: boolean;
|
|
1062
|
+
isDisabled?: boolean;
|
|
1063
|
+
/** Callback fired when files are selected or dropped */
|
|
1064
|
+
onChange?: (files: File[]) => void;
|
|
1065
|
+
/** Display title inside the dropzone */
|
|
1066
|
+
dropzoneTitle?: string;
|
|
1067
|
+
/** Custom ID for the file input */
|
|
1068
|
+
id?: string;
|
|
1069
|
+
}
|
|
1070
|
+
|
|
799
1071
|
export { Flex }
|
|
800
1072
|
|
|
1073
|
+
/**
|
|
1074
|
+
* MedixDeck Footer
|
|
1075
|
+
*
|
|
1076
|
+
* Re-usable footer component with brand area, navigation links, newsletter form,
|
|
1077
|
+
* and social icons. Adapts perfectly to light and dark modes.
|
|
1078
|
+
*
|
|
1079
|
+
* @example
|
|
1080
|
+
* ```tsx
|
|
1081
|
+
* <Footer
|
|
1082
|
+
* description="Nigeria's premium digital sanctuary."
|
|
1083
|
+
* socialLinks={[{ platform: 'twitter', href: '...' }]}
|
|
1084
|
+
* />
|
|
1085
|
+
* ```
|
|
1086
|
+
*/
|
|
1087
|
+
export declare function Footer({ description, logo, sections, socialLinks, copyright, bottomLinks, newsletter, renderLink, ...props }: FooterProps): JSX_2.Element;
|
|
1088
|
+
|
|
1089
|
+
export declare namespace Footer {
|
|
1090
|
+
var displayName: string;
|
|
1091
|
+
}
|
|
1092
|
+
|
|
1093
|
+
export declare interface FooterLink {
|
|
1094
|
+
label: string;
|
|
1095
|
+
href: string;
|
|
1096
|
+
isExternal?: boolean;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
export declare interface FooterProps extends Omit<BoxProps, "children"> {
|
|
1100
|
+
/** Company description shown under the logo */
|
|
1101
|
+
description?: string;
|
|
1102
|
+
/** Custom logo element. Defaults to MedixDeck Logo. */
|
|
1103
|
+
logo?: default_2.ReactNode;
|
|
1104
|
+
/** Navigation sections (COMPANY, RESOURCES, etc.) */
|
|
1105
|
+
sections?: FooterSection[];
|
|
1106
|
+
/** Social media links */
|
|
1107
|
+
socialLinks?: SocialLink[];
|
|
1108
|
+
/** Copyright text. Defaults to "© {year} MedixDeck. MDCN & FMoH Certified Platform." */
|
|
1109
|
+
copyright?: string;
|
|
1110
|
+
/** Links at the bottom right corner */
|
|
1111
|
+
bottomLinks?: BottomLink[];
|
|
1112
|
+
/** Newsletter configuration */
|
|
1113
|
+
newsletter?: NewsletterProps;
|
|
1114
|
+
/** Custom link renderer for integration with routers */
|
|
1115
|
+
renderLink?: (link: {
|
|
1116
|
+
href: string;
|
|
1117
|
+
isExternal?: boolean;
|
|
1118
|
+
}, children: default_2.ReactNode) => default_2.ReactNode;
|
|
1119
|
+
}
|
|
1120
|
+
|
|
1121
|
+
export declare interface FooterSection {
|
|
1122
|
+
title: string;
|
|
1123
|
+
links: FooterLink[];
|
|
1124
|
+
}
|
|
1125
|
+
|
|
801
1126
|
/**
|
|
802
1127
|
* MedixDeck FormControl
|
|
803
1128
|
*
|
|
@@ -1205,6 +1530,15 @@ export declare interface NavItem {
|
|
|
1205
1530
|
children?: NavItem[];
|
|
1206
1531
|
}
|
|
1207
1532
|
|
|
1533
|
+
export declare interface NewsletterProps {
|
|
1534
|
+
title?: string;
|
|
1535
|
+
description?: string;
|
|
1536
|
+
placeholder?: string;
|
|
1537
|
+
onSubmit?: (email: string) => void;
|
|
1538
|
+
hide?: boolean;
|
|
1539
|
+
buttonIcon?: default_2.ReactNode;
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1208
1542
|
/**
|
|
1209
1543
|
* MedixDeck OTPInput / PinInput
|
|
1210
1544
|
*
|
|
@@ -1532,6 +1866,11 @@ export declare interface SkeletonTextProps extends BoxProps {
|
|
|
1532
1866
|
lastLineWidth?: string;
|
|
1533
1867
|
}
|
|
1534
1868
|
|
|
1869
|
+
export declare interface SocialLink {
|
|
1870
|
+
platform: "facebook" | "instagram" | "linkedin" | "twitter" | "youtube" | "threads";
|
|
1871
|
+
href: string;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1535
1874
|
/**
|
|
1536
1875
|
* MedixDeck Spacing & Radius Tokens
|
|
1537
1876
|
* From style guide: Spacing scale 4, 8, 12, 16, 24, 32, 48, 64
|
|
@@ -1872,6 +2211,26 @@ export declare const textStyleTokens: {
|
|
|
1872
2211
|
};
|
|
1873
2212
|
};
|
|
1874
2213
|
|
|
2214
|
+
export declare const toast: {
|
|
2215
|
+
(options: Omit<ToastOptions, "id">): string;
|
|
2216
|
+
success(title: string, options?: Partial<ToastOptions>): string;
|
|
2217
|
+
error(title: string, options?: Partial<ToastOptions>): string;
|
|
2218
|
+
info(title: string, options?: Partial<ToastOptions>): string;
|
|
2219
|
+
warning(title: string, options?: Partial<ToastOptions>): string;
|
|
2220
|
+
};
|
|
2221
|
+
|
|
2222
|
+
export declare function Toaster(): JSX_2.Element;
|
|
2223
|
+
|
|
2224
|
+
export declare interface ToastOptions {
|
|
2225
|
+
id?: string;
|
|
2226
|
+
title: string;
|
|
2227
|
+
description?: string;
|
|
2228
|
+
type?: ToastType;
|
|
2229
|
+
duration?: number;
|
|
2230
|
+
}
|
|
2231
|
+
|
|
2232
|
+
export declare type ToastType = "info" | "success" | "warning" | "error";
|
|
2233
|
+
|
|
1875
2234
|
/**
|
|
1876
2235
|
* MedixDeck Tooltip
|
|
1877
2236
|
*
|