@medixdeck/ui 0.1.3 → 0.1.5
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 +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +286 -0
- package/dist/index.js +4005 -2933
- package/dist/index.js.map +1 -1
- package/package.json +20 -5
package/dist/index.d.ts
CHANGED
|
@@ -583,6 +583,25 @@ export declare interface Column<T = Record<string, unknown>> {
|
|
|
583
583
|
align?: "left" | "center" | "right";
|
|
584
584
|
}
|
|
585
585
|
|
|
586
|
+
export declare function Combobox({ options, value, onChange, placeholder, label, helperText, errorMessage, isInvalid, isDisabled, }: ComboboxProps): JSX_2.Element;
|
|
587
|
+
|
|
588
|
+
export declare interface ComboboxOption {
|
|
589
|
+
label: string;
|
|
590
|
+
value: string;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
export declare interface ComboboxProps {
|
|
594
|
+
options: ComboboxOption[];
|
|
595
|
+
value?: string;
|
|
596
|
+
onChange?: (value: string) => void;
|
|
597
|
+
placeholder?: string;
|
|
598
|
+
label?: string;
|
|
599
|
+
helperText?: string;
|
|
600
|
+
errorMessage?: string;
|
|
601
|
+
isInvalid?: boolean;
|
|
602
|
+
isDisabled?: boolean;
|
|
603
|
+
}
|
|
604
|
+
|
|
586
605
|
/**
|
|
587
606
|
* MedixDeck Container
|
|
588
607
|
*
|
|
@@ -602,6 +621,176 @@ export declare interface ContainerProps extends BoxProps {
|
|
|
602
621
|
maxWidth?: "sm" | "md" | "lg" | "xl" | "2xl" | "full";
|
|
603
622
|
}
|
|
604
623
|
|
|
624
|
+
export declare interface DashboardDropdownItem {
|
|
625
|
+
/** Label shown in the dropdown menu. */
|
|
626
|
+
label: string;
|
|
627
|
+
/** Optional icon rendered to the left of the label. */
|
|
628
|
+
icon?: default_2.ReactNode;
|
|
629
|
+
/** Called when the item is clicked. */
|
|
630
|
+
onClick?: () => void;
|
|
631
|
+
/** Renders the item in a destructive/danger colour. */
|
|
632
|
+
isDanger?: boolean;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
/**
|
|
636
|
+
* MedixDeck DashboardLayout
|
|
637
|
+
*
|
|
638
|
+
* A full-page authenticated shell with a fixed sidebar, sticky top bar, and
|
|
639
|
+
* scrollable main content area. Fully responsive — the sidebar is hidden on
|
|
640
|
+
* mobile and revealed via a hamburger toggle.
|
|
641
|
+
*
|
|
642
|
+
* ### Router integration
|
|
643
|
+
* Pass `renderLink` to use your router's `<Link>` component without bringing
|
|
644
|
+
* router dependencies into the library (mirrors the `Navbar` pattern).
|
|
645
|
+
*
|
|
646
|
+
* ### Active state
|
|
647
|
+
* Set `isActive: true` on the `DashboardNavItem` that represents the current
|
|
648
|
+
* route. The active item gets a blue left-accent bar and a tinted background
|
|
649
|
+
* in both light and dark modes.
|
|
650
|
+
*
|
|
651
|
+
* @example
|
|
652
|
+
* ```tsx
|
|
653
|
+
* import { DashboardLayout } from "@medixdeck/ui";
|
|
654
|
+
* import { Link, useLocation } from "react-router-dom";
|
|
655
|
+
*
|
|
656
|
+
* const NAV_GROUPS = [
|
|
657
|
+
* {
|
|
658
|
+
* items: [
|
|
659
|
+
* { label: "Home", href: "/", icon: <HomeIcon /> },
|
|
660
|
+
* { label: "Messages", href: "/messages", icon: <MsgIcon />, badge: 4 },
|
|
661
|
+
* ],
|
|
662
|
+
* },
|
|
663
|
+
* {
|
|
664
|
+
* groupLabel: "Account",
|
|
665
|
+
* items: [
|
|
666
|
+
* { label: "Profile", href: "/profile", icon: <ProfileIcon />, hasDot: true },
|
|
667
|
+
* ],
|
|
668
|
+
* },
|
|
669
|
+
* ];
|
|
670
|
+
*
|
|
671
|
+
* export function Layout({ children }) {
|
|
672
|
+
* const { pathname } = useLocation();
|
|
673
|
+
*
|
|
674
|
+
* const groups = NAV_GROUPS.map((g) => ({
|
|
675
|
+
* ...g,
|
|
676
|
+
* items: g.items.map((item) => ({
|
|
677
|
+
* ...item,
|
|
678
|
+
* isActive: item.href === "/" ? pathname === "/" : pathname.startsWith(item.href),
|
|
679
|
+
* })),
|
|
680
|
+
* }));
|
|
681
|
+
*
|
|
682
|
+
* return (
|
|
683
|
+
* <DashboardLayout
|
|
684
|
+
* navGroups={groups}
|
|
685
|
+
* user={{ name: "Daniel", email: "daniel@medixdeck.com" }}
|
|
686
|
+
* onLogout={() => auth.signOut()}
|
|
687
|
+
* renderLink={(item, children) => <Link to={item.href}>{children}</Link>}
|
|
688
|
+
* >
|
|
689
|
+
* {children}
|
|
690
|
+
* </DashboardLayout>
|
|
691
|
+
* );
|
|
692
|
+
* }
|
|
693
|
+
* ```
|
|
694
|
+
*/
|
|
695
|
+
export declare function DashboardLayout({ children, logo, navGroups, user, greeting, onLogout, renderLink, dropdownItems, topBarSlot, sidebarWidth, ...rest }: DashboardLayoutProps): JSX_2.Element;
|
|
696
|
+
|
|
697
|
+
export declare namespace DashboardLayout {
|
|
698
|
+
var displayName: string;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
export declare interface DashboardLayoutProps extends Omit<BoxProps, "children"> {
|
|
702
|
+
/** Page content rendered inside the main area. */
|
|
703
|
+
children: default_2.ReactNode;
|
|
704
|
+
/**
|
|
705
|
+
* Logo shown at the top of the sidebar.
|
|
706
|
+
* Defaults to `<Logo height={26} />` when omitted.
|
|
707
|
+
*/
|
|
708
|
+
logo?: default_2.ReactNode;
|
|
709
|
+
/**
|
|
710
|
+
* Navigation groups. Each group can have an optional section label and an
|
|
711
|
+
* array of nav items. Items are rendered top-to-bottom with the group label
|
|
712
|
+
* as a separator heading.
|
|
713
|
+
*
|
|
714
|
+
* @example
|
|
715
|
+
* ```tsx
|
|
716
|
+
* navGroups={[
|
|
717
|
+
* { items: [{ label: "Home", href: "/", icon: <HomeIcon />, isActive: true }] },
|
|
718
|
+
* { groupLabel: "Account", items: [{ label: "Profile", href: "/profile", icon: <ProfileIcon /> }] },
|
|
719
|
+
* ]}
|
|
720
|
+
* ```
|
|
721
|
+
*/
|
|
722
|
+
navGroups: DashboardNavGroup[];
|
|
723
|
+
/** Authenticated user displayed in the top-bar user menu. */
|
|
724
|
+
user: DashboardUser;
|
|
725
|
+
/**
|
|
726
|
+
* Override the auto-computed greeting ("Good morning / afternoon / evening").
|
|
727
|
+
* @example greeting="Welcome back"
|
|
728
|
+
*/
|
|
729
|
+
greeting?: string;
|
|
730
|
+
/** Called when the sidebar logout button is clicked. */
|
|
731
|
+
onLogout?: () => void;
|
|
732
|
+
/**
|
|
733
|
+
* Custom link renderer — mirrors the Navbar `renderLink` API.
|
|
734
|
+
* Use this to integrate Next.js `<Link>`, React Router `<Link>`, or TanStack
|
|
735
|
+
* Router without importing those packages inside the library.
|
|
736
|
+
*
|
|
737
|
+
* @example
|
|
738
|
+
* ```tsx
|
|
739
|
+
* // Next.js
|
|
740
|
+
* renderLink={(item, children) => <Link href={item.href}>{children}</Link>}
|
|
741
|
+
* // TanStack Router
|
|
742
|
+
* renderLink={(item, children) => <RouterLink to={item.href}>{children}</RouterLink>}
|
|
743
|
+
* ```
|
|
744
|
+
*/
|
|
745
|
+
renderLink?: (item: DashboardNavItem, children: default_2.ReactNode) => default_2.ReactNode;
|
|
746
|
+
/**
|
|
747
|
+
* Additional items shown in the user dropdown menu above the built-in
|
|
748
|
+
* Log out option. Use this to add Profile, Settings, etc.
|
|
749
|
+
*/
|
|
750
|
+
dropdownItems?: DashboardDropdownItem[];
|
|
751
|
+
/**
|
|
752
|
+
* Slot rendered on the right-hand side of the top bar, next to the user
|
|
753
|
+
* avatar. Use for global search, notification bell, etc.
|
|
754
|
+
*/
|
|
755
|
+
topBarSlot?: default_2.ReactNode;
|
|
756
|
+
/**
|
|
757
|
+
* Width of the sidebar in pixels.
|
|
758
|
+
* @default 220
|
|
759
|
+
*/
|
|
760
|
+
sidebarWidth?: number;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
export declare interface DashboardNavGroup {
|
|
764
|
+
/** Optional uppercase section heading (e.g. "Account"). */
|
|
765
|
+
groupLabel?: string;
|
|
766
|
+
/** Nav items belonging to this group. */
|
|
767
|
+
items: DashboardNavItem[];
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export declare interface DashboardNavItem {
|
|
771
|
+
/** Display label for the nav item. */
|
|
772
|
+
label: string;
|
|
773
|
+
/** Identifier / href — used as a key and passed to `renderLink`. */
|
|
774
|
+
href: string;
|
|
775
|
+
/** Optional icon element (e.g. an inline SVG component). */
|
|
776
|
+
icon?: default_2.ReactNode;
|
|
777
|
+
/** Numeric count badge shown to the right of the label. */
|
|
778
|
+
badge?: number;
|
|
779
|
+
/** Red dot indicator (e.g. for unread notifications). */
|
|
780
|
+
hasDot?: boolean;
|
|
781
|
+
/** Mark this item as the currently active route. */
|
|
782
|
+
isActive?: boolean;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
export declare interface DashboardUser {
|
|
786
|
+
/** Display name shown in the top bar greeting and dropdown. */
|
|
787
|
+
name: string;
|
|
788
|
+
/** Email shown in the user dropdown. */
|
|
789
|
+
email?: string;
|
|
790
|
+
/** Optional avatar image src. Falls back to initials. */
|
|
791
|
+
avatarSrc?: string;
|
|
792
|
+
}
|
|
793
|
+
|
|
605
794
|
/**
|
|
606
795
|
* MedixDeck DataTable
|
|
607
796
|
*
|
|
@@ -679,6 +868,47 @@ export declare interface DatePickerProps {
|
|
|
679
868
|
includeTime?: boolean;
|
|
680
869
|
}
|
|
681
870
|
|
|
871
|
+
/**
|
|
872
|
+
* MedixDeck DateRangePicker
|
|
873
|
+
*
|
|
874
|
+
* Styled wrapper around two native date inputs (start and end).
|
|
875
|
+
*
|
|
876
|
+
* @example
|
|
877
|
+
* ```tsx
|
|
878
|
+
* <DateRangePicker
|
|
879
|
+
* label="Consultation Period"
|
|
880
|
+
* startValue={start}
|
|
881
|
+
* onStartChange={setStart}
|
|
882
|
+
* endValue={end}
|
|
883
|
+
* onEndChange={setEnd}
|
|
884
|
+
* />
|
|
885
|
+
* ```
|
|
886
|
+
*/
|
|
887
|
+
export declare function DateRangePicker({ startValue, onStartChange, endValue, onEndChange, min, max, label, helperText, errorMessage, isInvalid, isDisabled, startPlaceholder, endPlaceholder, id, }: DateRangePickerProps): JSX_2.Element;
|
|
888
|
+
|
|
889
|
+
export declare interface DateRangePickerProps {
|
|
890
|
+
/** Controlled start date value (ISO date string: YYYY-MM-DD) */
|
|
891
|
+
startValue?: string;
|
|
892
|
+
onStartChange?: (value: string) => void;
|
|
893
|
+
/** Controlled end date value (ISO date string: YYYY-MM-DD) */
|
|
894
|
+
endValue?: string;
|
|
895
|
+
onEndChange?: (value: string) => void;
|
|
896
|
+
/** Minimum selectable date (ISO string) */
|
|
897
|
+
min?: string;
|
|
898
|
+
/** Maximum selectable date (ISO string) */
|
|
899
|
+
max?: string;
|
|
900
|
+
label?: string;
|
|
901
|
+
helperText?: string;
|
|
902
|
+
errorMessage?: string;
|
|
903
|
+
isInvalid?: boolean;
|
|
904
|
+
isDisabled?: boolean;
|
|
905
|
+
startPlaceholder?: string;
|
|
906
|
+
endPlaceholder?: string;
|
|
907
|
+
id?: string;
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
export declare const dismissToast: (id: string) => void;
|
|
911
|
+
|
|
682
912
|
/**
|
|
683
913
|
* MedixDeck Divider
|
|
684
914
|
*
|
|
@@ -796,6 +1026,42 @@ export declare interface EmptyStateProps extends BoxProps {
|
|
|
796
1026
|
onSecondaryAction?: () => void;
|
|
797
1027
|
}
|
|
798
1028
|
|
|
1029
|
+
/**
|
|
1030
|
+
* MedixDeck FileUpload
|
|
1031
|
+
*
|
|
1032
|
+
* Drag-and-drop styled file input area.
|
|
1033
|
+
*
|
|
1034
|
+
* @example
|
|
1035
|
+
* ```tsx
|
|
1036
|
+
* <FileUpload
|
|
1037
|
+
* label="Medical Records"
|
|
1038
|
+
* accept=".pdf,.doc"
|
|
1039
|
+
* onChange={(files) => console.log(files)}
|
|
1040
|
+
* />
|
|
1041
|
+
* ```
|
|
1042
|
+
*/
|
|
1043
|
+
export declare function FileUpload({ accept, multiple, maxSize, label, helperText, errorMessage, isInvalid, isDisabled, onChange, dropzoneTitle, id, }: FileUploadProps): JSX_2.Element;
|
|
1044
|
+
|
|
1045
|
+
export declare interface FileUploadProps {
|
|
1046
|
+
/** Accepted file types (e.g. ".pdf,.jpg,.png" or "image/*") */
|
|
1047
|
+
accept?: string;
|
|
1048
|
+
/** Whether multiple files can be selected */
|
|
1049
|
+
multiple?: boolean;
|
|
1050
|
+
/** Maximum file size in bytes */
|
|
1051
|
+
maxSize?: number;
|
|
1052
|
+
label?: string;
|
|
1053
|
+
helperText?: string;
|
|
1054
|
+
errorMessage?: string;
|
|
1055
|
+
isInvalid?: boolean;
|
|
1056
|
+
isDisabled?: boolean;
|
|
1057
|
+
/** Callback fired when files are selected or dropped */
|
|
1058
|
+
onChange?: (files: File[]) => void;
|
|
1059
|
+
/** Display title inside the dropzone */
|
|
1060
|
+
dropzoneTitle?: string;
|
|
1061
|
+
/** Custom ID for the file input */
|
|
1062
|
+
id?: string;
|
|
1063
|
+
}
|
|
1064
|
+
|
|
799
1065
|
export { Flex }
|
|
800
1066
|
|
|
801
1067
|
/**
|
|
@@ -1872,6 +2138,26 @@ export declare const textStyleTokens: {
|
|
|
1872
2138
|
};
|
|
1873
2139
|
};
|
|
1874
2140
|
|
|
2141
|
+
export declare const toast: {
|
|
2142
|
+
(options: Omit<ToastOptions, "id">): string;
|
|
2143
|
+
success(title: string, options?: Partial<ToastOptions>): string;
|
|
2144
|
+
error(title: string, options?: Partial<ToastOptions>): string;
|
|
2145
|
+
info(title: string, options?: Partial<ToastOptions>): string;
|
|
2146
|
+
warning(title: string, options?: Partial<ToastOptions>): string;
|
|
2147
|
+
};
|
|
2148
|
+
|
|
2149
|
+
export declare function Toaster(): JSX_2.Element;
|
|
2150
|
+
|
|
2151
|
+
export declare interface ToastOptions {
|
|
2152
|
+
id?: string;
|
|
2153
|
+
title: string;
|
|
2154
|
+
description?: string;
|
|
2155
|
+
type?: ToastType;
|
|
2156
|
+
duration?: number;
|
|
2157
|
+
}
|
|
2158
|
+
|
|
2159
|
+
export declare type ToastType = "info" | "success" | "warning" | "error";
|
|
2160
|
+
|
|
1875
2161
|
/**
|
|
1876
2162
|
* MedixDeck Tooltip
|
|
1877
2163
|
*
|