@facter/ds-core 1.6.1 → 1.7.0

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.mjs CHANGED
@@ -25,6 +25,7 @@ import * as TooltipPrimitive from '@radix-ui/react-tooltip';
25
25
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
26
26
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
27
27
  import { Slot } from '@radix-ui/react-slot';
28
+ import { ResponsiveContainer, AreaChart, Tooltip as Tooltip$1, Area } from 'recharts';
28
29
 
29
30
  // src/components/Button/Button.tsx
30
31
  function cn(...inputs) {
@@ -6657,8 +6658,14 @@ var itemCardIconVariants = cva(
6657
6658
  );
6658
6659
  var ItemCardIcon = React49.forwardRef(
6659
6660
  ({ className, size, variant, ripple = false, children, ...props }, ref) => {
6661
+ const wrapperSizeClasses = {
6662
+ sm: "w-10 h-10",
6663
+ md: "w-12 h-12",
6664
+ lg: "w-14 h-14"
6665
+ };
6666
+ const actualSize = size || "md";
6660
6667
  if (ripple) {
6661
- return /* @__PURE__ */ jsxs("div", { className: "relative", children: [
6668
+ return /* @__PURE__ */ jsxs("div", { className: cn("relative", wrapperSizeClasses[actualSize]), children: [
6662
6669
  /* @__PURE__ */ jsx(
6663
6670
  RippleEffect,
6664
6671
  {
@@ -7670,6 +7677,277 @@ function Logo({
7670
7677
  }
7671
7678
  );
7672
7679
  }
7680
+ var StatsCardContext = React49.createContext(null);
7681
+ function useStatsCard() {
7682
+ const context = React49.useContext(StatsCardContext);
7683
+ if (!context) {
7684
+ throw new Error("StatsCard components must be used within StatsCard.Root");
7685
+ }
7686
+ return context;
7687
+ }
7688
+ var colorConfigs = {
7689
+ green: {
7690
+ lineColor: "#22c55e",
7691
+ gradientStart: "rgba(34, 197, 94, 0.4)",
7692
+ gradientEnd: "rgba(34, 197, 94, 0.02)",
7693
+ bgGradient: "from-white via-emerald-50/30 to-emerald-100/50",
7694
+ iconBg: "bg-emerald-100/80 text-emerald-600",
7695
+ textColor: "text-emerald-500"
7696
+ },
7697
+ red: {
7698
+ lineColor: "#f87171",
7699
+ gradientStart: "rgba(248, 113, 113, 0.4)",
7700
+ gradientEnd: "rgba(248, 113, 113, 0.02)",
7701
+ bgGradient: "from-white via-rose-50/30 to-rose-100/50",
7702
+ iconBg: "bg-rose-100/80 text-rose-500",
7703
+ textColor: "text-rose-500"
7704
+ },
7705
+ yellow: {
7706
+ lineColor: "#f59e0b",
7707
+ gradientStart: "rgba(245, 158, 11, 0.4)",
7708
+ gradientEnd: "rgba(245, 158, 11, 0.02)",
7709
+ bgGradient: "from-white via-amber-50/30 to-amber-100/50",
7710
+ iconBg: "bg-amber-100/80 text-amber-600",
7711
+ textColor: "text-amber-500"
7712
+ },
7713
+ blue: {
7714
+ lineColor: "#3b82f6",
7715
+ gradientStart: "rgba(59, 130, 246, 0.4)",
7716
+ gradientEnd: "rgba(59, 130, 246, 0.02)",
7717
+ bgGradient: "from-white via-blue-50/30 to-blue-100/50",
7718
+ iconBg: "bg-blue-100/80 text-blue-600",
7719
+ textColor: "text-blue-500"
7720
+ },
7721
+ primary: {
7722
+ lineColor: "#3b82f6",
7723
+ gradientStart: "rgba(59, 130, 246, 0.4)",
7724
+ gradientEnd: "rgba(59, 130, 246, 0.02)",
7725
+ bgGradient: "from-white via-primary/5 to-primary/10",
7726
+ iconBg: "bg-primary/10 text-primary",
7727
+ textColor: "text-primary"
7728
+ }
7729
+ };
7730
+ var rootVariants2 = cva(
7731
+ "relative overflow-hidden bg-card shadow-sm border border-border h-full",
7732
+ {
7733
+ variants: {
7734
+ variant: {
7735
+ default: "rounded-2xl",
7736
+ compact: "rounded-xl",
7737
+ mini: "rounded-xl"
7738
+ }
7739
+ },
7740
+ defaultVariants: {
7741
+ variant: "default"
7742
+ }
7743
+ }
7744
+ );
7745
+ function StatsCardRoot({
7746
+ colorScheme = "blue",
7747
+ variant = "default",
7748
+ className,
7749
+ children,
7750
+ ...props
7751
+ }) {
7752
+ const config = colorConfigs[colorScheme];
7753
+ return /* @__PURE__ */ jsx(StatsCardContext.Provider, { value: { colorScheme, variant, config }, children: /* @__PURE__ */ jsxs("div", { className: cn(rootVariants2({ variant }), className), ...props, children: [
7754
+ /* @__PURE__ */ jsx("div", { className: cn("absolute inset-0 bg-gradient-to-br pointer-events-none", config.bgGradient) }),
7755
+ /* @__PURE__ */ jsx("div", { className: cn(
7756
+ "relative flex h-full",
7757
+ variant === "compact" ? "flex-row items-center p-3 gap-3" : "flex-col",
7758
+ variant === "mini" && "p-3",
7759
+ variant === "default" && ""
7760
+ ), children })
7761
+ ] }) });
7762
+ }
7763
+ function StatsCardHeader({ className, children, ...props }) {
7764
+ const { variant } = useStatsCard();
7765
+ return /* @__PURE__ */ jsx(
7766
+ "div",
7767
+ {
7768
+ className: cn(
7769
+ "flex items-center justify-between",
7770
+ variant === "default" && "p-4 pb-2",
7771
+ variant === "mini" && "mb-2",
7772
+ variant === "compact" && "flex-1 min-w-0",
7773
+ className
7774
+ ),
7775
+ ...props,
7776
+ children
7777
+ }
7778
+ );
7779
+ }
7780
+ function StatsCardIcon({ icon: Icon2, className, ...props }) {
7781
+ const { config, variant } = useStatsCard();
7782
+ return /* @__PURE__ */ jsx(
7783
+ "div",
7784
+ {
7785
+ className: cn(
7786
+ "rounded-lg",
7787
+ config.iconBg,
7788
+ variant === "mini" ? "p-1.5" : "p-2",
7789
+ className
7790
+ ),
7791
+ ...props,
7792
+ children: /* @__PURE__ */ jsx(Icon2, { className: cn(variant === "mini" ? "w-3.5 h-3.5" : "w-4 h-4") })
7793
+ }
7794
+ );
7795
+ }
7796
+ function StatsCardTitle({ className, children, ...props }) {
7797
+ const { variant } = useStatsCard();
7798
+ return /* @__PURE__ */ jsx(
7799
+ "h3",
7800
+ {
7801
+ className: cn(
7802
+ "font-medium text-gray-700",
7803
+ variant === "mini" ? "text-xs leading-tight" : "text-sm",
7804
+ className
7805
+ ),
7806
+ ...props,
7807
+ children
7808
+ }
7809
+ );
7810
+ }
7811
+ function StatsCardSubtitle({ className, children, ...props }) {
7812
+ const { variant } = useStatsCard();
7813
+ return /* @__PURE__ */ jsx(
7814
+ "p",
7815
+ {
7816
+ className: cn(
7817
+ "text-gray-400",
7818
+ variant === "mini" ? "text-[9px] leading-tight" : "text-[10px]",
7819
+ className
7820
+ ),
7821
+ ...props,
7822
+ children
7823
+ }
7824
+ );
7825
+ }
7826
+ function StatsCardValue({ className, children, ...props }) {
7827
+ const { variant } = useStatsCard();
7828
+ return /* @__PURE__ */ jsx(
7829
+ "p",
7830
+ {
7831
+ className: cn(
7832
+ "font-light tracking-tight text-gray-900",
7833
+ variant === "mini" ? "text-3xl" : variant === "compact" ? "text-2xl" : "text-4xl",
7834
+ className
7835
+ ),
7836
+ ...props,
7837
+ children
7838
+ }
7839
+ );
7840
+ }
7841
+ function StatsCardChange({ type = "positive", className, children, ...props }) {
7842
+ const { config, variant } = useStatsCard();
7843
+ return /* @__PURE__ */ jsxs("div", { className: cn("flex items-center gap-0.5", className), ...props, children: [
7844
+ /* @__PURE__ */ jsx(
7845
+ "svg",
7846
+ {
7847
+ className: cn(variant === "mini" ? "w-2 h-2" : "w-2.5 h-2.5", config.textColor),
7848
+ viewBox: "0 0 12 12",
7849
+ fill: "currentColor",
7850
+ children: /* @__PURE__ */ jsx("path", { d: type === "negative" ? "M6 10L10 5H2L6 10Z" : "M6 2L10 7H2L6 2Z" })
7851
+ }
7852
+ ),
7853
+ /* @__PURE__ */ jsx("span", { className: cn(
7854
+ "font-medium",
7855
+ config.textColor,
7856
+ variant === "mini" ? "text-[9px]" : "text-[10px]"
7857
+ ), children })
7858
+ ] });
7859
+ }
7860
+ function StatsCardChart({ data, height, className, ...props }) {
7861
+ const { config, variant } = useStatsCard();
7862
+ const gradientId = React49.useId();
7863
+ const chartHeight = height ?? (variant === "mini" ? 40 : variant === "compact" ? 40 : 70);
7864
+ return /* @__PURE__ */ jsx(
7865
+ "div",
7866
+ {
7867
+ className: cn(
7868
+ variant === "mini" && "mt-auto h-10",
7869
+ variant === "compact" && "w-16 h-10 shrink-0",
7870
+ variant === "default" && "flex-1 relative mt-auto",
7871
+ className
7872
+ ),
7873
+ ...props,
7874
+ children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: chartHeight, children: /* @__PURE__ */ jsxs(AreaChart, { data, margin: { top: 2, right: 0, left: 0, bottom: 0 }, children: [
7875
+ /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "0", y2: "1", children: [
7876
+ /* @__PURE__ */ jsx("stop", { offset: "0%", stopColor: config.gradientStart }),
7877
+ /* @__PURE__ */ jsx("stop", { offset: "100%", stopColor: config.gradientEnd })
7878
+ ] }) }),
7879
+ /* @__PURE__ */ jsx(
7880
+ Tooltip$1,
7881
+ {
7882
+ content: ({ active, payload }) => {
7883
+ if (active && payload && payload.length) {
7884
+ const point = payload[0].payload;
7885
+ return /* @__PURE__ */ jsxs("div", { className: "bg-white/95 backdrop-blur-sm rounded-lg px-2 py-1.5 shadow-lg border border-gray-100", children: [
7886
+ /* @__PURE__ */ jsx("p", { className: "text-[10px] font-medium text-gray-700", children: point.value }),
7887
+ /* @__PURE__ */ jsx("p", { className: "text-[9px] text-gray-400", children: point.date })
7888
+ ] });
7889
+ }
7890
+ return null;
7891
+ }
7892
+ }
7893
+ ),
7894
+ /* @__PURE__ */ jsx(
7895
+ Area,
7896
+ {
7897
+ type: "monotone",
7898
+ dataKey: "value",
7899
+ stroke: config.lineColor,
7900
+ strokeWidth: 1.5,
7901
+ fill: `url(#${gradientId})`,
7902
+ dot: false,
7903
+ activeDot: {
7904
+ r: variant === "mini" ? 2 : 3,
7905
+ fill: config.lineColor,
7906
+ stroke: "white",
7907
+ strokeWidth: variant === "mini" ? 1 : 2
7908
+ }
7909
+ }
7910
+ )
7911
+ ] }) })
7912
+ }
7913
+ );
7914
+ }
7915
+ function StatsCardContent({ className, children, ...props }) {
7916
+ const { variant } = useStatsCard();
7917
+ return /* @__PURE__ */ jsx(
7918
+ "div",
7919
+ {
7920
+ className: cn(
7921
+ variant === "mini" && "mb-2",
7922
+ variant === "default" && "mt-2",
7923
+ className
7924
+ ),
7925
+ ...props,
7926
+ children
7927
+ }
7928
+ );
7929
+ }
7930
+ function StatsCardToday({ label, type = "positive", className, children, ...props }) {
7931
+ const { config } = useStatsCard();
7932
+ return /* @__PURE__ */ jsxs("p", { className: cn("text-xs mt-0.5", className), ...props, children: [
7933
+ /* @__PURE__ */ jsxs("span", { className: config.textColor, children: [
7934
+ type === "positive" ? "+" : "",
7935
+ children
7936
+ ] }),
7937
+ label && /* @__PURE__ */ jsx("span", { className: "text-gray-500 ml-1", children: label })
7938
+ ] });
7939
+ }
7940
+ var StatsCard = Object.assign(StatsCardRoot, {
7941
+ Header: StatsCardHeader,
7942
+ Icon: StatsCardIcon,
7943
+ Title: StatsCardTitle,
7944
+ Subtitle: StatsCardSubtitle,
7945
+ Value: StatsCardValue,
7946
+ Change: StatsCardChange,
7947
+ Chart: StatsCardChart,
7948
+ Content: StatsCardContent,
7949
+ Today: StatsCardToday
7950
+ });
7673
7951
  var initialState = {
7674
7952
  theme: "system",
7675
7953
  setTheme: () => null
@@ -7754,6 +8032,6 @@ var THEME_INFO = {
7754
8032
  }
7755
8033
  };
7756
8034
 
7757
- export { AuthLayout, Avatar, AvatarFallback, AvatarImage, Badge, BigNumberCard, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DENSITY_CONFIG, DashboardLayout, DataTable, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogWrapper, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FACTER_THEMES, Form, FormCheckbox, FormDescription, FormError, FormFieldProvider, FormFieldWrapper, FormInput, FormLabel, FormRadioGroup, FormSelect, FormSwitch, FormTextarea, GlobalLoaderController, Input, ItemCard, ItemCardActionButton, ItemCardActions, ItemCardActionsRow, ItemCardBadge, ItemCardContent, ItemCardContentItem, ItemCardEmpty, ItemCardFooter, ItemCardFooterDivider, ItemCardFooterItem, ItemCardHeader, ItemCardIcon, ItemCardRoot, ItemCardSubtitle, ItemCardTitle, ItemCardTitleGroup, Kanban, Loader, LoaderProvider, Logo, MobileNav, MobileNavItem, Navbar, NavbarCompanyProfile, NavbarNotification, NavbarUserMenu, Popover, PopoverContent, PopoverTrigger, RippleBackground, RippleEffect, RippleWrapper, ScrollArea, ScrollBar, SectionHeader, SectionHeaderActions, SectionHeaderBadge, SectionHeaderContent, SectionHeaderIcon, SectionHeaderRoot, SectionHeaderSubtitle, SectionHeaderTitle, Select, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectionLayout, Separator3 as Separator, Sidebar, SimpleTooltip, Skeleton, Sparkline, Switch, THEME_INFO, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Toaster, Tooltip, TooltipAction, TooltipActions, TooltipArrow, TooltipContent, TooltipDescription, TooltipHeader, TooltipIcon, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTitle, TooltipTrigger, Wizard, WizardContent, WizardNavigation, WizardPanel, WizardProgress, WizardProvider, WizardStepConnector, WizardStepIndicator, WizardSteps, cn, itemCardBadgeVariants, itemCardIconVariants, itemCardVariants, loader, toast, useDashboardLayout, useDataTable, useDataTableColumnVisibility, useDataTableDensity, useDataTableEmpty, useDataTableInstance, useDataTableLoading, useDataTableMeta, useDataTablePagination, useDataTableSelection, useDataTableSorting, useDataTableState, useDebounce, useDebouncedCallback, useFormFieldContext, useItemCard, useKanban, useKanbanOptional, useLoader, useMediaQuery2 as useMediaQuery, useSidebar, useSidebarOptional, useTheme, useWizardContext, useWizardContextOptional };
8035
+ export { AuthLayout, Avatar, AvatarFallback, AvatarImage, Badge, BigNumberCard, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, DENSITY_CONFIG, DashboardLayout, DataTable, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DialogWrapper, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, FACTER_THEMES, Form, FormCheckbox, FormDescription, FormError, FormFieldProvider, FormFieldWrapper, FormInput, FormLabel, FormRadioGroup, FormSelect, FormSwitch, FormTextarea, GlobalLoaderController, Input, ItemCard, ItemCardActionButton, ItemCardActions, ItemCardActionsRow, ItemCardBadge, ItemCardContent, ItemCardContentItem, ItemCardEmpty, ItemCardFooter, ItemCardFooterDivider, ItemCardFooterItem, ItemCardHeader, ItemCardIcon, ItemCardRoot, ItemCardSubtitle, ItemCardTitle, ItemCardTitleGroup, Kanban, Loader, LoaderProvider, Logo, MobileNav, MobileNavItem, Navbar, NavbarCompanyProfile, NavbarNotification, NavbarUserMenu, Popover, PopoverContent, PopoverTrigger, RippleBackground, RippleEffect, RippleWrapper, ScrollArea, ScrollBar, SectionHeader, SectionHeaderActions, SectionHeaderBadge, SectionHeaderContent, SectionHeaderIcon, SectionHeaderRoot, SectionHeaderSubtitle, SectionHeaderTitle, Select, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectionLayout, Separator3 as Separator, Sidebar, SimpleTooltip, Skeleton, Sparkline, StatsCard, Switch, THEME_INFO, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, ThemeProvider, ThemeToggle, Toaster, Tooltip, TooltipAction, TooltipActions, TooltipArrow, TooltipContent, TooltipDescription, TooltipHeader, TooltipIcon, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTitle, TooltipTrigger, Wizard, WizardContent, WizardNavigation, WizardPanel, WizardProgress, WizardProvider, WizardStepConnector, WizardStepIndicator, WizardSteps, cn, itemCardBadgeVariants, itemCardIconVariants, itemCardVariants, loader, toast, useDashboardLayout, useDataTable, useDataTableColumnVisibility, useDataTableDensity, useDataTableEmpty, useDataTableInstance, useDataTableLoading, useDataTableMeta, useDataTablePagination, useDataTableSelection, useDataTableSorting, useDataTableState, useDebounce, useDebouncedCallback, useFormFieldContext, useItemCard, useKanban, useKanbanOptional, useLoader, useMediaQuery2 as useMediaQuery, useSidebar, useSidebarOptional, useTheme, useWizardContext, useWizardContextOptional };
7758
8036
  //# sourceMappingURL=index.mjs.map
7759
8037
  //# sourceMappingURL=index.mjs.map