@gardenfi/garden-book 0.2.31 → 0.3.0-beta.2

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.
Files changed (147) hide show
  1. package/dist/BulletList/BulletList.d.ts +21 -0
  2. package/dist/BulletList/index.d.ts +2 -0
  3. package/dist/BulletList/index.js +31 -0
  4. package/dist/CardList/CardList.d.ts +32 -0
  5. package/dist/CardList/index.d.ts +2 -0
  6. package/dist/CardList/index.js +141 -0
  7. package/dist/Checkbox/Checkbox.js +7 -0
  8. package/dist/Checkbox/RadixCheckbox.d.ts +3 -0
  9. package/dist/Checkbox/RadixCheckbox.js +27 -0
  10. package/dist/Checkbox/index.d.ts +1 -0
  11. package/dist/Checkbox/index.js +4 -5
  12. package/dist/DashboardLayout/DashboardLayout.d.ts +23 -0
  13. package/dist/DashboardLayout/DashboardNavbar.d.ts +11 -0
  14. package/dist/DashboardLayout/DashboardNavbar.js +32 -0
  15. package/dist/DashboardLayout/DashboardSidebar.d.ts +30 -0
  16. package/dist/DashboardLayout/DashboardSidebar.js +139 -0
  17. package/dist/DashboardLayout/MobileMenu.d.ts +11 -0
  18. package/dist/DashboardLayout/MobileMenu.js +126 -0
  19. package/dist/DashboardLayout/PageHeader.d.ts +13 -0
  20. package/dist/DashboardLayout/PageHeader.js +47 -0
  21. package/dist/DashboardLayout/index.d.ts +10 -0
  22. package/dist/DashboardLayout/index.js +93 -0
  23. package/dist/DataTable/DataTable.d.ts +50 -0
  24. package/dist/DataTable/Table.d.ts +7 -0
  25. package/dist/DataTable/Table.js +57 -0
  26. package/dist/DataTable/index.d.ts +2 -0
  27. package/dist/DataTable/index.js +269 -0
  28. package/dist/DataTable/useAnimatedTable.d.ts +8 -0
  29. package/dist/DataTable/useAnimatedTable.js +44 -0
  30. package/dist/DirectionalIconHover/DirectionalIconHover.d.ts +12 -0
  31. package/dist/DirectionalIconHover/index.d.ts +2 -0
  32. package/dist/DirectionalIconHover/index.js +72 -0
  33. package/dist/EmptyState/EmptyState.d.ts +20 -0
  34. package/dist/EmptyState/index.d.ts +2 -0
  35. package/dist/EmptyState/index.js +35 -0
  36. package/dist/ErrorState/ErrorState.d.ts +17 -0
  37. package/dist/ErrorState/errorMessages.d.ts +2 -0
  38. package/dist/ErrorState/errorMessages.js +13 -0
  39. package/dist/ErrorState/index.d.ts +2 -0
  40. package/dist/ErrorState/index.js +37 -0
  41. package/dist/Field/Field.d.ts +14 -0
  42. package/dist/Field/index.d.ts +2 -0
  43. package/dist/Field/index.js +14 -0
  44. package/dist/HamburgerIcon/HamburgerIcon.d.ts +5 -0
  45. package/dist/HamburgerIcon/index.d.ts +2 -0
  46. package/dist/HamburgerIcon/index.js +47 -0
  47. package/dist/InfoTooltip/InfoTooltip.d.ts +22 -0
  48. package/dist/InfoTooltip/index.d.ts +2 -0
  49. package/dist/InfoTooltip/index.js +81 -0
  50. package/dist/Input/Input.d.ts +19 -0
  51. package/dist/Input/index.d.ts +2 -0
  52. package/dist/Input/index.js +113 -0
  53. package/dist/Logo/index.d.ts +0 -1
  54. package/dist/Logo/index.js +8 -10
  55. package/dist/OTPInput/OTPInput.d.ts +11 -0
  56. package/dist/OTPInput/index.d.ts +2 -0
  57. package/dist/OTPInput/index.js +88 -0
  58. package/dist/Pagination/Pagination.d.ts +16 -0
  59. package/dist/Pagination/index.d.ts +2 -0
  60. package/dist/Pagination/index.js +111 -0
  61. package/dist/Portal/Portal.d.ts +8 -0
  62. package/dist/Portal/index.d.ts +2 -0
  63. package/dist/Portal/index.js +11 -0
  64. package/dist/ResponsiveModal/ResponsiveModal.d.ts +14 -0
  65. package/dist/ResponsiveModal/index.d.ts +2 -0
  66. package/dist/ResponsiveModal/index.js +62 -0
  67. package/dist/SelectDropdown/SelectDropdown.d.ts +41 -0
  68. package/dist/SelectDropdown/index.d.ts +2 -0
  69. package/dist/SelectDropdown/index.js +195 -0
  70. package/dist/Skeleton/Skeleton.d.ts +3 -0
  71. package/dist/Skeleton/index.d.ts +2 -0
  72. package/dist/Skeleton/index.js +12 -0
  73. package/dist/StatCard/StatCard.d.ts +20 -0
  74. package/dist/StatCard/index.d.ts +2 -0
  75. package/dist/StatCard/index.js +42 -0
  76. package/dist/StateContainer/StateContainer.d.ts +8 -0
  77. package/dist/StateContainer/index.d.ts +2 -0
  78. package/dist/StateContainer/index.js +15 -0
  79. package/dist/StatusChip/StatusChip.d.ts +11 -0
  80. package/dist/StatusChip/index.d.ts +2 -0
  81. package/dist/StatusChip/index.js +33 -0
  82. package/dist/Switch/Switch.d.ts +3 -0
  83. package/dist/Switch/index.d.ts +1 -0
  84. package/dist/Switch/index.js +31 -0
  85. package/dist/Toast/Toast.d.ts +15 -0
  86. package/dist/Toast/Toast.js +93 -0
  87. package/dist/Toast/Toaster.d.ts +5 -0
  88. package/dist/Toast/Toaster.js +30 -0
  89. package/dist/Toast/index.d.ts +5 -0
  90. package/dist/Toast/index.js +16 -0
  91. package/dist/Toast/useToast.d.ts +46 -0
  92. package/dist/Toast/useToast.js +76 -0
  93. package/dist/ToggleGroup/ToggleGroup.d.ts +15 -0
  94. package/dist/ToggleGroup/index.d.ts +2 -0
  95. package/dist/ToggleGroup/index.js +57 -0
  96. package/dist/Typography/Typography.d.ts +2 -2
  97. package/dist/Viewport/Viewport.d.ts +11 -0
  98. package/dist/Viewport/index.d.ts +2 -0
  99. package/dist/Viewport/index.js +7 -0
  100. package/dist/index.d.ts +24 -0
  101. package/dist/index.js +386 -314
  102. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +532 -0
  103. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +403 -0
  104. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +232 -0
  105. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +136 -0
  106. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +128 -0
  107. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
  108. package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +251 -0
  109. package/dist/node_modules/@radix-ui/react-collection/dist/index.js +48 -0
  110. package/dist/node_modules/@radix-ui/{react-slot → react-collection/node_modules/@radix-ui/react-slot}/dist/index.js +1 -1
  111. package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +1 -1
  112. package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
  113. package/dist/node_modules/@radix-ui/react-direction/dist/index.js +10 -0
  114. package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +29 -26
  115. package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +208 -0
  116. package/dist/node_modules/@radix-ui/react-menu/dist/index.js +624 -0
  117. package/dist/node_modules/@radix-ui/react-menu/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
  118. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +221 -0
  119. package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +1 -1
  120. package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.js +50 -0
  121. package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +183 -0
  122. package/dist/node_modules/@radix-ui/react-switch/dist/index.js +132 -0
  123. package/dist/node_modules/@radix-ui/react-toast/dist/index.js +446 -0
  124. package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +330 -0
  125. package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.js +11 -0
  126. package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +8 -0
  127. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +27 -0
  128. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +32 -0
  129. package/dist/node_modules/lucide-react/dist/esm/Icon.js +40 -0
  130. package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +23 -0
  131. package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +20 -0
  132. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-down.js +14 -0
  133. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up-down.js +16 -0
  134. package/dist/node_modules/lucide-react/dist/esm/icons/arrow-up.js +14 -0
  135. package/dist/node_modules/lucide-react/dist/esm/icons/check.js +11 -0
  136. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +13 -0
  137. package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +11 -0
  138. package/dist/node_modules/lucide-react/dist/esm/icons/circle-alert.js +15 -0
  139. package/dist/node_modules/lucide-react/dist/esm/icons/eye-off.js +28 -0
  140. package/dist/node_modules/lucide-react/dist/esm/icons/eye.js +20 -0
  141. package/dist/node_modules/lucide-react/dist/esm/icons/log-out.js +15 -0
  142. package/dist/node_modules/lucide-react/dist/esm/icons/x.js +14 -0
  143. package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +11 -0
  144. package/dist/style.css +1 -1
  145. package/package.json +12 -3
  146. package/dist/Logo/Code4renaLogo.d.ts +0 -5
  147. package/dist/Logo/Code4renaLogo.js +0 -45
@@ -0,0 +1,126 @@
1
+ import { jsxs as a, Fragment as C, jsx as e } from "react/jsx-runtime";
2
+ import { useState as m } from "react";
3
+ import { HamburgerIcon as S } from "../HamburgerIcon/index.js";
4
+ import { ResponsiveModal as w } from "../ResponsiveModal/index.js";
5
+ import { Typography as t } from "../Typography/index.js";
6
+ import { Button as M } from "../Button/index.js";
7
+ import { cn as j } from "../utils/index.js";
8
+ import I from "../node_modules/lucide-react/dist/esm/icons/log-out.js";
9
+ const R = ({ title: i, isOpen: n, onToggle: o, children: s }) => /* @__PURE__ */ a("div", { children: [
10
+ /* @__PURE__ */ e("span", { onClick: o, className: "gf-block gf-cursor-pointer", children: /* @__PURE__ */ e(t, { size: "h3", weight: "medium", children: i }) }),
11
+ /* @__PURE__ */ e(
12
+ "div",
13
+ {
14
+ className: j(
15
+ "gf-grid gf-transition-[grid-template-rows,opacity] gf-duration-500 gf-ease-[cubic-bezier(0.22,1,0.36,1)]",
16
+ n ? "gf-grid-rows-[1fr] gf-opacity-100" : "gf-grid-rows-[0fr] gf-opacity-0"
17
+ ),
18
+ children: /* @__PURE__ */ e("div", { className: "gf-overflow-hidden", children: /* @__PURE__ */ e("div", { className: "gf-ml-6 gf-flex gf-flex-col", children: s }) })
19
+ }
20
+ )
21
+ ] }), A = ({
22
+ navGroups: i,
23
+ activePath: n,
24
+ onNavigate: o,
25
+ onLogout: s,
26
+ showLogoutConfirm: N = !1,
27
+ onLogoutConfirmClose: c
28
+ }) => {
29
+ var b;
30
+ const [h, p] = m(!1), [y, g] = m(!1), [k, u] = m(
31
+ ((b = i[0]) == null ? void 0 : b.label) ?? "group-0"
32
+ ), d = () => {
33
+ var l;
34
+ p(!1), u(((l = i[0]) == null ? void 0 : l.label) ?? "group-0");
35
+ }, v = () => {
36
+ d(), N ? g(!0) : s();
37
+ }, z = () => {
38
+ g(!1), c == null || c();
39
+ };
40
+ return /* @__PURE__ */ a(C, { children: [
41
+ /* @__PURE__ */ e(
42
+ "button",
43
+ {
44
+ type: "button",
45
+ onClick: () => p((l) => !l),
46
+ "aria-label": "Open menu",
47
+ className: "gf-shrink-0",
48
+ children: /* @__PURE__ */ e(S, { isOpen: h })
49
+ }
50
+ ),
51
+ /* @__PURE__ */ a(w, { open: h, onClose: d, className: "gf-w-full", children: [
52
+ /* @__PURE__ */ e("nav", { className: "gf-flex gf-flex-col gf-gap-4 gf-p-6 gf-bg-white/30 gf-rounded-xl", children: i.map((l, O) => {
53
+ const f = l.label ?? `group-${O}`;
54
+ return /* @__PURE__ */ e(
55
+ R,
56
+ {
57
+ title: l.label ?? "Navigation",
58
+ isOpen: k === f,
59
+ onToggle: () => u((r) => r === f ? "" : f),
60
+ children: l.items.map((r) => {
61
+ const x = n === r.href || n === `${r.href}/`;
62
+ return /* @__PURE__ */ e(
63
+ "div",
64
+ {
65
+ className: "gf-cursor-pointer gf-pt-4",
66
+ onClick: () => {
67
+ o(r.href), d();
68
+ },
69
+ children: /* @__PURE__ */ e(
70
+ t,
71
+ {
72
+ size: "h3",
73
+ weight: x ? "medium" : "regular",
74
+ className: x ? "gf-text-primaryIris" : "gf-text-dark-grey",
75
+ children: r.title
76
+ }
77
+ )
78
+ },
79
+ r.href
80
+ );
81
+ })
82
+ },
83
+ f
84
+ );
85
+ }) }),
86
+ /* @__PURE__ */ e("nav", { className: "gf-py-5 gf-px-6 gf-bg-white/30 gf-rounded-xl", children: /* @__PURE__ */ a(
87
+ "button",
88
+ {
89
+ type: "button",
90
+ onClick: v,
91
+ className: "gf-flex gf-w-full gf-cursor-pointer gf-items-center gf-gap-2 focus:gf-outline-none",
92
+ children: [
93
+ /* @__PURE__ */ e(I, { className: "gf-h-5 gf-w-5" }),
94
+ /* @__PURE__ */ e(t, { size: "h3", weight: "medium", children: "Log out" })
95
+ ]
96
+ }
97
+ ) })
98
+ ] }),
99
+ /* @__PURE__ */ a(
100
+ w,
101
+ {
102
+ open: y,
103
+ onClose: z,
104
+ label: "Ready to sign out?",
105
+ className: "gf-max-w-sm",
106
+ children: [
107
+ /* @__PURE__ */ e("div", { className: "gf-flex gf-flex-col gf-gap-2", children: /* @__PURE__ */ e(t, { size: "h5", weight: "regular", children: "You'll be signed out and redirected to the login page." }) }),
108
+ /* @__PURE__ */ e(
109
+ M,
110
+ {
111
+ variant: "primary",
112
+ className: "gf-w-full",
113
+ onClick: () => {
114
+ g(!1), s();
115
+ },
116
+ children: "Sign out"
117
+ }
118
+ )
119
+ ]
120
+ }
121
+ )
122
+ ] });
123
+ };
124
+ export {
125
+ A as MobileMenu
126
+ };
@@ -0,0 +1,13 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export type PageHeaderProps = {
4
+ title: string;
5
+ description?: string;
6
+ compactDescription?: string;
7
+ descriptionClassName?: string;
8
+ widgets?: ReactNode;
9
+ action?: ReactNode;
10
+ hideDescription?: boolean;
11
+ className?: string;
12
+ };
13
+ export declare const PageHeader: ({ title, description, compactDescription, descriptionClassName, widgets, action, hideDescription, className, }: PageHeaderProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,47 @@
1
+ import { jsxs as e, jsx as a } from "react/jsx-runtime";
2
+ import { Typography as t } from "../Typography/index.js";
3
+ import { useViewport as x } from "../Viewport/index.js";
4
+ import { cn as m } from "../utils/index.js";
5
+ const y = ({
6
+ title: o,
7
+ description: n,
8
+ compactDescription: f,
9
+ descriptionClassName: c,
10
+ widgets: g,
11
+ action: r,
12
+ hideDescription: p = !1,
13
+ className: d
14
+ }) => {
15
+ const s = x(), i = s === "mobile", l = s === "smallTab" && f ? f : n;
16
+ return /* @__PURE__ */ e(
17
+ "div",
18
+ {
19
+ className: m(
20
+ "gf-flex gf-justify-between gf-items-center gf-gap-3 gf-p-4 gf-bg-transparent gf-backdrop-blur-3xl gf-sticky gf-top-0 gf-z-[40] gf-transition-all gf-duration-200",
21
+ i ? "" : "md:gf-items-start",
22
+ d
23
+ ),
24
+ children: [
25
+ /* @__PURE__ */ e("div", { className: "gf-flex gf-flex-col gf-gap-2 gf-min-w-0", children: [
26
+ /* @__PURE__ */ a(t, { size: "h2", weight: "medium", children: o }),
27
+ !p && !i && l && /* @__PURE__ */ a(
28
+ t,
29
+ {
30
+ size: "h4",
31
+ weight: "regular",
32
+ className: m("gf-max-w-[350px] lg:gf-max-w-full", c),
33
+ children: l
34
+ }
35
+ )
36
+ ] }),
37
+ (g || r) && /* @__PURE__ */ e("div", { className: "gf-flex gf-items-center gf-gap-3 gf-shrink-0 gf-flex-wrap gf-justify-end", children: [
38
+ g,
39
+ r
40
+ ] })
41
+ ]
42
+ }
43
+ );
44
+ };
45
+ export {
46
+ y as PageHeader
47
+ };
@@ -0,0 +1,10 @@
1
+ export { DashboardSidebar } from './DashboardSidebar';
2
+ export type { DashboardSidebarProps, NavItem, NavGroup, SidebarUser } from './DashboardSidebar';
3
+ export { DashboardNavbar } from './DashboardNavbar';
4
+ export type { DashboardNavbarProps } from './DashboardNavbar';
5
+ export { MobileMenu } from './MobileMenu';
6
+ export type { MobileMenuProps } from './MobileMenu';
7
+ export { PageHeader } from './PageHeader';
8
+ export type { PageHeaderProps } from './PageHeader';
9
+ export { DashboardLayout } from './DashboardLayout';
10
+ export type { DashboardLayoutProps } from './DashboardLayout';
@@ -0,0 +1,93 @@
1
+ import { jsxs as e, jsx as r } from "react/jsx-runtime";
2
+ import { useViewport as D } from "../Viewport/index.js";
3
+ import { DashboardSidebar as S } from "./DashboardSidebar.js";
4
+ import { DashboardNavbar as j } from "./DashboardNavbar.js";
5
+ import { MobileMenu as T } from "./MobileMenu.js";
6
+ import { PageHeader as h } from "./PageHeader.js";
7
+ import { cn as v } from "../utils/index.js";
8
+ const H = ({
9
+ children: f,
10
+ pageTitle: i,
11
+ pageDescription: l,
12
+ pageCompactDescription: s,
13
+ pageWidgets: a,
14
+ headerAction: o,
15
+ navGroups: m,
16
+ activePath: t,
17
+ logo: c,
18
+ logoHref: n,
19
+ user: N,
20
+ onLogout: g,
21
+ showLogoutConfirm: d,
22
+ onLogoutConfirmClose: b,
23
+ onNavigate: u,
24
+ renderLink: w,
25
+ className: x
26
+ }) => {
27
+ const p = D(), y = p === "mobile", M = p === "smallTab";
28
+ return y ? /* @__PURE__ */ e("div", { className: v("gf-min-h-screen gf-text-foreground gf-flex gf-flex-col gf-bg-primaryMist gf-no-scrollbar", x), children: [
29
+ /* @__PURE__ */ r(
30
+ j,
31
+ {
32
+ logo: c,
33
+ logoHref: n,
34
+ menuSlot: /* @__PURE__ */ r(
35
+ T,
36
+ {
37
+ navGroups: m,
38
+ activePath: t,
39
+ onNavigate: u,
40
+ onLogout: g,
41
+ showLogoutConfirm: d,
42
+ onLogoutConfirmClose: b
43
+ }
44
+ )
45
+ }
46
+ ),
47
+ /* @__PURE__ */ e("main", { className: "gf-flex-1 gf-overflow-y-auto", children: [
48
+ /* @__PURE__ */ r(
49
+ h,
50
+ {
51
+ title: i,
52
+ description: l,
53
+ compactDescription: s,
54
+ widgets: a,
55
+ action: o
56
+ }
57
+ ),
58
+ /* @__PURE__ */ r("div", { className: "gf-p-4", children: f })
59
+ ] })
60
+ ] }) : /* @__PURE__ */ e("div", { className: v("gf-min-h-screen gf-text-foreground gf-flex gf-bg-primaryMist gf-no-scrollbar", x), children: [
61
+ /* @__PURE__ */ r(
62
+ S,
63
+ {
64
+ navGroups: m,
65
+ activePath: t,
66
+ logo: c,
67
+ logoHref: n,
68
+ user: N,
69
+ onLogout: g,
70
+ showLogoutConfirm: d,
71
+ onLogoutConfirmClose: b,
72
+ renderLink: w,
73
+ className: M ? "gf-w-[13.5rem]" : void 0
74
+ }
75
+ ),
76
+ /* @__PURE__ */ r("div", { className: "gf-flex-1 gf-flex gf-flex-col gf-min-w-0 gf-h-screen", children: /* @__PURE__ */ e("main", { className: "gf-flex-1 gf-overflow-y-auto gf-h-full", children: [
77
+ /* @__PURE__ */ r(
78
+ h,
79
+ {
80
+ title: i,
81
+ description: l,
82
+ compactDescription: s,
83
+ widgets: a,
84
+ action: o
85
+ }
86
+ ),
87
+ /* @__PURE__ */ r("div", { className: "gf-p-4", children: f })
88
+ ] }) })
89
+ ] });
90
+ };
91
+ export {
92
+ H as DashboardLayout
93
+ };
@@ -0,0 +1,50 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export type DataTableColumn<T> = {
4
+ key: string;
5
+ header: string;
6
+ align?: "left" | "right";
7
+ /** Tailwind width class (e.g. "gf-w-1/4"). Applies to the desktop column. */
8
+ width?: string;
9
+ cell: (row: T) => ReactNode;
10
+ /** Enables a clickable sort arrow in the column header. */
11
+ sortable?: boolean;
12
+ /** Current sort direction for this column. null = unsorted (neutral icon). */
13
+ sortDir?: "asc" | "desc" | null;
14
+ /** Called when the user clicks the column header to sort. */
15
+ onSort?: () => void;
16
+ };
17
+ export type DataTableBodyState = "loading" | "error" | "empty" | "data";
18
+ export type DataTableError = {
19
+ status?: number;
20
+ message: string;
21
+ };
22
+ export type DataTableProps<T> = {
23
+ title?: string;
24
+ /** Optional content rendered to the right of the title (e.g. filter dropdowns). */
25
+ headerActions?: ReactNode;
26
+ rows: T[];
27
+ columns: DataTableColumn<T>[];
28
+ getKey: (row: T, index: number) => string;
29
+ emptyMessage: string;
30
+ emptyMinHeight?: number | string;
31
+ minWidth?: number;
32
+ emptyTitle?: string;
33
+ emptyDescription?: string;
34
+ /** Custom card renderer for the mobile view (<md). Falls back to label/value columns. */
35
+ renderMobileCard?: (row: T, index: number) => ReactNode;
36
+ renderExpanded?: (row: T, index: number) => ReactNode;
37
+ /** Called when a non-expandable row is clicked. Ignored when `renderExpanded` is set. */
38
+ onRowClick?: (row: T, index: number) => void;
39
+ loading?: boolean;
40
+ skeletonRowCount?: number;
41
+ error?: DataTableError | null;
42
+ onRetry?: () => void;
43
+ /** Extra content rendered below the table (e.g. pagination). */
44
+ footer?: ReactNode;
45
+ oddRowColor?: string;
46
+ evenRowColor?: string;
47
+ /** Defaults to `evenRowColor`. */
48
+ headerBgColor?: string;
49
+ };
50
+ export declare const DataTable: <T>({ title, headerActions, rows, columns, getKey, emptyMessage, emptyMinHeight, minWidth, emptyTitle, emptyDescription, renderMobileCard, renderExpanded, onRowClick, loading, skeletonRowCount, error, onRetry, footer, oddRowColor, evenRowColor, headerBgColor, }: DataTableProps<T>) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import * as React from "react";
2
+ export declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
3
+ export declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
4
+ export declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
5
+ export declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
6
+ export declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
7
+ export declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
@@ -0,0 +1,57 @@
1
+ import { jsx as f } from "react/jsx-runtime";
2
+ import * as o from "react";
3
+ import { cn as t } from "../utils/index.js";
4
+ const r = o.forwardRef(({ className: a, ...e }, l) => /* @__PURE__ */ f(
5
+ "table",
6
+ {
7
+ ref: l,
8
+ className: t("gf-w-full gf-caption-bottom gf-text-sm", a),
9
+ ...e
10
+ }
11
+ ));
12
+ r.displayName = "Table";
13
+ const d = o.forwardRef(({ className: a, ...e }, l) => /* @__PURE__ */ f(
14
+ "thead",
15
+ {
16
+ ref: l,
17
+ className: t("[&_tr]:gf-h-10", a),
18
+ ...e
19
+ }
20
+ ));
21
+ d.displayName = "TableHeader";
22
+ const s = o.forwardRef(({ className: a, ...e }, l) => /* @__PURE__ */ f("tbody", { ref: l, className: a, ...e }));
23
+ s.displayName = "TableBody";
24
+ const m = o.forwardRef(({ className: a, ...e }, l) => /* @__PURE__ */ f("tr", { ref: l, className: t("gf-h-10", a), ...e }));
25
+ m.displayName = "TableRow";
26
+ const c = o.forwardRef(({ className: a, ...e }, l) => /* @__PURE__ */ f(
27
+ "th",
28
+ {
29
+ ref: l,
30
+ className: t(
31
+ "gf-px-4 gf-py-2 gf-text-left gf-align-middle gf-font-medium gf-text-midGrey [&:has([role=checkbox])]:gf-pr-0",
32
+ a
33
+ ),
34
+ ...e
35
+ }
36
+ ));
37
+ c.displayName = "TableHead";
38
+ const b = o.forwardRef(({ className: a, ...e }, l) => /* @__PURE__ */ f(
39
+ "td",
40
+ {
41
+ ref: l,
42
+ className: t(
43
+ "gf-px-4 gf-align-middle [&:has([role=checkbox])]:gf-pr-0",
44
+ a
45
+ ),
46
+ ...e
47
+ }
48
+ ));
49
+ b.displayName = "TableCell";
50
+ export {
51
+ r as Table,
52
+ s as TableBody,
53
+ b as TableCell,
54
+ c as TableHead,
55
+ d as TableHeader,
56
+ m as TableRow
57
+ };
@@ -0,0 +1,2 @@
1
+ export { DataTable } from './DataTable';
2
+ export type { DataTableColumn, DataTableProps } from './DataTable';
@@ -0,0 +1,269 @@
1
+ import { jsxs as f, jsx as e } from "react/jsx-runtime";
2
+ import { useState as R, useRef as ee, Fragment as te } from "react";
3
+ import { motion as b, AnimatePresence as ae } from "framer-motion";
4
+ import { Typography as c } from "../Typography/index.js";
5
+ import { cn as h } from "../utils/index.js";
6
+ import { Table as re, TableHeader as ie, TableRow as T, TableHead as H, TableBody as ne, TableCell as x } from "./Table.js";
7
+ import { useAnimatedTable as fe } from "./useAnimatedTable.js";
8
+ import { ErrorStateContent as O } from "../ErrorState/index.js";
9
+ import { EmptyStateContent as U } from "../EmptyState/index.js";
10
+ import { CardList as le } from "../CardList/index.js";
11
+ import ge from "../node_modules/lucide-react/dist/esm/icons/arrow-up.js";
12
+ import se from "../node_modules/lucide-react/dist/esm/icons/arrow-down.js";
13
+ import oe from "../node_modules/lucide-react/dist/esm/icons/arrow-up-down.js";
14
+ import de from "../node_modules/lucide-react/dist/esm/icons/chevron-down.js";
15
+ const he = b(T), Te = ({
16
+ title: p,
17
+ headerActions: N,
18
+ rows: m,
19
+ columns: l,
20
+ getKey: v,
21
+ emptyMessage: j,
22
+ emptyMinHeight: w = "40dvh",
23
+ minWidth: F = 900,
24
+ emptyTitle: u,
25
+ emptyDescription: z,
26
+ renderMobileCard: L,
27
+ renderExpanded: y,
28
+ onRowClick: g,
29
+ loading: k = !1,
30
+ skeletonRowCount: C = 6,
31
+ error: s = null,
32
+ onRetry: I,
33
+ footer: A,
34
+ oddRowColor: _ = "#f5f8fa",
35
+ evenRowColor: B = "#ebf0f5",
36
+ headerBgColor: q
37
+ }) => {
38
+ const r = !!y, J = m.length === 0, o = k ? "loading" : s ? "error" : J ? "empty" : "data", [M, Q] = R(null), D = (t) => Q((a) => a === t ? null : t), V = `${o}-${m.length}`, { wrapperRef: W, animatedKeys: S, wasPreloaded: X, skeletonCount: Y } = fe(k, m.length, C, V), K = ee(null);
39
+ o === "data" && K.current === "loading" && m.forEach((t, a) => S.current.add(v(t, a))), K.current = o;
40
+ const $ = q ?? B, E = (t) => ({
41
+ backgroundColor: t % 2 === 0 ? _ : B
42
+ }), Z = l.length + (r ? 1 : 0);
43
+ return /* @__PURE__ */ f("div", { className: "gf-w-full gf-overflow-hidden gf-rounded-2xl gf-bg-white/30 gf-flex gf-flex-col [overflow-anchor:none]", children: [
44
+ (p || N) && /* @__PURE__ */ f(
45
+ "div",
46
+ {
47
+ className: "gf-flex gf-items-center gf-justify-between gf-gap-3 gf-px-6 gf-py-4",
48
+ style: { backgroundColor: $ },
49
+ children: [
50
+ p ? /* @__PURE__ */ e(c, { size: "h5", weight: "medium", children: p }) : /* @__PURE__ */ e("span", {}),
51
+ N && /* @__PURE__ */ e("div", { className: "gf-flex gf-items-center gf-gap-2 gf-flex-wrap", children: N })
52
+ ]
53
+ }
54
+ ),
55
+ /* @__PURE__ */ e("div", { className: "md:gf-hidden", children: /* @__PURE__ */ e(
56
+ le,
57
+ {
58
+ rows: m,
59
+ columns: l,
60
+ getKey: v,
61
+ emptyMinHeight: w,
62
+ loading: k,
63
+ skeletonRowCount: Math.max(3, Math.floor(C / 2)),
64
+ error: s ? /* @__PURE__ */ e(
65
+ O,
66
+ {
67
+ status: s.status,
68
+ message: s.message,
69
+ onRetry: I
70
+ }
71
+ ) : void 0,
72
+ empty: u ? /* @__PURE__ */ e(U, { title: u, description: z }) : /* @__PURE__ */ e(c, { size: "h5", weight: "regular", className: "gf-text-midGrey", children: j }),
73
+ renderCard: L,
74
+ renderExpanded: y,
75
+ onRowClick: g,
76
+ className: p && "gf-rounded-none"
77
+ }
78
+ ) }),
79
+ /* @__PURE__ */ e(
80
+ b.div,
81
+ {
82
+ ref: W,
83
+ className: "gf-hidden md:gf-block gf-overflow-x-auto gf-overflow-y-hidden gf-no-scrollbar @container",
84
+ children: /* @__PURE__ */ f(re, { className: "gf-table-fixed", style: { minWidth: F }, children: [
85
+ /* @__PURE__ */ e(ie, { children: /* @__PURE__ */ f(T, { style: { backgroundColor: $ }, children: [
86
+ l.map((t, a) => /* @__PURE__ */ e(
87
+ H,
88
+ {
89
+ className: h(
90
+ t.width,
91
+ a === 0 && "gf-pl-6",
92
+ !r && a === l.length - 1 && "gf-pr-6",
93
+ t.align === "right" && "gf-text-right"
94
+ ),
95
+ children: t.sortable ? /* @__PURE__ */ f(
96
+ "button",
97
+ {
98
+ type: "button",
99
+ onClick: t.onSort,
100
+ className: h(
101
+ "gf-inline-flex gf-items-center gf-gap-1 gf-cursor-pointer gf-transition-colors hover:gf-text-primaryIris",
102
+ t.align === "right" && "gf-ml-auto"
103
+ ),
104
+ children: [
105
+ /* @__PURE__ */ e(c, { size: "h5", weight: "regular", children: t.header }),
106
+ t.sortDir === "asc" ? /* @__PURE__ */ e(ge, { className: "gf-h-3 gf-w-3 gf-text-primaryIris gf-shrink-0" }) : t.sortDir === "desc" ? /* @__PURE__ */ e(se, { className: "gf-h-3 gf-w-3 gf-text-primaryIris gf-shrink-0" }) : /* @__PURE__ */ e(oe, { className: "gf-h-3 gf-w-3 gf-text-midGrey gf-shrink-0" })
107
+ ]
108
+ }
109
+ ) : /* @__PURE__ */ e(c, { size: "h5", weight: "regular", children: t.header })
110
+ },
111
+ t.key
112
+ )),
113
+ r && /* @__PURE__ */ e(H, { className: "gf-w-12 gf-pl-0 gf-pr-6", "aria-hidden": !0 })
114
+ ] }) }),
115
+ /* @__PURE__ */ f(ne, { children: [
116
+ o === "loading" && Array.from({ length: Y }).map((t, a) => /* @__PURE__ */ f(
117
+ T,
118
+ {
119
+ className: "gf-h-[42px] gf-pointer-events-none",
120
+ style: E(a),
121
+ children: [
122
+ l.map((n, d) => /* @__PURE__ */ e(
123
+ x,
124
+ {
125
+ className: h(
126
+ d === 0 && "gf-pl-6",
127
+ !r && d === l.length - 1 && "gf-pr-6",
128
+ n.align === "right" && "gf-text-right"
129
+ ),
130
+ children: /* @__PURE__ */ e(
131
+ "div",
132
+ {
133
+ className: h(
134
+ "gf-h-4 gf-w-3/4 gf-bg-gray-100 gf-rounded-md gf-animate-pulse",
135
+ n.align === "right" && "gf-ml-auto"
136
+ )
137
+ }
138
+ )
139
+ },
140
+ n.key
141
+ )),
142
+ r && /* @__PURE__ */ e(x, { className: "gf-w-12 gf-pl-0 gf-pr-6" })
143
+ ]
144
+ },
145
+ `skel-${a}`
146
+ )),
147
+ o === "data" && m.map((t, a) => {
148
+ const n = v(t, a), d = r && M === n, G = !X.current && !S.current.has(n);
149
+ return G && S.current.add(n), /* @__PURE__ */ f(te, { children: [
150
+ /* @__PURE__ */ f(
151
+ he,
152
+ {
153
+ className: h(
154
+ "gf-h-[42px]",
155
+ (r || g) && "gf-cursor-pointer gf-transition-colors hover:!gf-bg-white/70"
156
+ ),
157
+ style: E(a),
158
+ initial: G ? { opacity: 0 } : !1,
159
+ animate: { opacity: 1 },
160
+ transition: { duration: 0.15, ease: [0.4, 0, 0.2, 1] },
161
+ onClick: r ? () => D(n) : g ? () => g(t, a) : void 0,
162
+ role: r || g ? "button" : void 0,
163
+ tabIndex: r || g ? 0 : void 0,
164
+ onKeyDown: r ? (i) => {
165
+ (i.key === "Enter" || i.key === " ") && (i.preventDefault(), D(n));
166
+ } : g ? (i) => {
167
+ (i.key === "Enter" || i.key === " ") && (i.preventDefault(), g(t, a));
168
+ } : void 0,
169
+ "aria-expanded": r ? d : void 0,
170
+ children: [
171
+ l.map((i, P) => /* @__PURE__ */ e(
172
+ x,
173
+ {
174
+ className: h(
175
+ P === 0 && "gf-pl-6",
176
+ !r && P === l.length - 1 && "gf-pr-6",
177
+ i.align === "right" && "gf-text-right"
178
+ ),
179
+ children: /* @__PURE__ */ e(c, { size: "h5", weight: "medium", as: "span", children: i.cell(t) })
180
+ },
181
+ i.key
182
+ )),
183
+ r && /* @__PURE__ */ e(x, { className: "gf-w-12 gf-pl-0 gf-pr-6", children: /* @__PURE__ */ e(
184
+ "button",
185
+ {
186
+ type: "button",
187
+ onClick: (i) => {
188
+ i.stopPropagation(), D(n);
189
+ },
190
+ className: "gf-ml-auto gf-flex gf-items-center gf-justify-center gf-rounded-full focus:gf-outline-none",
191
+ "aria-label": d ? "Collapse row" : "Expand row",
192
+ tabIndex: -1,
193
+ children: /* @__PURE__ */ e(
194
+ de,
195
+ {
196
+ className: h(
197
+ "gf-h-4 gf-w-4 gf-text-primaryIris gf-transition-transform",
198
+ d && "gf-rotate-180"
199
+ )
200
+ }
201
+ )
202
+ }
203
+ ) })
204
+ ]
205
+ }
206
+ ),
207
+ /* @__PURE__ */ e(ae, { initial: !1, children: d && y && /* @__PURE__ */ e(
208
+ b.tr,
209
+ {
210
+ style: E(a),
211
+ initial: { opacity: 0 },
212
+ animate: { opacity: 1 },
213
+ exit: { opacity: 0 },
214
+ transition: { duration: 0.2, ease: "easeOut" },
215
+ children: /* @__PURE__ */ e("td", { colSpan: Z, className: "gf-p-0 gf-border-0", children: /* @__PURE__ */ e(
216
+ b.div,
217
+ {
218
+ initial: { height: 0 },
219
+ animate: { height: "auto" },
220
+ exit: { height: 0 },
221
+ transition: { duration: 0.3, ease: "easeOut" },
222
+ className: "gf-overflow-hidden",
223
+ children: y(t, a)
224
+ }
225
+ ) })
226
+ },
227
+ `${n}-exp`
228
+ ) })
229
+ ] }, n);
230
+ })
231
+ ] })
232
+ ] })
233
+ }
234
+ ),
235
+ o === "error" && s && /* @__PURE__ */ e(
236
+ "div",
237
+ {
238
+ className: "gf-flex gf-items-center gf-justify-center gf-w-full gf-bg-white/50",
239
+ style: { minHeight: w },
240
+ children: /* @__PURE__ */ e(
241
+ O,
242
+ {
243
+ status: s.status,
244
+ message: s.message,
245
+ onRetry: I
246
+ }
247
+ )
248
+ }
249
+ ),
250
+ o === "empty" && /* @__PURE__ */ e(
251
+ "div",
252
+ {
253
+ className: "gf-flex gf-items-center gf-justify-center gf-w-full gf-bg-white/50",
254
+ style: { minHeight: w },
255
+ children: u ? /* @__PURE__ */ e(
256
+ U,
257
+ {
258
+ title: u,
259
+ description: z
260
+ }
261
+ ) : /* @__PURE__ */ e(c, { size: "h5", weight: "regular", className: "gf-text-midGrey", children: j })
262
+ }
263
+ ),
264
+ A && /* @__PURE__ */ e("div", { className: "gf-px-4 sm:gf-px-6 gf-pb-4", children: A })
265
+ ] });
266
+ };
267
+ export {
268
+ Te as DataTable
269
+ };